Skip to content

Instantly share code, notes, and snippets.

View parndt's full-sized avatar
🇺🇦

Philip Arndt parndt

🇺🇦
View GitHub Profile
# Custom types are scoped to a particular site instance,
# so their class names are suffixed with the site ID.
# This also helps Content#const_missing figure out when we're
# trying to load a custom type, because it gets numbers at the
# end of the class name.
# Note: I've put some validation logic in CustomType to ensure
# that the name in the database is a valid Ruby constant name.
# new_custom_type = Content::CustomType.create(:site_id => 1, :name => "My custom type")
# Content::MyCustomType1 #=> Content::MyCustomType1(...)
Filesystem Size Used Avail Capacity Mounted on
/dev/disk0s2 59Gi 53Gi 6.0Gi 90% /
devfs 110Ki 110Ki 0Bi 100% /dev
map -hosts 0Bi 0Bi 0Bi 100% /net
map auto_home 0Bi 0Bi 0Bi 100% /home
/dev/disk1s2 97Gi 88Gi 9.2Gi 91% /Volumes/Macintosh HD
/dev/disk1s3 135Gi 130Gi 4.8Gi 97% /Volumes/Backups
git remote add -f avit git://github.com/avit/refinerycms.git
git checkout -b avit/presenters
git cherry-pick e28b5e8ef9393ee6df441828ad72eb2014d57b5d
# make changes and then
git commit -c e28b5e8
git checkout master
git merge avit/presenters
# /shared/_menu.html.erb
<% cache(:action_suffix => "site_menu") do %>
<ul id='<%= dom_id ||= "menu" %>' class='menu clearfix'>
<%= render :partial => "/shared/menu_branch", :collection => @menu_pages, :locals => {
:hide_children => RefinerySetting.find_or_set(:menu_hide_children, false)
} -%>
</ul>
<% end %>
# /shared/_menu_branch.html.erb
demolicious/
|-- LICENSE
|-- README
|-- page_layouts
| |-- config.yml
| |-- homepage.erb.html
| `-- locale.yml
|-- images
|-- stylesheets
`-- views
# place in config/environments/development.rb
config.after_initialize do
::ActiveSupport::Dependencies.load_once_paths = ::ActiveSupport::Dependencies.load_once_paths.select do |path|
(path =~ /app/).nil?
end
end
# bulk upload images to refinery
# open script/console on refinery site
# > script/console
# define some functions we need
include ActionController::TestProcess
def use_temp_file(fixture_filename)
temp_path = File.join('/tmp', File.basename(fixture_filename))
FileUtils.mkdir_p File.join('/', 'tmp')
FileUtils.cp File.join('/', fixture_filename), File.join('/', temp_path)
<div id='editor_switch'>
<%
if admin?
(r = ::ActionController::TestRequest.new(request.env)).path = (request.request_uri.to_s.match(/\/admin(.*)\/edit/)[1] rescue root_url)
public_route = ((c = ActionController::Routing::Routes.recognize(r)).present? and c != ApplicationController) ? r.path : root_url rescue root_url
else
if @page.present? and !@page.home?
editor_route = edit_admin_page_url(@page)
else
editor_route = (request.request_uri.to_s == '/') ? admin_root_url : "/admin#{request.request_uri}/edit"
<%= render :partial => "/shared/admin/image_picker", :locals => {
:f => f,
:field => :image_id,
:image => @page.image,
:toggle_image_display => false
} %>
<div class='field'>
<%= f.label :image_id %>
<%= render :partial => "/shared/admin/image_picker", :locals => {
:f => f,
:field => :image_id,
:image => @page.image,
:toggle_image_display => false
} %>
</div>