Skip to content

Commit

Permalink
Adding Config to Hide Title in Page Body
Browse files Browse the repository at this point in the history
Fixes #2067
  • Loading branch information
GeekOnCoffee authored and parndt committed Dec 5, 2012
1 parent 30784b9 commit 7a8768a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
Expand Up @@ -50,4 +50,6 @@ Refinery::Pages.configure do |config|
# config.page_title = <%= Refinery::Pages.page_title.inspect %>

# config.absolute_page_links = <%= Refinery::Pages.absolute_page_links.inspect %>

# config.show_title_in_body = <%= Refinery::Pages.show_title_in_body.inspect %>
end
3 changes: 2 additions & 1 deletion pages/lib/refinery/pages/configuration.rb
Expand Up @@ -8,7 +8,7 @@ module Pages
:cache_pages_full, :layout_template_whitelist,
:view_template_whitelist, :use_layout_templates,
:use_view_templates, :page_title, :absolute_page_links, :types,
:auto_expand_admin_tree
:auto_expand_admin_tree, :show_title_in_body

self.pages_per_dialog = 14
self.pages_per_admin_index = 20
Expand Down Expand Up @@ -37,6 +37,7 @@ module Pages
:wrap_if_not_chained => false
}
}
self.show_title_in_body = true
self.absolute_page_links = false
self.types = Types.registered
self.auto_expand_admin_tree = true
Expand Down
2 changes: 1 addition & 1 deletion pages/lib/refinery/pages/content_page_presenter.rb
Expand Up @@ -7,7 +7,7 @@ module Pages
class ContentPagePresenter < ContentPresenter
def initialize(page, page_title)
super()
add_default_title_section(page_title) if page_title.present?
add_default_title_section(page_title) if page_title.present? && Pages.show_title_in_body
add_page_parts(page.parts) if page
add_default_post_page_sections
end
Expand Down
6 changes: 6 additions & 0 deletions pages/spec/requests/refinery/pages_spec.rb
Expand Up @@ -68,6 +68,12 @@ def standard_page_menu_items_exist?
find("#body_content_title").text.should == about_page.title
end

it "should hide title when config is set" do
Refinery::Pages.stub(:show_title_in_body).and_return(false)
visit '/about'
page.should_not have_selector("#body_content_title")
end

it "uses title in the menu" do
find(".selected").text.strip.should == about_page.title
end
Expand Down

0 comments on commit 7a8768a

Please sign in to comment.