[Radiant] check for children
Steven Noels
stevenn at outerthought.org
Mon Sep 25 00:30:17 CDT 2006
On 24 Sep 2006, at 22:24, Dave Crossland wrote:
> If you could provide it as a plugin, that would be awesome! :-)
Creating a plugin for a two-line patch for a totally trivial addition
would be overkill, no?
Index: app/models/page_context.rb
===================================================================
--- app/models/page_context.rb (revision 122)
+++ app/models/page_context.rb (working copy)
@@ -40,6 +40,15 @@
end
#
+ # <r:if_children>...</r:if_children>
+ #
+ # Checks for existing children.
+ #
+ define_tag 'if_children' do |tag|
+ tag.expand if tag.locals.page.has_children?
+ end
+
+ #
# <r:children:count />
#
# Renders the total number of children.
</Steven>
--
Steven Noels http://outerthought.org/
Outerthought Open Source Java & XML
stevenn at outerthought.org stevenn at apache.org
More information about the Radiant
mailing list