summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/application_helper.rb30
-rw-r--r--app/helpers/navigation_helper.rb22
2 files changed, 30 insertions, 22 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 2933bd1..45e8228 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -69,13 +69,9 @@ module ApplicationHelper
def page_title
if @page
- if @page.props
- @page.props.title || @page.title
- else
- @page.title
- end
+ @page.title
else
- ""
+ nil
end
end
@@ -85,16 +81,16 @@ module ApplicationHelper
# they call two different 'render' methods (controller and view renders behave differently).
# TODO: figure out how to combine into one helper_method.
#
- def render_page(page)
- begin
- render :template => page.template_path
- rescue ActionView::MissingTemplate => exc
- begin
- render :template => page.template_path(DEFAULT_LOCALE)
- rescue
- raise exc
- end
- end
- end
+ # def render_page(page)
+ # begin
+ # render :template => page.template_path
+ # rescue ActionView::MissingTemplate => exc
+ # begin
+ # render :template => page.template_path(DEFAULT_LOCALE)
+ # rescue
+ # raise exc
+ # end
+ # end
+ # end
end
diff --git a/app/helpers/navigation_helper.rb b/app/helpers/navigation_helper.rb
index fde6b45..b4ca514 100644
--- a/app/helpers/navigation_helper.rb
+++ b/app/helpers/navigation_helper.rb
@@ -19,7 +19,7 @@ module NavigationHelper
site.menu.each do |item|
active = current_page_path.first == item.name ? 'active' : ''
haml 'li.tab', :class => first do
- haml 'a.tab', I18n.t('pages.' + item.name), :href => menu_item_path(item), :class => active
+ haml 'a.tab', menu_item_title(item), :href => menu_item_path(item), :class => active
end
first = ''
end
@@ -39,7 +39,7 @@ module NavigationHelper
def act_as(page)
page = site.find_page(page)
@current_page_path = page.path
- render_page(page)
+ page_body(page)
end
private
@@ -48,12 +48,24 @@ module NavigationHelper
"/#{I18n.locale}/#{item.path.join('/')}"
end
+ def menu_item_title(item)
+ page = site.pages[item.path_str] || site.pages[item.name]
+ if page
+ page.nav_title(I18n.locale)
+ else
+ nil
+ end
+ end
+
def display_menu(menu, level=0)
menu.each do |item|
- haml 'li', :class => path_active(current_page_path, item) do
- haml 'a', I18n.t('pages.'+item.name), :href => menu_item_path(item), :class => "level#{level}"
+ title = menu_item_title(item)
+ if title
+ haml 'li', :class => path_active(current_page_path, item) do
+ haml 'a', menu_item_title(item), :href => menu_item_path(item), :class => "level#{level}"
+ end
+ display_menu(item.submenu, level+1)
end
- display_menu(item.submenu, level+1)
end
end