To go along with my changes to have different type of pages, I change
the definition of <r:title>,<r:url>, etc… that it calls a new method
on @page, “tag_attributes” to get the list of available methods
(previously it used @page.attributes.symbolize_keys.keys) so that new
page models could expose more things for tags. I also changed the
unless_url/if_url tags so that there was a corresponding unless/if for
each attribute.
However, this doesn’t work quite the way I’d like. I can’t do this:
<r:children:each:child>
<r:if_type matches=“FileAsset”>
<r:if_content_type matches="^image">
<r:image />
</r:if_content_type>
</r:if_type>
</r:children:each:child>
(there will be a better way to get all child images of a page, I just
haven’t thought of it yet, so this is the first principles process).
Because tags are defined by the currently rendering page, and
if_content_type has no meaning here (the @page in question is a regular
page, and knows nothing of content_type).
Would it make sense to basically switch context completely while within
a children:each:child tag to delegate all tags to the child page? Does
this clash with the fundamental architecture of radius. In this case, I
can work around this by introducing an “<r:attribute>” tag that does the
same thing (with corresponding <r:unless_attribute> and <r:if_attribute>
tags), but thought I might raise this in case anybody can think of other
types of tags/behaviours that might be hindered by this.
And while you’ve got the example above fresh in your mind - doing a
children:each:child with conditions… how would you like to see it
done?
if would be simple enough to add on:
<children:each:child type=“image”>
<children:each:child type=“file”>
<children:each:child type=“page”>
but what if you want to, say, only grab children by a certain author? by
some other attribute? what if you want to grab all non-page, non-image
children? Maybe, once again I’m just thinking too hard about things that
are above and beyond what a CMS should be doing, because I don’t really
see a way to do everything that I can think of without throwing in an
ErbBehaviour (which, looks to be dead simple if it comes to that).