From 03e985f546634b9bfc3053e965477d555c6663a8 Mon Sep 17 00:00:00 2001 From: hukl Date: Sun, 19 Jul 2009 12:26:42 +0200 Subject: intermediate commit introducing main menu and calendar widget which will get refactored soon. need another feature first --- app/helpers/content_helper.rb | 14 ++++++++++++++ app/helpers/link_helper.rb | 16 ++++++++++------ app/views/content/_front_page_calendar.html.erb | 11 +++++++++++ app/views/content/_main_navigation.html.erb | 7 +++++++ app/views/layouts/application.html.erb | 2 ++ public/stylesheets/ccc.css | 21 ++++++++++++++++++++- 6 files changed, 64 insertions(+), 7 deletions(-) create mode 100644 app/views/content/_front_page_calendar.html.erb create mode 100644 app/views/content/_main_navigation.html.erb 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 @@ module ContentHelper + def main_menu + nodes = Node.find(:all, :conditions => {:parent_id => 1}) + render :partial => 'content/main_navigation', :locals => {:nodes => nodes} + end + + def calendar + occurrences = Occurrence.find_in_range(Time.now, (Time.now+14.days)) + render( + :partial => 'content/front_page_calendar', + :locals => {:occurrences => occurrences} + ) + end + + # Returns the published_at attribute of a page if it is not nil, otherwise # it returns the auto-filled value of the created_at attribute 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 @@ module LinkHelper - def link_to_path title, path + def link_to_path title, path, html_options = {} + active = (params[:page_path].join("/") == path.sub(/^\//, "")) + params[:locale] ||= I18n.locale link_to( - title, - :controller => :content, - :action => :render_page, - :locale => params[:locale], - :page_path => path + title, { + :controller => :content, + :action => :render_page, + :locale => params[:locale], + :page_path => path.sub(/^\//, "").split("/") + }, + active ? {:class => 'active'} : {:class => 'inactive'} ) end diff --git a/app/views/content/_front_page_calendar.html.erb b/app/views/content/_front_page_calendar.html.erb new file mode 100644 index 0000000..1a409a6 --- /dev/null +++ b/app/views/content/_front_page_calendar.html.erb @@ -0,0 +1,11 @@ +
+

Calendar

+ +
\ No newline at end of file diff --git a/app/views/content/_main_navigation.html.erb b/app/views/content/_main_navigation.html.erb new file mode 100644 index 0000000..3160fd4 --- /dev/null +++ b/app/views/content/_main_navigation.html.erb @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 93146d8..2496595 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -16,6 +16,8 @@
<%= main_menu %> + + <%= calendar %>
<%= yield :layout %> diff --git a/public/stylesheets/ccc.css b/public/stylesheets/ccc.css index bacdbd6..9cd064f 100644 --- a/public/stylesheets/ccc.css +++ b/public/stylesheets/ccc.css @@ -29,6 +29,11 @@ div#header { height: 224px; } +div#main_navigation ul { + margin-left: 0; + padding-left: 0; +} + div#main_navigation li { list-style-type: none; } @@ -48,6 +53,17 @@ div#main_navigation a.active { font-size: 22px; } +div#frontpage_calendar { +} + +div#frontpage_calendar h2 { + border-top: 2px solid #000000; + border-bottom: 2px dashed #000000; + font-size: 18px; + padding-top: 2px; + padding-bottom: 2px; +} + div.author_and_date { font-style: italic; } @@ -58,10 +74,13 @@ div#left_column { background-position: top right; background-repeat: no-repeat; left: 0px; - width: 185px; + width: 145px; min-height: 100px; + text-align: right; + padding-right: 40px; } + div#center_column { position: absolute; background-color: #ffffff; -- cgit v1.3