Skip to content

Commit

Permalink
Merges changes from master branch.
Browse files Browse the repository at this point in the history
  • Loading branch information
parndt committed Aug 20, 2010
2 parents bcced6d + 55b2d60 commit c1979cd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
@@ -1,5 +1,5 @@
<%
css = (css = css_for_menu_branch(menu_branch, menu_branch_counter)).any? ? " class='#{css.join(' ')}'" : nil
css = (css = css_for_menu_branch(menu_branch, menu_branch_counter, sibling_count||=nil)).any? ? " class='#{css.join(' ')}'" : nil
dom_id = (menu_branch.parent_id.nil? and menu_branch.title.present?) ? " id='item_#{menu_branch_counter}'" : nil
-%>
<li<%= css -%><%= dom_id -%>>
Expand Down
2 changes: 1 addition & 1 deletion vendor/refinerycms/core/lib/refinery/application_helper.rb
Expand Up @@ -27,7 +27,7 @@ def content_fu(content, thumbnail)

# This was extracted from REFINERY_ROOT/vendor/plugins/refinery/app/views/shared/_menu_branch.html.erb
# to remove the complexity of that template by reducing logic in the view.
def css_for_menu_branch(menu_branch, menu_branch_counter)
def css_for_menu_branch(menu_branch, menu_branch_counter, sibling_count = nil)
css = []
css << "selected" if selected_page?(menu_branch) or descendant_page_selected?(menu_branch)
css << "first" if menu_branch_counter == 0
Expand Down
6 changes: 4 additions & 2 deletions vendor/refinerycms/pages/app/models/page.rb
Expand Up @@ -21,7 +21,6 @@ class Page < ActiveRecord::Base

before_destroy :deletable?
after_save :reposition_parts!

after_save :invalidate_child_cached_url

# when a dialog pops up to link to a page, how many pages per page should there be
Expand Down Expand Up @@ -202,7 +201,10 @@ def [](part_title)
# the way that we call page parts seems flawed, will probably revert to page.parts[:title] in a future release.
if (super_value = super).blank?
# self.parts is already eager loaded so we can now just grab the first element matching the title we specified.
part = self.parts.detect {|part| (part.title == part_title.to_s) || (part.title.downcase.gsub(" ", "_") == part_title.to_s.downcase.gsub(" ", "_")) }
part = self.parts.detect do |part|
part.title == part_title.to_s or
part.title.downcase.gsub(" ", "_") == part_title.to_s.downcase.gsub(" ", "_")
end

return part.body unless part.nil?
end
Expand Down

0 comments on commit c1979cd

Please sign in to comment.