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
-~----------~----~----~----~------~----~------~--~---

Reply via email to