refinerycms 0.9.5.30 → 0.9.5.31

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. data/.yardopts +15 -5
  2. data/Rakefile +1 -1
  3. data/VERSION +1 -1
  4. data/bin/refinery +9 -9
  5. data/bin/refinery-update-core +8 -5
  6. data/config/environment.rb +1 -1
  7. data/config/routes.rb +1 -0
  8. data/contributors.md +18 -0
  9. data/db/migrate/20100127004649_add_reset_code_to_users.rb +9 -0
  10. data/db/schema.rb +2 -1
  11. data/db/seeds.rb +11 -1
  12. data/{LICENSE → license.md} +3 -3
  13. data/public/javascripts/admin.js +5 -0
  14. data/public/javascripts/refinery/boot_wym.js +1 -1
  15. data/public/stylesheets/refinery/refinery.css +7 -0
  16. data/readme.md +161 -0
  17. data/themes/demolicious.zip +0 -0
  18. data/themes/hemingway.zip +0 -0
  19. data/vendor/plugins/authentication/app/controllers/admin/users_controller.rb +0 -27
  20. data/vendor/plugins/authentication/app/controllers/sessions_controller.rb +3 -0
  21. data/vendor/plugins/authentication/app/controllers/users_controller.rb +36 -21
  22. data/vendor/plugins/authentication/app/models/user.rb +40 -41
  23. data/vendor/plugins/authentication/app/models/user_mailer.rb +5 -12
  24. data/vendor/plugins/authentication/app/views/sessions/new.html.erb +3 -0
  25. data/vendor/plugins/authentication/app/views/user_mailer/reset_notification.html.erb +6 -0
  26. data/vendor/plugins/authentication/app/views/users/forgot.html.erb +13 -0
  27. data/vendor/plugins/authentication/app/views/users/reset.html.erb +18 -0
  28. data/vendor/plugins/authentication/authentication.md +7 -0
  29. data/vendor/plugins/authentication/config/routes.rb +6 -1
  30. data/vendor/plugins/dashboard/dashboard.md +22 -0
  31. data/vendor/plugins/images/images.md +46 -0
  32. data/vendor/plugins/inquiries/app/controllers/inquiries_controller.rb +0 -8
  33. data/vendor/plugins/inquiries/app/views/admin/inquiries/show.html.erb +3 -3
  34. data/vendor/plugins/inquiries/inquiries.md +31 -0
  35. data/vendor/plugins/news/app/controllers/news_items_controller.rb +9 -19
  36. data/vendor/plugins/news/app/views/news_items/index.html.erb +1 -1
  37. data/vendor/plugins/news/app/views/news_items/show.html.erb +13 -18
  38. data/vendor/plugins/news/news.md +20 -0
  39. data/vendor/plugins/pages/app/controllers/pages_controller.rb +2 -12
  40. data/vendor/plugins/pages/app/models/page.rb +5 -5
  41. data/vendor/plugins/pages/app/presenters/page_presenter.rb +3 -0
  42. data/vendor/plugins/pages/pages.md +141 -0
  43. data/vendor/plugins/pages/rails/init.rb +1 -1
  44. data/vendor/plugins/refinery/app/views/admin/_head.html.erb +1 -0
  45. data/vendor/plugins/refinery/app/views/layouts/application.html.erb +2 -15
  46. data/vendor/plugins/refinery/app/views/shared/_head.html.erb +13 -0
  47. data/vendor/plugins/refinery/app/views/shared/_header.html.erb +1 -1
  48. data/vendor/plugins/refinery/app/views/shared/_menu.html.erb +4 -15
  49. data/vendor/plugins/refinery/app/views/shared/_menu_branch.html.erb +20 -25
  50. data/vendor/plugins/refinery/app/views/shared/_submenu.html.erb +5 -4
  51. data/vendor/plugins/refinery/crud.md +197 -0
  52. data/vendor/plugins/refinery/lib/generators/refinery/templates/public_controller.rb +6 -1
  53. data/vendor/plugins/refinery/lib/refinery/application_controller.rb +18 -5
  54. data/vendor/plugins/refinery/lib/refinery/application_helper.rb +31 -28
  55. data/vendor/plugins/refinery/lib/refinery/base_presenter.rb +27 -0
  56. data/vendor/plugins/refinery/lib/refinery/initializer.rb +7 -3
  57. data/vendor/plugins/refinery/lib/tasks/doc.rake +4 -4
  58. data/vendor/plugins/refinery/plugins.md +194 -0
  59. data/vendor/plugins/refinery/rails/init.rb +5 -0
  60. data/vendor/plugins/refinery_settings/settings.md +5 -0
  61. data/vendor/plugins/resources/resources.md +9 -0
  62. data/vendor/plugins/themes/app/controllers/themes_controller.rb +12 -15
  63. data/vendor/plugins/themes/app/models/theme.rb +8 -14
  64. data/vendor/plugins/themes/config/routes.rb +3 -3
  65. data/vendor/plugins/themes/themes.md +133 -0
  66. metadata +29 -38
  67. data/CONTRIBUTORS +0 -11
  68. data/README.rdoc +0 -78
  69. data/themes/demolicious/LICENSE +0 -21
  70. data/themes/demolicious/README +0 -1
  71. data/themes/demolicious/images/footer_background.png +0 -0
  72. data/themes/demolicious/images/header_background.png +0 -0
  73. data/themes/demolicious/preview.png +0 -0
  74. data/themes/demolicious/stylesheets/application.css +0 -94
  75. data/themes/demolicious/stylesheets/formatting.css +0 -36
  76. data/themes/demolicious/stylesheets/home.css +0 -11
  77. data/themes/demolicious/stylesheets/ie6.css +0 -0
  78. data/themes/demolicious/stylesheets/ie7.css +0 -0
  79. data/themes/demolicious/views/layouts/application.html.erb +0 -33
  80. data/themes/demolicious/views/pages/home.html.erb +0 -1
  81. data/themes/demolicious/views/pages/show.html.erb +0 -1
  82. data/themes/hemingway/LICENSE +0 -7
  83. data/themes/hemingway/README +0 -3
  84. data/themes/hemingway/images/archives.gif +0 -0
  85. data/themes/hemingway/images/footer_black.gif +0 -0
  86. data/themes/hemingway/images/kyle-header.jpg +0 -0
  87. data/themes/hemingway/images/readon_black.gif +0 -0
  88. data/themes/hemingway/images/search.gif +0 -0
  89. data/themes/hemingway/images/spinner.gif +0 -0
  90. data/themes/hemingway/images/trackback_pingback.gif +0 -0
  91. data/themes/hemingway/preview.png +0 -0
  92. data/themes/hemingway/stylesheets/application.css +0 -713
  93. data/themes/hemingway/views/layouts/application.html.erb +0 -64
  94. data/themes/hemingway/views/shared/content_page.html.erb +0 -0
  95. data/vendor/plugins/authentication/app/models/user_observer.rb +0 -11
  96. data/vendor/plugins/authentication/app/views/user_mailer/activation.html.erb +0 -3
  97. data/vendor/plugins/authentication/app/views/user_mailer/signup_notification.html.erb +0 -8
  98. data/vendor/plugins/themes/themes.rdoc +0 -131
@@ -0,0 +1,31 @@
1
+ # Inquiries
2
+
3
+ ![Refinery Inquiries](http://refinerycms.com/system/images/0000/0626/inquiries.png)
4
+
5
+ ## About
6
+
7
+ Refinery gives you a simple contact form that notifies you and the customer when an inquiry is made.
8
+
9
+ In summary you can:
10
+
11
+ * Collect and manage inquiries
12
+ * Specify who is notified when a new inquiry comes in
13
+ * Customise an auto responder email that is sent to the person making the inquiry
14
+
15
+ When inquiries come in, you and the customer are notified. The inquiry will now show up as an "open" inquiry. The idea is to deal with the inquiry and then "close" it so you know it's been sorted.
16
+
17
+ == How do I get notified?
18
+
19
+ Go into your inquiries section and click on "Update who gets notified"
20
+
21
+ == How do I edit the auto confirmation email
22
+
23
+ Go into your inquiries section and click on "Edit confirmation email"
24
+
25
+ == But I don't want a contact form how do I kill it?
26
+
27
+ Your contact form loads because you have a page in your site that is told to not just render a normal page, but load the contact form instead.
28
+
29
+ By default this page is called "Contact Us". Go to your "Pages" tab and click the edit icon on "Contact Us". Now click on "Hide/Show Advanced Options" and you'll see that a "custom URL" is set to ``/inquiries/new``. Simply change this to nothing, or delete the contact us page.
30
+
31
+ You might also want to remove the Inquiries plugin from your backend view. To do that, you go to the "Users" tab edit your user, uncheck "Inquiries" from the list of plugins you can access.
@@ -1,30 +1,20 @@
1
1
  class NewsItemsController < ApplicationController
2
2
 
3
- before_filter :get_latest_posts
4
- before_filter :load_page, :only => [:index, :show]
5
-
6
- def index
7
- respond_to do |wants|
8
- wants.html
9
- end
10
- end
11
-
12
- def show
13
- @news_item = NewsItem.find(params[:id], :conditions => ["publish_date < ?", Time.now])
14
-
15
- respond_to do |wants|
16
- wants.html
17
- end
18
- end
3
+ before_filter :find_latest_news_items, :find_page
4
+ before_filter :find_news_item, :only => [:show]
19
5
 
20
6
  protected
21
7
 
22
- def get_latest_posts
8
+ def find_latest_news_items
23
9
  @news_items = NewsItem.latest
24
10
  end
25
11
 
26
- def load_page
12
+ def find_news_item
13
+ @news_item = NewsItem.find(params[:id], :conditions => ["publish_date < ?", Time.now])
14
+ end
15
+
16
+ def find_page
27
17
  @page = Page.find_by_link_url("/news", :include => [:parts, :slugs])
28
18
  end
29
19
 
30
- end
20
+ end
@@ -1,7 +1,7 @@
1
1
  <% content_for :body_content_left do %>
2
2
  <%= @page[:body] %>
3
3
 
4
- <% if @news_items.size > 0 %>
4
+ <% unless @news_items.empty? %>
5
5
  <% @news_items.each do |item| %>
6
6
  <h3><%= link_to item.title, news_item_url(item) %></h3>
7
7
  <p>
@@ -1,18 +1,13 @@
1
- <% content_for :title, "#{@news_item.title} - " -%>
2
- <div id='body_content' class='clearfix'>
3
- <div id='body_content_left' class='clearfix'>
4
- <h1>
5
- <%= @news_item.title %>
6
- </h1>
7
- <p>
8
- <small>Published <%= @news_item.publish_date.strftime("%A %d of %B, %Y") %></small>
9
- </p>
10
- <%= @news_item.body %>
11
- <p>
12
- <%= link_to "Back to all news", news_items_url %>
13
- </p>
14
- </div>
15
- <div id='body_content_right' class='clearfix'>
16
- <%= render :partial => 'recent_posts' %>
17
- </div>
18
- </div>
1
+ <% content_for :body_content_title, "<h1>#{@news_item.title}</h1>" %>
2
+ <% content_for :body_content_left do %>
3
+ <p>
4
+ <small>Published <%= @news_item.publish_date.strftime("%A %d of %B, %Y") %></small>
5
+ </p>
6
+ <%= @news_item.body %>
7
+ <p>
8
+ <%= link_to "Back to all news", news_items_url %>
9
+ </p>
10
+ <% end %>
11
+ <% content_for :body_content_right, render(:partial => 'recent_posts') %>
12
+
13
+ <%= render :partial => "/shared/content_page" %>
@@ -0,0 +1,20 @@
1
+ # News
2
+
3
+ ![Refinery News](http://refinerycms.com/system/images/0000/0646/news.png)
4
+
5
+ ## About
6
+
7
+ Refinery's news plugin allows you to post updates to the news section of your website.
8
+
9
+ Key features:
10
+
11
+ * Default news page shows a summary of recent news posts
12
+ * Detail view shows the full post and also linked to recent news on the "side bar"
13
+
14
+ ## But I don't want a news section, how do I kill it?
15
+
16
+ Your news section loads because you have a page in your site that is told to not just render a normal page, but load the news section instead.
17
+
18
+ By default this page is called "News". Go to your "Pages" tab and click the edit icon on "News". Now click on "Hide/Show Advanced Options" and you'll see that a "custom URL" is set to ``/news``. Simply change this to nothing, or delete the "News" page.
19
+
20
+ You might also want to remove the News plugin from your backend view. To do that, you go to the "Users" tab edit your user, uncheck "News" from the list of plugins you can access.
@@ -2,13 +2,7 @@ class PagesController < ApplicationController
2
2
 
3
3
  def home
4
4
  @page = Page.find_by_link_url("/", :include => [:parts, :slugs])
5
- if @page.nil?
6
- error_404
7
- else
8
- respond_to do |wants|
9
- wants.html
10
- end
11
- end
5
+ error_404 unless @page.present?
12
6
  end
13
7
 
14
8
  def show
@@ -18,11 +12,7 @@ class PagesController < ApplicationController
18
12
  # if the admin wants this to be a "placeholder" page which goes to its first child, go to that instead.
19
13
  if @page.skip_to_first_child
20
14
  first_live_child = @page.children.find_by_draft(false, :order => "position ASC")
21
- redirect_to first_live_child.url unless first_live_child.nil?
22
- else
23
- respond_to do |wants|
24
- wants.html
25
- end
15
+ redirect_to first_live_child.url if first_live_child.present?
26
16
  end
27
17
  else
28
18
  error_404
@@ -13,7 +13,7 @@ class Page < ActiveRecord::Base
13
13
  accepts_nested_attributes_for :parts, :allow_destroy => true
14
14
 
15
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
+ :index_file => %W(#{RAILS_ROOT} tmp index)
17
17
 
18
18
  before_destroy :deletable?
19
19
 
@@ -28,8 +28,8 @@ class Page < ActiveRecord::Base
28
28
  super
29
29
  else
30
30
  puts "This page is not deletable. Please use .destroy! if you really want it gone or first:"
31
- puts "unset .link_url" unless self.link_url.blank?
32
- puts "unset .menu_match" unless self.menu_match.blank?
31
+ puts "unset .link_url" if self.link_url.present?
32
+ puts "unset .menu_match" if self.menu_match.present?
33
33
  puts "set .deletable to true" unless self.deletable
34
34
  return false
35
35
  end
@@ -57,9 +57,9 @@ class Page < ActiveRecord::Base
57
57
  end
58
58
 
59
59
  def url
60
- if not (self.link_url.blank?)
60
+ if self.link_url.present?
61
61
  self.link_url
62
- elsif not self.to_param.blank?
62
+ elsif self.to_param.present?
63
63
  "/pages/#{self.to_param}"
64
64
  end
65
65
  end
@@ -0,0 +1,3 @@
1
+ class PagePresenter < Refinery::BasePresenter
2
+ #delegate DEFAULT_FIELDS.keys :to => :model
3
+ end
@@ -0,0 +1,141 @@
1
+ # Pages
2
+
3
+ ![Refinery Pages](http://refinerycms.com/system/images/0000/0656/pages.png)
4
+
5
+ ## About
6
+
7
+ One core part of is Pages. Plugins such as news and inquiries hook to pages. The menu is rendered based off the structure of your pages.
8
+
9
+ Pages have one key thing about them that is unique - page parts.
10
+
11
+ ## Page Parts
12
+
13
+ ![Refinery Page Parts](http://refinerycms.com/system/images/0000/0586/editing-page.png)
14
+
15
+ ### What are they
16
+
17
+ Think of a page part is a single piece of content on your page. At [Resolve Digital](http://www.resolvedigital.co.nz) we often simply use ``body`` and ``side_body``. One is for the main content and one is for the content which goes on a side bit of the page to display other information.
18
+
19
+ ### Default Page Parts
20
+
21
+ You can change what the default page parts are called or add more by editing the "Default Page Parts" setting. This is a serialize array of names. The default looks like this
22
+
23
+ ---
24
+ - body
25
+ - side_body
26
+
27
+ Add more to this setting if you want more default page parts.
28
+
29
+ ### Adding Page Parts for Specify Pages
30
+
31
+ You can add extra page parts to your pages by setting the "New Page Parts" to ``true`` and editing the page you want to add a part to and clicked the little "+" icon.
32
+
33
+ Note in the user-facing front end we call them "content sections" not "page parts".
34
+
35
+ ## Page Options
36
+
37
+ ### Draft/Published
38
+
39
+ You can have draft and published pages. This is controlled by checking and unchecking the "Save as Draft" field on the page form, when editing the page.
40
+
41
+ ### Custom Title
42
+
43
+ There are three options for how the page title will be rendered on the front end.
44
+
45
+ * ``None``: will just default to the page title
46
+ * ``Text``: allows you to have a different name for the page in the backend to the front end (sometimes good for SEO)
47
+ * ``Image``: If you're designer is using a custom non-standard web font, this is ideal. Bang the image of your title right in there (_we don't recommend this though!_)
48
+
49
+ ### Show in menu
50
+
51
+ You can hide a page from the navigation if you like by unchecking "show in menu"
52
+
53
+ ### Custom URL
54
+
55
+ This allows you to make your page not link to a normal page but make it show something else. This could be a donation link to a completely different site for example. Or as Refinery uses it, you might want to link to another plugin.
56
+
57
+ The "contact us" page for example has a Custom URL of ``/inquiries/new`` because we want it to load the inquiries form from the inquiries plugin instead.
58
+
59
+ ### WYMEditor (the visual editor)
60
+
61
+ Refinery is backed by [WYMEditor](http://www.wymeditor.org/)
62
+
63
+ It's a standards compliant editor that we've trimmed to only have what we feel is absolutely necessary. When you're editing the content is a page part you're using [WYMEditor](http://www.wymeditor.org/).
64
+
65
+ You can also switch to "source" view and edit XHTML manually.
66
+
67
+ ### Custom selectable styles in WYMEditor
68
+
69
+ ![Refinery Page Editor Styles](http://refinerycms.com/system/images/0000/0596/editing-page-style.png)
70
+
71
+ Some sites require a little more than just your standard bold and heading controls. This is where the "css" style drop down comes in hand.
72
+
73
+ It allows your customers to select a style you define. You need to edut/create a CSS file called ``theme.css``. You could have this in one of two places
74
+
75
+ 1. ``/public/stylesheets/themes.css``
76
+ 2. ``/themes/your_theme_name/stylesheets/themes.css``
77
+
78
+ Inside that file you define your styles like this
79
+
80
+ .category-name-style-name {
81
+ // apply your CSS rules here
82
+ }
83
+
84
+ For example if I wanted to add a style that allowed my users to highlight their text a light yellow colour I would put this
85
+
86
+ .text-highlight-yellow {
87
+ background: LightYellow;
88
+ }
89
+
90
+ Now edit ``public/javascripts/admin.js``. We're going to need to tell WYMEditor that we have some new styles it should load when the editor is loaded.
91
+
92
+ Currently your ``admin.js`` file will have something like this
93
+
94
+ var wymeditorClassesItems = [
95
+    {name: 'text-align', rules:['left', 'center', 'right', 'justify'], join: '-'}
96
+ ,  {name: 'image-align', rules:['left', 'right'], join: '-'}
97
+ ,  {name: 'font-size', rules:['small','normal','large'], join: '-'}
98
+ ]
99
+
100
+ Let's just breakdown a single WYMeditor class line and understand it:
101
+
102
+ {name: 'font-size', rules:['small','normal','large'], join: '-'}
103
+
104
+ ``font-size`` is the name of the category and ``small``, ``normal``, ``large`` are the actual styles. So for this to match up with the styles in my theme.css file the class name has to be:
105
+
106
+ .font-size-small { // CSS rules here }
107
+ .font-size-normal { // CSS rules here }
108
+ .font-size-large { // CSS rules here }
109
+
110
+ So going back to our text highlighting above we make the new style show up in the editor by changing our ``admin.js`` file to:
111
+
112
+ var wymeditorClassesItems = [
113
+    {name: 'text-align', rules:['left', 'center', 'right', 'justify'], join: '-'}
114
+ ,  {name: 'image-align', rules:['left', 'right'], join: '-'}
115
+ ,  {name: 'font-size', rules:['small','normal','large'], join: '-'}
116
+ ,  {name: 'text-highlight', rules:['yellow'], join: '-'}
117
+ ]
118
+
119
+ ### Dialogs that show from WYMEditor
120
+
121
+ ![Refinery Page Editor Link Dialog](http://refinerycms.com/system/images/0000/0636/link-dialog.png)
122
+
123
+ ## Page Link dialog
124
+
125
+ The link dialog lets you link in several different ways
126
+
127
+ * To an internal page
128
+ * To an external page
129
+ * To an email address
130
+ * To a resource you've uploaded in the Resources tab.
131
+
132
+ ## Insert Image dialog
133
+
134
+ Simply lets you select from an existing image found in the Images tab or upload a new one right within the dialog.
135
+
136
+ ## Refinery Default Pages
137
+
138
+ Some pages you have to keep in order for Refinery to fully function.
139
+
140
+ * Page not found - the default 404 page, it's hidden from the navigation
141
+ * Down for maintenance - renders when you're site is being updated.
@@ -4,4 +4,4 @@ Refinery::Plugin.register do |plugin|
4
4
  plugin.version = 1.0
5
5
  plugin.menu_match = /admin\/((pages)|(page_dialogs)|(page_parts))$/
6
6
  plugin.activity = {:class => Page, :url_prefix => "edit_", :title => "title", :created_image => "page_add.png", :updated_image => "page_edit.png"}
7
- end
7
+ end
@@ -20,6 +20,7 @@
20
20
  <% end %>
21
21
  <% end %>
22
22
  <script type='text/javascript'>jQuery.noConflict();</script>
23
+ <%= javascript_include_tag 'admin' %>
23
24
  <%= 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) %>
24
25
  <%= "<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 -%>
25
26
  <%= "<script type='text/javascript'>jQuery(document).ready(function(){ jQuery('#flash').fadeIn(550); });</script>" unless flash.empty? -%>
@@ -1,21 +1,8 @@
1
- <% setup # sets up any meta tags and page title -%>
2
1
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
2
  <html xmlns="http://www.w3.org/1999/xhtml">
4
- <head>
5
- <title>
6
- <%= yield :title %> - <%= RefinerySetting.find_or_set(:site_name, "Company Name") %>
7
- </title>
8
- <%= render :partial => 'shared/google_analytics' unless local_request? %>
9
- <%= stylesheet_link_tag 'application' %>
10
- <%= stylesheet_link_tag 'formatting', 'theme' %>
11
- <%= stylesheet_link_tag 'home' if @page.home? %>
12
- <!--[if IE 7]><%= stylesheet_link_tag 'ie7' %><![endif]-->
13
- <link rel="shortcut icon" href="/favicon.ico" />
14
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
15
- <%= yield :head %>
16
- </head>
3
+ <%= render :partial => "/shared/head" %>
17
4
  <body>
18
- <%= render :partial => "/shared/ie6check" if request.env['HTTP_USER_AGENT'] =~ /MSIE/ %>
5
+ <%= render :partial => "/shared/ie6check" if request.env['HTTP_USER_AGENT'] =~ /MSIE/ -%>
19
6
  <div id='page_container'>
20
7
  <div id='page' class='clearfix'>
21
8
  <div id='header' class='clearfix'>
@@ -0,0 +1,13 @@
1
+ <% theme ||= false -%>
2
+ <head>
3
+ <title><%= browser_title(yield(:title)) %></title>
4
+ <%= render :partial => 'shared/google_analytics' unless local_request? %>
5
+ <%= stylesheet_link_tag "#{'theme/' if theme}application", "#{'theme/' if theme}formatting", "theme" %>
6
+ <%= stylesheet_link_tag "#{'theme/' if theme}home" if home_page? %>
7
+ <%= "<!--[if IE 7]>#{stylesheet_link_tag 'ie7'}<![endif]-->" if request.env['HTTP_USER_AGENT'] =~ /MSIE/ -%>
8
+ <link rel="shortcut icon" href="/favicon.ico" />
9
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
10
+ <%= "<meta name=\"keywords\" content=\"#{@meta.meta_keywords}\" />" if @meta.meta_keywords.present? %>
11
+ <%= "<meta name=\"description\" content=\"#{@meta.meta_description}\" />" if @meta.meta_description.present? -%>
12
+ <%= yield :head %>
13
+ </head>
@@ -1,4 +1,4 @@
1
1
  <div id='header_content'>
2
2
  <h1><%= link_to RefinerySetting[:site_name], root_url %></h1>
3
3
  <%= render :partial => "/shared/menu" %>
4
- </div>
4
+ </div>
@@ -1,18 +1,7 @@
1
- <%
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.
6
- %>
1
+ <% cache(:action_suffix => "site_menu") do %>
7
2
  <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 -%>
3
+ <%= render :partial => "/shared/menu_branch", :collection => @menu_pages, :locals => {
4
+ :hide_children => RefinerySetting.find_or_set(:menu_hide_children, false)
5
+ } -%>
17
6
  </ul>
18
7
  <% end %>
@@ -1,28 +1,23 @@
1
- <%# this is pretty bad code - need to rethink this one -%>
2
1
  <%
3
2
  css = []
4
- css << "selected" if selected_page?(page) or descendant_page_selected?(page)
5
- css << "first" if position == 0
6
- css << "last" if position == (siblings ||= page.shown_siblings).size
7
- domid = "#{page.title.gsub(" ", "_").downcase}_item" unless page.title.blank?
8
-
9
- if page.in_menu?
3
+ css << "selected" if selected_page?(menu_branch) or descendant_page_selected?(menu_branch)
4
+ css << "first" if menu_branch_counter == 0
5
+ css << "last" if menu_branch_counter == menu_branch.shown_siblings.size
6
+ domid = "item_#{menu_branch_counter}" unless menu_branch.parent_id.present? or menu_branch.title.blank?
10
7
  -%>
11
- <li<%= " class='#{css.join(' ')}'" unless css.blank? -%><%= " id='#{domid}'" unless domid.blank? -%>>
12
- <%= link_to page.title, page.url %>
13
- <% unless hide_children or (children = page.children.collect{|c| c if c.in_menu? }.compact).empty? %>
14
- <ul class='clearfix'>
15
- <% children.each do |child| -%>
16
- <% shown_siblings = child.shown_siblings %>
17
- <%= render :partial => '/shared/menu_branch', :locals => {
18
- :page => child,
19
- :position => page.children.index(child),
20
- :root => false,
21
- :siblings => shown_siblings,
22
- :hide_children => hide_children
23
- } -%>
24
- <% end %>
25
- </ul>
26
- <% end %>
27
- </li>
28
- <% end -%>
8
+ <% if menu_branch.in_menu? %>
9
+ <li<%= " class='#{css.join(' ')}'" if css.present? -%><%= " id='#{domid}'" if domid.present? -%>>
10
+ <%= link_to menu_branch.title, menu_branch.url %>
11
+ <%
12
+ unless hide_children or
13
+ menu_branch.parent_id.present? or
14
+ (children = menu_branch.children.collect{|c| c if c.in_menu? }.compact).empty?
15
+ -%>
16
+ <ul class='clearfix'>
17
+ <%= render :partial => "/shared/menu_branch",
18
+ :collection => children,
19
+ :locals => {:hide_children => hide_children} -%>
20
+ </ul>
21
+ <% end -%>
22
+ </li>
23
+ <% end -%>