refinerycms 0.9.5.29 → 0.9.5.30
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -1
- data/.yardopts +21 -0
- data/CONTRIBUTORS +5 -2
- data/{README → README.rdoc} +6 -3
- data/Rakefile +8 -11
- data/VERSION +1 -1
- data/app/controllers/application.rb +1 -1
- data/app/controllers/application_controller.rb +1 -2
- data/bin/refinery +23 -23
- data/config/amazon_s3.yml.example +18 -0
- data/config/database.yml.example +0 -0
- data/config/environment.rb +4 -3
- data/config/environments/production.rb +6 -1
- data/config/preinitializer.rb +4 -0
- data/config/rackspace_cloudfiles.yml.example +14 -0
- data/db/migrate/20100114092849_add_themes_table.rb +19 -0
- data/db/schema.rb +12 -1
- data/db/seeds.rb +1 -0
- data/public/images/refinery/icons/star.png +0 -0
- data/public/javascripts/wymeditor/jquery.refinery.wymeditor.js +5 -4
- data/public/stylesheets/refinery/refinery.css +1 -9
- data/themes/demolicious/LICENSE +21 -0
- data/themes/demolicious/README +1 -0
- data/themes/demolicious/images/footer_background.png +0 -0
- data/themes/demolicious/images/header_background.png +0 -0
- data/themes/demolicious/preview.png +0 -0
- data/themes/demolicious/stylesheets/application.css +94 -0
- data/themes/demolicious/stylesheets/formatting.css +36 -0
- data/themes/demolicious/stylesheets/home.css +11 -0
- data/themes/demolicious/stylesheets/ie6.css +0 -0
- data/themes/demolicious/stylesheets/ie7.css +0 -0
- data/themes/demolicious/views/layouts/application.html.erb +33 -0
- data/themes/demolicious/views/pages/home.html.erb +1 -0
- data/themes/demolicious/views/pages/show.html.erb +1 -0
- data/themes/hemingway/LICENSE +7 -0
- data/themes/hemingway/README +3 -0
- data/themes/hemingway/images/archives.gif +0 -0
- data/themes/hemingway/images/footer_black.gif +0 -0
- data/themes/hemingway/images/kyle-header.jpg +0 -0
- data/themes/hemingway/images/readon_black.gif +0 -0
- data/themes/hemingway/images/search.gif +0 -0
- data/themes/hemingway/images/spinner.gif +0 -0
- data/themes/hemingway/images/trackback_pingback.gif +0 -0
- data/themes/hemingway/preview.png +0 -0
- data/themes/hemingway/stylesheets/application.css +713 -0
- data/themes/hemingway/views/layouts/application.html.erb +64 -0
- data/themes/hemingway/views/shared/content_page.html.erb +0 -0
- data/vendor/plugins/dashboard/app/controllers/admin/dashboard_controller.rb +17 -6
- data/vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb +3 -3
- data/vendor/plugins/dashboard/app/views/admin/dashboard/_recent_activity.html.erb +1 -1
- data/vendor/plugins/images/app/models/image.rb +4 -3
- data/vendor/plugins/inquiries/app/models/inquiry.rb +2 -1
- data/vendor/plugins/news/app/controllers/admin/news_items_controller.rb +1 -1
- data/vendor/plugins/news/app/models/news_item.rb +5 -7
- data/vendor/plugins/news/app/views/admin/news_items/index.html.erb +10 -14
- data/vendor/plugins/pages/app/controllers/admin/pages_controller.rb +7 -9
- data/vendor/plugins/pages/app/models/page.rb +4 -9
- data/vendor/plugins/pages/app/models/page_part.rb +1 -8
- data/vendor/plugins/pages/app/views/admin/pages/index.html.erb +2 -2
- data/vendor/plugins/refinery/app/views/admin/_head.html.erb +7 -1
- data/vendor/plugins/refinery/app/views/shared/_content_page.html.erb +1 -1
- data/vendor/plugins/refinery/app/views/shared/_menu.html.erb +16 -14
- data/vendor/plugins/refinery/app/views/shared/_message.html.erb +4 -4
- data/vendor/plugins/refinery/app/views/shared/admin/_search.html.erb +2 -2
- data/vendor/plugins/refinery/lib/crud.rb +78 -26
- data/vendor/plugins/refinery/lib/generators/refinery/templates/migration.rb +2 -1
- data/vendor/plugins/refinery/lib/generators/refinery/templates/model.rb +2 -1
- data/vendor/plugins/refinery/lib/refinery/application_controller.rb +5 -1
- data/vendor/plugins/refinery/lib/refinery/html_truncation_helper.rb +2 -2
- data/vendor/plugins/refinery/lib/refinery/initializer.rb +1 -1
- data/vendor/plugins/refinery/lib/refinery/plugin.rb +1 -1
- data/vendor/plugins/refinery/lib/tasks/doc.rake +29 -0
- data/vendor/plugins/refinery/lib/tasks/refinery.rake +1 -2
- data/vendor/plugins/refinery/lib/tasks/yard.rake +32 -0
- data/vendor/plugins/refinery_settings/app/models/refinery_setting.rb +4 -0
- data/vendor/plugins/refinery_settings/app/views/admin/refinery_settings/_refinery_setting.html.erb +1 -1
- data/vendor/plugins/refinery_settings/app/views/admin/refinery_settings/index.html.erb +12 -18
- data/vendor/plugins/resources/app/models/resource.rb +5 -4
- data/vendor/plugins/resources/config/routes.rb +3 -1
- data/vendor/plugins/themes/app/controllers/admin/themes_controller.rb +25 -0
- data/vendor/plugins/themes/app/controllers/themes_controller.rb +49 -0
- data/vendor/plugins/themes/app/models/theme.rb +62 -0
- data/vendor/plugins/themes/app/views/admin/themes/_form.html.erb +11 -0
- data/vendor/plugins/themes/app/views/admin/themes/_theme.html.erb +24 -0
- data/vendor/plugins/themes/app/views/admin/themes/edit.html.erb +1 -0
- data/vendor/plugins/themes/app/views/admin/themes/index.html.erb +35 -0
- data/vendor/plugins/themes/app/views/admin/themes/new.html.erb +1 -0
- data/vendor/plugins/themes/config/routes.rb +12 -0
- data/vendor/plugins/themes/rails/init.rb +9 -0
- data/vendor/plugins/themes/themes.rdoc +131 -0
- metadata +52 -39
- data/config/amazon_s3.yml +0 -17
- data/config/rackspace_cloudfiles.yml +0 -14
- data/public/images/lightbox/bullet.gif +0 -0
- data/public/images/lightbox/close.gif +0 -0
- data/public/images/lightbox/closelabel.gif +0 -0
- data/public/images/lightbox/donate-button.gif +0 -0
- data/public/images/lightbox/download-icon.gif +0 -0
- data/public/images/lightbox/loading.gif +0 -0
- data/public/images/lightbox/nextlabel.gif +0 -0
- data/public/images/lightbox/prevlabel.gif +0 -0
- data/public/images/refinery/add.gif +0 -0
- data/public/images/refinery/cross.gif +0 -0
- data/public/images/refinery/deactive-gradient.gif +0 -0
- data/public/images/refinery/delete.gif +0 -0
- data/public/images/refinery/drag.gif +0 -0
- data/public/images/refinery/edit.gif +0 -0
- data/public/images/refinery/header-background.gif +0 -0
- data/public/images/refinery/icons/bin_closed.png +0 -0
- data/public/images/refinery/icons/help.png +0 -0
- data/public/images/refinery/icons/page_link.png +0 -0
- data/public/images/refinery/icons/reorder.png +0 -0
- data/public/images/refinery/icons/user.png +0 -0
- data/public/images/refinery/info.gif +0 -0
- data/public/images/refinery/m-tools.gif +0 -0
- data/public/images/refinery/magnifier.png +0 -0
- data/public/images/refinery/resolve-digital.gif +0 -0
- data/public/images/refinery/search.gif +0 -0
- data/public/images/refinery/shad_blcorner.png +0 -0
- data/public/images/refinery/shad_bottom.png +0 -0
- data/public/images/refinery/shad_brcorner.png +0 -0
- data/public/images/refinery/shad_tlcorner.png +0 -0
- data/public/images/refinery/shad_trcorner.png +0 -0
- data/public/images/refinery/tableft.gif +0 -0
- data/public/images/refinery/tabright.gif +0 -0
- data/public/images/refinery/tick.gif +0 -0
@@ -0,0 +1,64 @@
|
|
1
|
+
<% setup # sets up any meta tags and page title -%>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
5
|
+
<head>
|
6
|
+
<title>
|
7
|
+
<%= yield :title %> - <%= RefinerySetting.find_or_set(:site_name, "Company Name") %>
|
8
|
+
</title><%= stylesheet_link_tag 'theme/application' %>
|
9
|
+
<link rel="shortcut icon" href="/favicon.ico" />
|
10
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><%= yield :head %>
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
<div id="header">
|
14
|
+
<div class="inside">
|
15
|
+
<h2>
|
16
|
+
<%= link_to RefinerySetting.find_or_set(:site_name, "Company Name"), root_url %>
|
17
|
+
</h2>
|
18
|
+
<p class="description">
|
19
|
+
<%= link_to "Home", root_url %>
|
20
|
+
</p>
|
21
|
+
</div>
|
22
|
+
</div>
|
23
|
+
<div id='primary'>
|
24
|
+
<div class='inside clearfix'>
|
25
|
+
<%= yield %>
|
26
|
+
</div>
|
27
|
+
</div>
|
28
|
+
<div id="ancillary">
|
29
|
+
<div class="inside">
|
30
|
+
<div class="block first" style='margin: 0;'>
|
31
|
+
<h2>Recent Posts</h2>
|
32
|
+
<% if NewsItem.latest.empty? %>
|
33
|
+
<p>No news posts yet</p>
|
34
|
+
<% else %>
|
35
|
+
<ul>
|
36
|
+
<% NewsItem.latest.each do |item| %>
|
37
|
+
<li>
|
38
|
+
<%= link_to item.title, news_item_url(item) %>
|
39
|
+
</li>
|
40
|
+
<% end %>
|
41
|
+
</ul>
|
42
|
+
<% end %>
|
43
|
+
</div>
|
44
|
+
<div class="block pages">
|
45
|
+
<h2>
|
46
|
+
Pages
|
47
|
+
</h2>
|
48
|
+
<%= render :partial => 'shared/menu' %>
|
49
|
+
<div class="clear"></div>
|
50
|
+
</div>
|
51
|
+
</div>
|
52
|
+
<hr class="hide" />
|
53
|
+
<div id="footer">
|
54
|
+
<div class="inside">
|
55
|
+
<p style='clear: both; text-align: center;'>
|
56
|
+
Copyright © <%= Time.now.year %>
|
57
|
+
<%= RefinerySetting.find_or_set(:site_name, "Company Name") %>
|
58
|
+
</p>
|
59
|
+
</div>
|
60
|
+
</div>
|
61
|
+
</div>
|
62
|
+
<%= render :partial => 'shared/google_analytics' unless local_request? %>
|
63
|
+
</body>
|
64
|
+
</html>
|
File without changes
|
@@ -3,14 +3,25 @@ class Admin::DashboardController < Admin::BaseController
|
|
3
3
|
def index
|
4
4
|
@recent_activity = []
|
5
5
|
Refinery::Plugins.active.each do |plugin|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
begin
|
7
|
+
plugin.activity.each do |activity|
|
8
|
+
include_associations = []
|
9
|
+
include_associations.push(:slugs) if activity.class.methods.include? "find_one_with_friendly" # wee performance gain if slugs are used.
|
10
|
+
|
11
|
+
@recent_activity += activity.class.find(:all,
|
12
|
+
:conditions => activity.conditions,
|
13
|
+
:order => activity.order,
|
14
|
+
:limit => activity.limit,
|
15
|
+
:include => include_associations
|
16
|
+
)
|
17
|
+
end
|
18
|
+
rescue
|
19
|
+
logger.info "#{$!.class.name} raised while getting recent activity for dashboard."
|
20
|
+
logger.warn $!.backtrace.collect { |b| " > #{b}" }.join("\n")
|
21
|
+
end
|
11
22
|
end
|
12
23
|
|
13
|
-
@recent_activity = @recent_activity.sort{|x,y| y.updated_at <=> x.updated_at}[0..(
|
24
|
+
@recent_activity = @recent_activity.compact.uniq.sort{|x,y| y.updated_at <=> x.updated_at}[0..(RefinerySetting.find_or_set(:activity_show_limit, 15)-1)]
|
14
25
|
end
|
15
26
|
|
16
27
|
end
|
@@ -2,7 +2,7 @@ module Admin::DashboardHelper
|
|
2
2
|
|
3
3
|
def activity_message_for(record)
|
4
4
|
unless (activity = Refinery::Plugins.active.find_activity_by_model(record.class)).nil? or activity.title.blank?
|
5
|
-
title =
|
5
|
+
title = record.send activity.title
|
6
6
|
link = link_to truncate(title, :length => 45),
|
7
7
|
eval("#{activity.url_prefix}admin_#{record.class.name.underscore.downcase}_url(record)"),
|
8
8
|
:title => "See '#{title}'"
|
@@ -10,9 +10,9 @@ module Admin::DashboardHelper
|
|
10
10
|
# next work out which action occured and how long ago it happened
|
11
11
|
action = record.updated_at.eql?(record.created_at) ? "created" : "updated"
|
12
12
|
|
13
|
-
message = "<td>#{refinery_icon_tag("#{
|
13
|
+
message = "<td>#{refinery_icon_tag("#{activity.send "#{action}_image"}")}</td>"
|
14
14
|
message << "<td>#{link} #{record.class.name.titleize.downcase} was #{action}</td>"
|
15
|
-
message << "<td class='time_ago'>#{time_ago_in_words(
|
15
|
+
message << "<td class='time_ago'>#{time_ago_in_words(record.send "#{action}_at").gsub("about ", "")} ago</td>"
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -3,13 +3,14 @@ class Image < ActiveRecord::Base
|
|
3
3
|
has_many :pages
|
4
4
|
|
5
5
|
has_attachment :content_type => :image,
|
6
|
-
:storage => :file_system,
|
7
|
-
:path_prefix => 'public/system/images',
|
6
|
+
:storage => (USE_S3_BACKEND ? :s3 : :file_system),
|
7
|
+
:path_prefix => (USE_S3_BACKEND ? nil : 'public/system/images'),
|
8
8
|
:processor => 'Rmagick',
|
9
9
|
:thumbnails => ((((thumbnails = RefinerySetting.find_or_set(:image_thumbnails, {})).is_a?(Hash) ? thumbnails : (RefinerySetting[:image_thumbnails] = {}))) rescue {}),
|
10
10
|
:max_size => 5.megabytes
|
11
11
|
|
12
|
-
acts_as_indexed :fields => [:title]
|
12
|
+
acts_as_indexed :fields => [:title],
|
13
|
+
:index_file => [RAILS_ROOT,"tmp","index"]
|
13
14
|
|
14
15
|
def validate
|
15
16
|
errors.add_to_base("You must choose a file to upload") unless self.filename
|
@@ -5,7 +5,8 @@ class Inquiry < ActiveRecord::Base
|
|
5
5
|
:with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i,
|
6
6
|
:message => 'must be valid'
|
7
7
|
|
8
|
-
acts_as_indexed :fields => [:name, :email, :message, :phone]
|
8
|
+
acts_as_indexed :fields => [:name, :email, :message, :phone],
|
9
|
+
:index_file => [RAILS_ROOT,"tmp","index"]
|
9
10
|
|
10
11
|
def self.closed
|
11
12
|
find_all_by_open(false, :order => "created_at DESC")
|
@@ -1,10 +1,12 @@
|
|
1
1
|
class NewsItem < ActiveRecord::Base
|
2
2
|
|
3
3
|
validates_presence_of :title, :content
|
4
|
+
alias_attribute :content, :body
|
4
5
|
|
5
6
|
has_friendly_id :title, :use_slug => true, :strip_diacritics => true
|
6
7
|
|
7
|
-
acts_as_indexed :fields => [:title, :body]
|
8
|
+
acts_as_indexed :fields => [:title, :body],
|
9
|
+
:index_file => [RAILS_ROOT,"tmp","index"]
|
8
10
|
|
9
11
|
def self.latest(amount = 10)
|
10
12
|
find(:all, :order => "publish_date DESC", :limit => amount,
|
@@ -15,12 +17,8 @@ class NewsItem < ActiveRecord::Base
|
|
15
17
|
publish_date > Time.now
|
16
18
|
end
|
17
19
|
|
18
|
-
def
|
19
|
-
|
20
|
-
end
|
21
|
-
|
22
|
-
def content=(value)
|
23
|
-
self.body = value
|
20
|
+
def self.per_page
|
21
|
+
20
|
24
22
|
end
|
25
23
|
|
26
24
|
end
|
@@ -9,27 +9,23 @@
|
|
9
9
|
</ul>
|
10
10
|
</div>
|
11
11
|
<div id='records'>
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
12
|
+
<%= "<h2>Search Results for \"#{params[:search]}\"</h2>" if searching? %>
|
13
|
+
<% unless @news_items.empty? %>
|
14
|
+
<%= will_paginate @news_items, :previous_label => '«', :next_label => '»' %>
|
15
|
+
<ul>
|
16
|
+
<%= render :partial => "news_item", :collection => @news_items %>
|
17
|
+
</ul>
|
18
|
+
<%= will_paginate @news_items, :previous_label => '«', :next_label => '»' %>
|
19
19
|
<% else %>
|
20
|
-
<%
|
21
|
-
<%= will_paginate @news_items, :previous_label => '«', :next_label => '»' %>
|
22
|
-
<ul>
|
23
|
-
<%= render :partial => "news_item", :collection => @news_items %>
|
24
|
-
</ul>
|
25
|
-
<%= will_paginate @news_items, :previous_label => '«', :next_label => '»' %>
|
26
|
-
<% else %>
|
20
|
+
<% unless searching? %>
|
27
21
|
<p>
|
28
22
|
<strong>
|
29
23
|
There are no news items yet.
|
30
24
|
Click "Create News Item" to add your first news item.
|
31
25
|
</strong>
|
32
26
|
</p>
|
27
|
+
<% else %>
|
28
|
+
<p>Sorry, no results found.</p>
|
33
29
|
<% end %>
|
34
30
|
<% end %>
|
35
31
|
</div>
|
@@ -1,14 +1,7 @@
|
|
1
1
|
class Admin::PagesController < Admin::BaseController
|
2
2
|
|
3
|
-
crudify :page, :conditions => "parent_id IS NULL", :order => "position ASC", :include => [:parts, :slugs, :children, :
|
4
|
-
|
5
|
-
def index
|
6
|
-
if searching?
|
7
|
-
@pages = Page.find_with_index params[:search]
|
8
|
-
else
|
9
|
-
@pages = Page.find_all_by_parent_id(nil, :order => "position ASC")
|
10
|
-
end
|
11
|
-
end
|
3
|
+
crudify :page, :conditions => "parent_id IS NULL", :order => "position ASC", :include => [:parts, :slugs, :children], :paging => false
|
4
|
+
after_filter :expire_menu_fragment_caching, :only => [:create, :update, :destroy]
|
12
5
|
|
13
6
|
def new
|
14
7
|
@page = Page.new
|
@@ -17,4 +10,9 @@ class Admin::PagesController < Admin::BaseController
|
|
17
10
|
end
|
18
11
|
end
|
19
12
|
|
13
|
+
protected
|
14
|
+
def expire_menu_fragment_caching
|
15
|
+
expire_fragment(%r{site_menu})
|
16
|
+
end
|
17
|
+
|
20
18
|
end
|
@@ -12,7 +12,8 @@ class Page < ActiveRecord::Base
|
|
12
12
|
has_many :parts, :class_name => "PagePart", :order => "position ASC"
|
13
13
|
accepts_nested_attributes_for :parts, :allow_destroy => true
|
14
14
|
|
15
|
-
acts_as_indexed :fields => [:title, :meta_keywords, :meta_description, :custom_title, :browser_title, :all_page_part_content]
|
15
|
+
acts_as_indexed :fields => [:title, :meta_keywords, :meta_description, :custom_title, :browser_title, :all_page_part_content],
|
16
|
+
:index_file => [RAILS_ROOT,"tmp","index"]
|
16
17
|
|
17
18
|
before_destroy :deletable?
|
18
19
|
|
@@ -26,7 +27,7 @@ class Page < ActiveRecord::Base
|
|
26
27
|
if self.deletable?
|
27
28
|
super
|
28
29
|
else
|
29
|
-
puts "This page is not deletable. Please use .destroy! if you really want it gone or first"
|
30
|
+
puts "This page is not deletable. Please use .destroy! if you really want it gone or first:"
|
30
31
|
puts "unset .link_url" unless self.link_url.blank?
|
31
32
|
puts "unset .menu_match" unless self.menu_match.blank?
|
32
33
|
puts "set .deletable to true" unless self.deletable
|
@@ -105,13 +106,7 @@ class Page < ActiveRecord::Base
|
|
105
106
|
|
106
107
|
# used for search only
|
107
108
|
def all_page_part_content
|
108
|
-
|
109
|
-
|
110
|
-
self.parts.each do |part|
|
111
|
-
content << " #{part.body}"
|
112
|
-
end
|
113
|
-
|
114
|
-
content
|
109
|
+
self.parts.collect {|p| p.body}.join(" ")
|
115
110
|
end
|
116
111
|
|
117
112
|
def self.per_page(dialog = false)
|
@@ -3,15 +3,8 @@ class PagePart < ActiveRecord::Base
|
|
3
3
|
belongs_to :page
|
4
4
|
|
5
5
|
validates_presence_of :title
|
6
|
+
alias_attribute :content, :body
|
6
7
|
|
7
8
|
has_friendly_id :title, :use_slug => true, :strip_diacritics => true
|
8
9
|
|
9
|
-
def content
|
10
|
-
self.body
|
11
|
-
end
|
12
|
-
|
13
|
-
def content=(value)
|
14
|
-
self.body = value
|
15
|
-
end
|
16
|
-
|
17
10
|
end
|
@@ -16,7 +16,7 @@
|
|
16
16
|
</div>
|
17
17
|
<div id='records' class='tree'>
|
18
18
|
<% if searching? %>
|
19
|
-
<%
|
19
|
+
<% unless @pages.empty? %>
|
20
20
|
<h2>Search Results for "<%= params[:search] %>"</h2>
|
21
21
|
<ul id='sortable_list'>
|
22
22
|
<%= render :partial => "sortable_list" %>
|
@@ -27,7 +27,7 @@
|
|
27
27
|
</p>
|
28
28
|
<% end %>
|
29
29
|
<% else %>
|
30
|
-
<%
|
30
|
+
<% unless @pages.empty? %>
|
31
31
|
<ul id='sortable_list'>
|
32
32
|
<%= render :partial => "sortable_list" %>
|
33
33
|
</ul>
|
@@ -12,7 +12,13 @@
|
|
12
12
|
google.load("jquery", "1.3");
|
13
13
|
</script>
|
14
14
|
<% end %>
|
15
|
-
|
15
|
+
<% if !using_google_libs or local_request? %>
|
16
|
+
<% if use_caching %>
|
17
|
+
<%= javascript_include_tag 'prototype', 'scriptaculous', 'builder', 'effects', 'dragdrop', 'controls', 'slider', 'jquery', :cache => "cache/libraries" %>
|
18
|
+
<% else %>
|
19
|
+
<%= javascript_include_tag 'prototype', 'scriptaculous', 'jquery' %>
|
20
|
+
<% end %>
|
21
|
+
<% end %>
|
16
22
|
<script type='text/javascript'>jQuery.noConflict();</script>
|
17
23
|
<%= javascript_include_tag 'refinery/prototype.enhancements.js', 'fastinit', 'refinery/tooltips', 'livepipe', 'tabs', 'thickbox', "wymeditor/jquery.refinery.wymeditor.js", 'refinery/boot_wym', 'refinery/admin', :cache => (use_caching ? "cache/admin" : false) %>
|
18
24
|
<%= "<script type='text/javascript' src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>" if RefinerySetting.find_or_set(:show_firebug_lite, false) == true -%>
|
@@ -7,7 +7,7 @@
|
|
7
7
|
extra_body_content_classes << "no_left" if body_content_left.blank?
|
8
8
|
extra_body_content_classes << "no_right" if body_content_right.blank?
|
9
9
|
-%>
|
10
|
-
<%= render :partial => "/shared/submenu" if (show_submenu ||= true) and RefinerySetting.find_or_set(:show_submenu_on_content_pages, true) %>
|
10
|
+
<%= render :partial => "/shared/submenu" if !admin? and (show_submenu ||= true) and RefinerySetting.find_or_set(:show_submenu_on_content_pages, true) %>
|
11
11
|
<div id='body_content' class='clearfix<%= " #{extra_body_content_classes.join(" ")}" unless extra_body_content_classes.empty? %>'>
|
12
12
|
<% unless body_content_page_title.blank? and !(show_empty_sections ||= false) -%>
|
13
13
|
<h1 id='body_content_page_title'>
|
@@ -1,16 +1,18 @@
|
|
1
1
|
<%
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
cache(:action_suffix => "site_menu") do
|
3
|
+
# cache important lookups
|
4
|
+
hide_children = RefinerySetting.find_or_set(:menu_hide_children, false)
|
5
|
+
siblings = nil # all pages in the top level menu have the same siblings, basically.
|
5
6
|
%>
|
6
|
-
<ul id='<%= dom_id ||= "menu" %>' class='menu clearfix'>
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
</ul>
|
7
|
+
<ul id='<%= dom_id ||= "menu" %>' class='menu clearfix'>
|
8
|
+
<% @menu_pages.each do |page| -%>
|
9
|
+
<%= render :partial => '/shared/menu_branch', :locals => {
|
10
|
+
:page => page,
|
11
|
+
:position => @menu_pages.index(page),
|
12
|
+
:root => true,
|
13
|
+
:siblings => ((siblings ||= page.shown_siblings) - [self]),
|
14
|
+
:hide_children => hide_children
|
15
|
+
} -%>
|
16
|
+
<% end -%>
|
17
|
+
</ul>
|
18
|
+
<% end %>
|
@@ -1,10 +1,10 @@
|
|
1
1
|
<% flash.each do |key, value| %>
|
2
2
|
<div id="flash" class="flash_<%= key %>" style='display: none;' >
|
3
|
-
<%= value %> (<%= link_to "close", "", {:id => "
|
3
|
+
<%= value %> (<%= link_to "close", "", {:id => "flash_close"} %>)
|
4
4
|
<script type="text/javascript">
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
jQuery('#flash_close').click(function(e) {
|
6
|
+
jQuery('#flash').fadeOut({duration: 330});
|
7
|
+
e.preventDefault();
|
8
8
|
});
|
9
9
|
</script>
|
10
10
|
</div>
|
@@ -18,8 +18,16 @@ module Crud
|
|
18
18
|
module ClassMethods
|
19
19
|
|
20
20
|
def crudify(model_name, new_options = {})
|
21
|
-
options = {
|
22
|
-
|
21
|
+
options = {
|
22
|
+
:title_attribute => "title",
|
23
|
+
:order => 'position ASC',
|
24
|
+
:conditions => '',
|
25
|
+
:sortable => true,
|
26
|
+
:searchable => true,
|
27
|
+
:include => [],
|
28
|
+
:paging => true,
|
29
|
+
:search_conditions => ''
|
30
|
+
}.merge!(new_options)
|
23
31
|
|
24
32
|
singular_name = model_name.to_s
|
25
33
|
class_name = singular_name.camelize
|
@@ -27,7 +35,6 @@ module Crud
|
|
27
35
|
|
28
36
|
module_eval %(
|
29
37
|
before_filter :find_#{singular_name}, :only => [:update, :destroy, :edit]
|
30
|
-
before_filter :find_all_#{plural_name}, :only => :reorder
|
31
38
|
|
32
39
|
def new
|
33
40
|
@#{singular_name} = #{class_name}.new
|
@@ -98,43 +105,88 @@ module Crud
|
|
98
105
|
end
|
99
106
|
|
100
107
|
def find_#{singular_name}
|
101
|
-
@#{singular_name} = #{class_name}.find(params[:id])
|
108
|
+
@#{singular_name} = #{class_name}.find(params[:id], :include => %w(#{options[:include].join(' ')}))
|
102
109
|
end
|
103
110
|
|
104
111
|
def find_all_#{plural_name}
|
105
|
-
@#{plural_name} = #{class_name}.find
|
112
|
+
@#{plural_name} = #{class_name}.find :all,
|
113
|
+
:order => "#{options[:order]}",
|
114
|
+
:conditions => "#{options[:conditions]}",
|
115
|
+
:include => %w(#{options[:include].join(' ')})
|
116
|
+
end
|
117
|
+
|
118
|
+
def paginate_all_#{plural_name}
|
119
|
+
@#{plural_name} = #{class_name}.paginate :page => params[:page],
|
120
|
+
:order => "#{options[:order]}",
|
121
|
+
:conditions => "#{options[:conditions]}",
|
122
|
+
:include => %w(#{options[:include].join(' ')})
|
123
|
+
end
|
124
|
+
|
125
|
+
def search_all_#{plural_name}
|
126
|
+
@#{plural_name} = #{class_name}.find_with_index params[:search],
|
127
|
+
:order => "#{options[:order]}",
|
128
|
+
:conditions => "#{options[:search_conditions]}",
|
129
|
+
:include => %w(#{options[:include].join(' ')})
|
130
|
+
end
|
131
|
+
|
132
|
+
def search_and_paginate_all_#{plural_name}
|
133
|
+
@#{plural_name} = #{class_name}.paginate_search params[:search],
|
134
|
+
:page => params[:page],
|
135
|
+
:order => "#{options[:order]}",
|
136
|
+
:conditions => "#{options[:search_conditions]}",
|
137
|
+
:include => %w(#{options[:include].join(' ')})
|
106
138
|
end
|
107
139
|
|
108
|
-
protected :find_#{singular_name}, :find_all_#{plural_name}
|
140
|
+
protected :find_#{singular_name}, :find_all_#{plural_name}, :paginate_all_#{plural_name}, :search_all_#{plural_name}, :search_and_paginate_all_#{plural_name}
|
141
|
+
|
109
142
|
)
|
110
143
|
|
111
144
|
if options[:searchable]
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
@#{plural_name} = #{class_name}.paginate :page => params[:page],
|
121
|
-
:order => "#{options[:order]}",
|
122
|
-
:conditions => "#{options[:conditions]}"
|
145
|
+
if options[:paging]
|
146
|
+
module_eval %(
|
147
|
+
def index
|
148
|
+
if searching?
|
149
|
+
search_and_paginate_all_#{plural_name}
|
150
|
+
else
|
151
|
+
paginate_all_#{plural_name}
|
152
|
+
end
|
123
153
|
end
|
124
|
-
|
125
|
-
|
154
|
+
)
|
155
|
+
else
|
156
|
+
module_eval %(
|
157
|
+
def index
|
158
|
+
if searching?
|
159
|
+
search_all_#{plural_name}
|
160
|
+
else
|
161
|
+
find_all_#{plural_name}
|
162
|
+
end
|
163
|
+
end
|
164
|
+
)
|
165
|
+
end
|
166
|
+
|
126
167
|
else
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
168
|
+
if options[:paging]
|
169
|
+
module_eval %(
|
170
|
+
def index
|
171
|
+
paginate_all_#{plural_name}
|
172
|
+
end
|
173
|
+
)
|
174
|
+
else
|
175
|
+
module_eval %(
|
176
|
+
def index
|
177
|
+
find_all_#{plural_name}
|
178
|
+
end
|
179
|
+
)
|
180
|
+
end
|
181
|
+
|
134
182
|
end
|
135
183
|
|
136
184
|
if options[:sortable]
|
137
185
|
module_eval %(
|
186
|
+
def reorder
|
187
|
+
find_all_#{plural_name}
|
188
|
+
end
|
189
|
+
|
138
190
|
def update_positions
|
139
191
|
unless params[:tree] == "true"
|
140
192
|
params[:sortable_list].each do |i|
|