diff options
| author | hukl <contact@smyck.org> | 2009-12-01 23:02:39 +0100 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-12-01 23:04:06 +0100 |
| commit | 3af611abb212052351f0979b85027adafce87a69 (patch) | |
| tree | 7dd3d23a3346d95f1dd80b2724bcf51297a8896b | |
| parent | 4d3d971452086f375eed953f66f25cfe6e622281 (diff) | |
dramatically reduced instanciated AR objects for tags
| -rw-r--r-- | app/controllers/tags_controller.rb | 13 | ||||
| -rw-r--r-- | app/views/custom/partials/_no_date_and_author.html.erb | 4 | ||||
| -rw-r--r-- | app/views/tags/show.html.erb | 2 |
3 files changed, 12 insertions, 7 deletions
diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index c965443..d235601 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb | |||
| @@ -11,12 +11,13 @@ class TagsController < ApplicationController | |||
| 11 | tag_name = @tag ? @tag.name : nil | 11 | tag_name = @tag ? @tag.name : nil |
| 12 | 12 | ||
| 13 | @page = Page.new | 13 | @page = Page.new |
| 14 | @pages = Page.heads.find_tagged_with( | 14 | @pages = Page.heads.paginate( |
| 15 | tag_name, :order => 'published_at DESC' | 15 | Page.find_options_for_find_tagged_with(tag_name).merge( |
| 16 | ).paginate( | 16 | :order => 'published_at DESC', |
| 17 | :page=>params[:page], | 17 | :page=>params[:page], |
| 18 | :per_page => 23 | 18 | :per_page => 23 |
| 19 | ) | 19 | ) |
| 20 | ) | ||
| 20 | end | 21 | end |
| 21 | 22 | ||
| 22 | end | 23 | end |
diff --git a/app/views/custom/partials/_no_date_and_author.html.erb b/app/views/custom/partials/_no_date_and_author.html.erb new file mode 100644 index 0000000..61d6aac --- /dev/null +++ b/app/views/custom/partials/_no_date_and_author.html.erb | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | <div class="article_partial"> | ||
| 2 | <h2 class="headline"><%= link_to page.title, content_path(page.node.unique_path) %></h2> | ||
| 3 | <p class="excerpt"><%= page.abstract %></p> | ||
| 4 | </div> \ No newline at end of file | ||
diff --git a/app/views/tags/show.html.erb b/app/views/tags/show.html.erb index 7016efc..b09cc15 100644 --- a/app/views/tags/show.html.erb +++ b/app/views/tags/show.html.erb | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | <%= | 3 | <%= |
| 4 | render( | 4 | render( |
| 5 | :partial => 'custom/partials/article', | 5 | :partial => 'custom/partials/no_date_and_author', |
| 6 | :collection => @pages, | 6 | :collection => @pages, |
| 7 | :as => :page | 7 | :as => :page |
| 8 | ) | 8 | ) |
