Changeset 347
- Timestamp:
- 02/24/07 12:29:58 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/mental/extensions/aggregation/app/models/aggregation_tags.rb
r342 r347 2 2 include Radiant::Taggable 3 3 4 desc %{ 5 Aggregates the children of multiple URLs using the @urls@ attribute. 6 Useful for combining many different sections/categories into a single 7 feed or listing. 8 9 *Usage*: 10 11 <pre><code><r:aggregate urls="/section1; /section2; /section3"> ... </r:aggregate></code></pre> 12 } 4 13 tag "aggregate" do |tag| 5 14 raise "`urls' attribute required" unless tag.attr["urls"] … … 14 23 end 15 24 25 desc %{ 26 Renders the total count of children of the aggregated pages. Accepts the 27 same options as @<r:children:each />@. 28 29 *Usage*: 30 31 <pre><code><r:aggregate urls="/section1; /section2; /section3"> 32 <r:children:count /> 33 </r:aggregate></code></pre> 34 } 16 35 tag "aggregate:children:count" do |tag| 17 36 options = aggregate_children(tag) 18 37 Page.count(options) 19 38 end 20 39 desc %{ 40 Renders the contained block for each child of the aggregated pages. Accepts the 41 same options as the plain @<r:children:each />@. 42 43 *Usage*: 44 45 <pre><code><r:aggregate urls="/section1; /section2; /section3"> 46 <r:children:each> 47 ... 48 </r:children:each> 49 </r:aggregate></code></pre> 50 } 21 51 tag "aggregate:children:each" do |tag| 22 52 options = aggregate_children(tag) … … 32 62 end 33 63 64 desc %{ 65 Renders the first child of the aggregated pages. Accepts the 66 same options as @<r:children:each />@. 67 68 *Usage*: 69 70 <pre><code><r:aggregate urls="/section1; /section2; /section3"> 71 <r:children:first> 72 ... 73 </r:children:first> 74 </r:aggregate></code></pre> 75 } 34 76 tag "aggregate:children:first" do |tag| 35 77 options = aggregate_children(tag) … … 41 83 end 42 84 85 desc %{ 86 Renders the last child of the aggregated pages. Accepts the 87 same options as @<r:children:each />@. 88 89 *Usage*: 90 91 <pre><code><r:aggregate urls="/section1; /section2; /section3"> 92 <r:children:last> 93 ... 94 </r:children:last> 95 </r:aggregate></code></pre> 96 } 43 97 tag "aggregate:children:last" do |tag| 44 98 options = aggregate_children(tag)
