summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorhukl <contact@smyck.org>2009-07-19 12:26:42 +0200
committerhukl <contact@smyck.org>2009-07-19 12:26:42 +0200
commit03e985f546634b9bfc3053e965477d555c6663a8 (patch)
treeef622a72a49a676bc7e89254a073b0ad53e76d90 /app/helpers
parent144b18c5db61c53028177680295f3fc9d4e8711d (diff)
intermediate commit introducing main menu and calendar widget which will get refactored soon. need another feature first
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/content_helper.rb14
-rw-r--r--app/helpers/link_helper.rb16
2 files changed, 24 insertions, 6 deletions
diff --git a/app/helpers/content_helper.rb b/app/helpers/content_helper.rb
index e945efb..536377b 100644
--- a/app/helpers/content_helper.rb
+++ b/app/helpers/content_helper.rb
@@ -1,5 +1,19 @@
1module ContentHelper 1module ContentHelper
2 2
3 def main_menu
4 nodes = Node.find(:all, :conditions => {:parent_id => 1})
5 render :partial => 'content/main_navigation', :locals => {:nodes => nodes}
6 end
7
8 def calendar
9 occurrences = Occurrence.find_in_range(Time.now, (Time.now+14.days))
10 render(
11 :partial => 'content/front_page_calendar',
12 :locals => {:occurrences => occurrences}
13 )
14 end
15
16
3 # Returns the published_at attribute of a page if it is not nil, otherwise 17 # Returns the published_at attribute of a page if it is not nil, otherwise
4 # it returns the auto-filled value of the created_at attribute 18 # it returns the auto-filled value of the created_at attribute
5 def date_for_page page 19 def date_for_page page
diff --git a/app/helpers/link_helper.rb b/app/helpers/link_helper.rb
index 881c553..3be5953 100644
--- a/app/helpers/link_helper.rb
+++ b/app/helpers/link_helper.rb
@@ -1,14 +1,18 @@
1module LinkHelper 1module LinkHelper
2 2
3 def link_to_path title, path 3 def link_to_path title, path, html_options = {}
4 active = (params[:page_path].join("/") == path.sub(/^\//, ""))
5
4 params[:locale] ||= I18n.locale 6 params[:locale] ||= I18n.locale
5 7
6 link_to( 8 link_to(
7 title, 9 title, {
8 :controller => :content, 10 :controller => :content,
9 :action => :render_page, 11 :action => :render_page,
10 :locale => params[:locale], 12 :locale => params[:locale],
11 :page_path => path 13 :page_path => path.sub(/^\//, "").split("/")
14 },
15 active ? {:class => 'active'} : {:class => 'inactive'}
12 ) 16 )
13 end 17 end
14 18