Since you're looking to have basically a javascript area built, what
seems you want is a wrapper tag that's the only one that includes the
script tag. After that, you can build each submodule with erb as just
script without that tag. Each tag should include a default parameter
to allow easy nesting.
Looks like your tags are going that route. Just add a <do
param="default" /> at the point where a nested tag should be
inserted. Then you should be able to use it with the nested tags like
you showed.
<ext-window title="Panel window" show>
<ext-panel title="Panel A"/>
<ext-panel title="Panel B">
<ext-panel title="Panel B.1"/>
</ext-panel>
</ext-window>
On Sep 7, 10:03 am, Kristian <[email protected]> wrote:
> Hmm, I have been looking into the DRYML guide. It seems the following
> attribute lists/hashes are available within a tag when it is called.
> attributes (not declared)
> all_attributes (all, including not declared)
> attributes_for[:tag_name]
>
> There is an example to get all attributes not declared by tag:
> tag_atrrs_undeclared = attributes & attributes_for[:ext-panel]
>
> So to filter all attribute values declared for ext-window tag, I guess
> I would do
> tag_atrrs = all_attributes & attributes_for[:ext-panel]
>
> I am using this here:
>
> <def tag="ext-window" attrs="title, width, height, show">
> new Ext.Window({
> <%
> tag_atrrs = all_attributes & attributes_for[:ext-window]
> window_atrrs = calc_attrs(tag_atrrs) %>
> <%= ext-attributes(window_atrrs) %>
> items : <%= params.default %>
> })<%= ".show();" if :show %>
> </def>
>
> <def tag="ext-panel" attrs="title, width, height, frame, html">
> {
> xtype : 'panel',
> <%
> tag_atrrs = all_attributes & attributes_for[:ext-panel]
> panel_atrrs = calc_attrs(tag_atrrs) %>
> %>
> <%= ext-attributes(panel_attrs) %>
> items : <%= params.default %>
> }
> </def>
>
> attrs_always_skip = [:show]
>
> # NOT SURE about subtraction here!
>
> # subtract attrs_skip from attrs
> def calc_attrs(attrs, attrs_skip)
> (attrs - attrs_always_skip) - attrs_skip
> end
>
> # take a map of symbol => value and convert to joined list
> # of "symbol1 : value1, symbol2 : value2, ..."
> def ext-attributes(values)
> ext_attrib_list = []
> vaules.each do |key, value|
> ext_attrib_list << "#{key.to_s} : #{value}"
> end
> ext_attrib_list.join(",\n")
> end
>
> --
>
> Any ideas/suggestions?
>
> Where should I put utility functons used for this ExtJS DRYML taglib?
> Anyone wants to help here?
>
> Kristian
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---