summaryrefslogtreecommitdiff
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
parent144b18c5db61c53028177680295f3fc9d4e8711d (diff)
intermediate commit introducing main menu and calendar widget which will get refactored soon. need another feature first
-rw-r--r--app/helpers/content_helper.rb14
-rw-r--r--app/helpers/link_helper.rb16
-rw-r--r--app/views/content/_front_page_calendar.html.erb11
-rw-r--r--app/views/content/_main_navigation.html.erb7
-rw-r--r--app/views/layouts/application.html.erb2
-rw-r--r--public/stylesheets/ccc.css21
6 files changed, 64 insertions, 7 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
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 @@
1<div id="frontpage_calendar">
2 <h2>Calendar</h2>
3 <ul class="teasertext">
4 <% occurrences.each do |occurrence| %>
5 <li>
6 <div><%= l occurrence.start_time.to_date, :format => :default %></div>
7 <%= link_to_path occurrence.node.head.title, occurrence.node.unique_name %>
8 </li>
9 <% end %>
10 </ul>
11</div> \ 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 @@
1<div id="main_navigation">
2 <ul>
3 <% nodes.each do |node| %>
4 <li><%= link_to node.head.try(:title), node.unique_name %></li>
5 <% end %>
6 </ul>
7</div> \ 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 @@
16 </div> 16 </div>
17 <div id="left_column"> 17 <div id="left_column">
18 <%= main_menu %> 18 <%= main_menu %>
19
20 <%= calendar %>
19 </div> 21 </div>
20 <div id="center_column"> 22 <div id="center_column">
21 <%= yield :layout %> 23 <%= 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 {
29 height: 224px; 29 height: 224px;
30} 30}
31 31
32div#main_navigation ul {
33 margin-left: 0;
34 padding-left: 0;
35}
36
32div#main_navigation li { 37div#main_navigation li {
33 list-style-type: none; 38 list-style-type: none;
34} 39}
@@ -48,6 +53,17 @@ div#main_navigation a.active {
48 font-size: 22px; 53 font-size: 22px;
49} 54}
50 55
56div#frontpage_calendar {
57}
58
59div#frontpage_calendar h2 {
60 border-top: 2px solid #000000;
61 border-bottom: 2px dashed #000000;
62 font-size: 18px;
63 padding-top: 2px;
64 padding-bottom: 2px;
65}
66
51div.author_and_date { 67div.author_and_date {
52 font-style: italic; 68 font-style: italic;
53} 69}
@@ -58,10 +74,13 @@ div#left_column {
58 background-position: top right; 74 background-position: top right;
59 background-repeat: no-repeat; 75 background-repeat: no-repeat;
60 left: 0px; 76 left: 0px;
61 width: 185px; 77 width: 145px;
62 min-height: 100px; 78 min-height: 100px;
79 text-align: right;
80 padding-right: 40px;
63} 81}
64 82
83
65div#center_column { 84div#center_column {
66 position: absolute; 85 position: absolute;
67 background-color: #ffffff; 86 background-color: #ffffff;