Changeset 815
- Timestamp:
- 04/18/08 15:47:39 (4 months ago)
- Files:
-
- trunk/radiant/CHANGELOG (modified) (1 diff)
- trunk/radiant/CONTRIBUTORS (modified) (1 diff)
- trunk/radiant/app/models/standard_tags.rb (modified) (1 diff)
- trunk/radiant/spec/models/standard_tags_spec.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/radiant/CHANGELOG
r813 r815 2 2 3 3 === SVN 4 * Add if_self and if_ancestor_or_self tags. [Marty Haught] 4 5 * Rename created_by and updated_by columns on standard models. [Sean Cribbs] 5 6 * Fix Dir glob for extension rake tasks. [Sean Cribbs] trunk/radiant/CONTRIBUTORS
r811 r815 6 6 7 7 === SVN 8 * Marty Haught 8 9 * xtoddx 9 10 * Michael Klett trunk/radiant/app/models/standard_tags.rb
r814 r815 336 336 desc %{ 337 337 Renders the contained elements if the current contextual page is either the actual page or one of its parents. 338 339 This is typically used inside another tag (like <r:children:each>) to add conditional mark-up if the child element is or descends from the current page.340 338 339 This is typically used inside another tag (like <r:children:each>) to add conditional mark-up if the child element is or descends from the current page. 340 341 341 *Usage:* 342 342 <pre><code><r:if_ancestor_or_self>...</if_ancestor_or_self></code></pre> 343 343 } 344 tag "if_ancestor_or_self" do |tag|345 tag.expand if (tag.globals.actual_page.ancestors + [tag.globals.actual_page]).include?(tag.locals.page)346 end347 344 tag "if_ancestor_or_self" do |tag| 345 tag.expand if (tag.globals.page.ancestors + [tag.globals.page]).include?(tag.locals.page) 346 end 347 348 348 desc %{ 349 349 Renders the contained elements if the current contextual page is also the actual page. 350 351 This is typically used inside another tag (like <r:children:each>) to add conditional mark-up if the child element is the current page.352 353 *Usage:*350 351 This is typically used inside another tag (like <r:children:each>) to add conditional mark-up if the child element is the current page. 352 353 *Usage:* 354 354 <pre><code><r:if_self>...</if_self></code></pre> 355 355 } 356 356 tag "if_self" do |tag| 357 tag.expand if tag.locals.page == tag.globals. actual_page357 tag.expand if tag.locals.page == tag.globals.page 358 358 end 359 359 trunk/radiant/spec/models/standard_tags_spec.rb
r814 r815 464 464 end 465 465 466 describe "<r:if_ancestor_or_self>" do 467 it "should render the tag's content when the current page is an ancestor of tag.locals.page" do 468 page(:home).should render(%{<r:find url="/radius"><r:if_ancestor_or_self>true</r:if_ancestor_or_self></r:find>}).as('true') 469 end 470 471 it "should not render the tag's content when current page is not an ancestor of tag.locals.page" do 472 page(:parent).should render(%{<r:find url="/radius"><r:if_ancestor_or_self>true</r:if_ancestor_or_self></r:find>}).as('') 473 end 474 end 466 describe "<r:if_ancestor_or_self>" do 467 it "should render the tag's content when the current page is an ancestor of tag.locals.page" do 468 page(:radius).should render(%{<r:find url="/"><r:if_ancestor_or_self>true</r:if_ancestor_or_self></r:find>}).as('true') 469 end 470 471 it "should not render the tag's content when current page is not an ancestor of tag.locals.page" do 472 page(:parent).should render(%{<r:find url="/radius"><r:if_ancestor_or_self>true</r:if_ancestor_or_self></r:find>}).as('') 473 end 474 end 475 476 describe "<r:if_self>" do 477 it "should render the tag's content when the current page is the same as the local contextual page" do 478 page(:home).should render(%{<r:find url="/"><r:if_self>true</r:if_self></r:find>}).as('true') 479 end 480 481 it "should not render the tag's content when the current page is not the same as the local contextual page" do 482 page(:radius).should render(%{<r:find url="/"><r:if_self>true</r:if_self></r:find>}).as('') 483 end 484 end 475 485 476 486 private
