summaryrefslogtreecommitdiff
path: root/app/helpers/content_helper.rb
diff options
context:
space:
mode:
authorhukl <hukl@eight.intern.artcom.de>2009-02-03 16:47:43 +0100
committerhukl <hukl@eight.intern.artcom.de>2009-02-03 16:47:43 +0100
commit1902c4bf975a5c1decd199a5190b04d08a2e4760 (patch)
tree11a6983e98567f6894abb7c353e39ea30da458bb /app/helpers/content_helper.rb
parent91b6089337e59d0c30a0112a5689f476d3c2f013 (diff)
added lots of comments to describe what the
methods are doing. this will get everyone a better start. I hope
Diffstat (limited to 'app/helpers/content_helper.rb')
-rw-r--r--app/helpers/content_helper.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/helpers/content_helper.rb b/app/helpers/content_helper.rb
index 385bca0..9800471 100644
--- a/app/helpers/content_helper.rb
+++ b/app/helpers/content_helper.rb
@@ -1,9 +1,25 @@
1module ContentHelper 1module ContentHelper
2 2
3 # 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
3 def date_for_page page 5 def date_for_page page
4 page.published_at.to_s(:db) rescue page.created_at.to_s(:db) 6 page.published_at.to_s(:db) rescue page.created_at.to_s(:db)
5 end 7 end
6 8
9 # This method is an output filter for templates. It accepts any kind of text
10 # and checks for an <aggregate /> tag within it. If such a tag is found, its
11 # attributes are parsed and converted into parameters for the
12 # render_collection method. The <aggregate /> tag will then be replaced
13 # entirely with the output of the render_collection method.
14 #
15 # Syntax of the <aggregate /> tag:
16 #
17 # <aggregate
18 # flags="update, pressemitteilung"
19 # limit="20"
20 # order_by="published_at"
21 # order_direction="DESC"
22 # />
7 def aggregate? content 23 def aggregate? content
8 options = {} 24 options = {}
9 25
@@ -27,6 +43,8 @@ module ContentHelper
27 end 43 end
28 end 44 end
29 45
46 # Takes the parameters from the aggregate? method and renders the collection
47 # from Page.aggregate(options) with a given partial
30 def render_collection options 48 def render_collection options
31 render( 49 render(
32 :partial => 'content/article', 50 :partial => 'content/article',