summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/tags_controller.rb16
-rw-r--r--app/helpers/content_helper.rb4
-rw-r--r--app/helpers/tags_helper.rb2
-rw-r--r--app/views/content/_tags.html.erb8
-rw-r--r--app/views/layouts/application.html.erb2
-rw-r--r--app/views/tags/index.html.erb2
-rw-r--r--app/views/tags/show.html.erb9
-rw-r--r--config/routes.rb4
-rw-r--r--public/stylesheets/ccc.css7
-rw-r--r--test/functional/tags_controller_test.rb8
-rw-r--r--test/unit/helpers/tags_helper_test.rb4
11 files changed, 60 insertions, 6 deletions
diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb
new file mode 100644
index 0000000..9248402
--- /dev/null
+++ b/app/controllers/tags_controller.rb
@@ -0,0 +1,16 @@
1class TagsController < ApplicationController
2 def index
3 end
4
5 def show
6 @tag = Tag.find_by_name(params[:id])
7 @page = Page.new
8 @pages = Page.heads.find_tagged_with(
9 @tag.name, :order => 'published_at DESC'
10 ).paginate(
11 :page=>params[:page],
12 :per_page => 23
13 )
14 end
15
16end
diff --git a/app/helpers/content_helper.rb b/app/helpers/content_helper.rb
index 8b16462..d9ec5db 100644
--- a/app/helpers/content_helper.rb
+++ b/app/helpers/content_helper.rb
@@ -16,6 +16,10 @@ module ContentHelper
16 ) 16 )
17 end 17 end
18 18
19 def tags
20 render :partial => 'content/tags'
21 end
22
19 def headline_image 23 def headline_image
20 image = @page.assets.images.first 24 image = @page.assets.images.first
21 if image 25 if image
diff --git a/app/helpers/tags_helper.rb b/app/helpers/tags_helper.rb
new file mode 100644
index 0000000..23450bc
--- /dev/null
+++ b/app/helpers/tags_helper.rb
@@ -0,0 +1,2 @@
1module TagsHelper
2end
diff --git a/app/views/content/_tags.html.erb b/app/views/content/_tags.html.erb
new file mode 100644
index 0000000..8012796
--- /dev/null
+++ b/app/views/content/_tags.html.erb
@@ -0,0 +1,8 @@
1<div id="frontpage_calendar">
2 <h2>Tags</h2>
3 <ul class="teasertext">
4 <% @page.tags.each do |tag| %>
5 <li><%= link_to tag.name, tag_path(:id => tag.name) %></li>
6 <% end %>
7 </ul>
8</div> \ No newline at end of file
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 2496595..69db939 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -23,7 +23,7 @@
23 <%= yield :layout %> 23 <%= yield :layout %>
24 </div> 24 </div>
25 <div id="right_column"> 25 <div id="right_column">
26 26 <%= tags %>
27 </div> 27 </div>
28 </div> 28 </div>
29 29
diff --git a/app/views/tags/index.html.erb b/app/views/tags/index.html.erb
new file mode 100644
index 0000000..19cf908
--- /dev/null
+++ b/app/views/tags/index.html.erb
@@ -0,0 +1,2 @@
1<h1>Tags#index</h1>
2<p>Find me in app/views/tags/index.html.erb</p>
diff --git a/app/views/tags/show.html.erb b/app/views/tags/show.html.erb
new file mode 100644
index 0000000..4012bbf
--- /dev/null
+++ b/app/views/tags/show.html.erb
@@ -0,0 +1,9 @@
1<%=
2 render(
3 :partial => 'custom/partials/article',
4 :collection => @pages,
5 :as => :page
6 )
7 %>
8
9<%= will_paginate @pages %>
diff --git a/config/routes.rb b/config/routes.rb
index b8c877b..c3b2e84 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,5 +1,4 @@
1ActionController::Routing::Routes.draw do |map| 1ActionController::Routing::Routes.draw do |map|
2 map.resources :assets
3 2
4 map.filter :locale 3 map.filter :locale
5 4
@@ -9,7 +8,8 @@ ActionController::Routing::Routes.draw do |map|
9 :action => 'render_page', 8 :action => 'render_page',
10 :page_path => ['home'] 9 :page_path => ['home']
11 ) 10 )
12 11 map.resources :assets
12 map.resources :tags
13 map.resources :occurrences 13 map.resources :occurrences
14 map.resources :events 14 map.resources :events
15 map.resources :revisions, :member => {:diff => :post, :restore => :put} 15 map.resources :revisions, :member => {:diff => :post, :restore => :put}
diff --git a/public/stylesheets/ccc.css b/public/stylesheets/ccc.css
index 33e726a..4307f0e 100644
--- a/public/stylesheets/ccc.css
+++ b/public/stylesheets/ccc.css
@@ -62,7 +62,7 @@ div#frontpage_calendar {
62div#frontpage_calendar h2 { 62div#frontpage_calendar h2 {
63 border-top: 2px solid #000000; 63 border-top: 2px solid #000000;
64 border-bottom: 2px dashed #000000; 64 border-bottom: 2px dashed #000000;
65 font-size: 18px; 65 font-size: 16px;
66 padding-top: 2px; 66 padding-top: 2px;
67 padding-bottom: 2px; 67 padding-bottom: 2px;
68} 68}
@@ -119,9 +119,10 @@ div#center_column h2 a {
119 119
120div#right_column { 120div#right_column {
121 position: absolute; 121 position: absolute;
122 background-color: #f1f1f1; 122 background-color: #ffffff;
123 padding-left: 70px;
123 left: 735px; 124 left: 735px;
124 width: 174px; 125 width: 115px;
125 height: 100px; 126 height: 100px;
126} 127}
127 128
diff --git a/test/functional/tags_controller_test.rb b/test/functional/tags_controller_test.rb
new file mode 100644
index 0000000..dcf6b7e
--- /dev/null
+++ b/test/functional/tags_controller_test.rb
@@ -0,0 +1,8 @@
1require 'test_helper'
2
3class TagsControllerTest < ActionController::TestCase
4 # Replace this with your real tests.
5 test "the truth" do
6 assert true
7 end
8end
diff --git a/test/unit/helpers/tags_helper_test.rb b/test/unit/helpers/tags_helper_test.rb
new file mode 100644
index 0000000..4b1935f
--- /dev/null
+++ b/test/unit/helpers/tags_helper_test.rb
@@ -0,0 +1,4 @@
1require 'test_helper'
2
3class TagsHelperTest < ActionView::TestCase
4end