diff options
| author | hukl <contact@smyck.org> | 2009-09-05 18:08:23 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-09-05 18:08:23 +0200 |
| commit | f919497c2b590402c3cbd7744097a9bd32b70afd (patch) | |
| tree | 94961500f507a7cceec67868fe042755d94151d8 /app | |
| parent | 3c631738935199aba050223bac50416b299e16c5 (diff) | |
added tag resource, widget and auxillary files
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/tags_controller.rb | 16 | ||||
| -rw-r--r-- | app/helpers/content_helper.rb | 4 | ||||
| -rw-r--r-- | app/helpers/tags_helper.rb | 2 | ||||
| -rw-r--r-- | app/views/content/_tags.html.erb | 8 | ||||
| -rw-r--r-- | app/views/layouts/application.html.erb | 2 | ||||
| -rw-r--r-- | app/views/tags/index.html.erb | 2 | ||||
| -rw-r--r-- | app/views/tags/show.html.erb | 9 |
7 files changed, 42 insertions, 1 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 @@ | |||
| 1 | class 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 | |||
| 16 | end | ||
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 @@ | |||
| 1 | module TagsHelper | ||
| 2 | end | ||
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 %> | ||
