Module: Webs::Helper::Tags

Defined in:
lib/helper/tags.rb

Instance Method Summary collapse

Instance Method Details

#fwml(tagname, options = {}, &block) ⇒ Object

Examples:

<%= fwml( :blah, :fw_attributes=>{:value=>fwml( :name, :uid=>‘xxx’) } ) do %>HELLO<% end %>

Renders:

<fw:blah>HELLO<fw:fwml_attribute name=“value”><fw:name uid=“xxx”/></fw:fwml_attribute></fw:blah> can take an option: :tokens which is a hash for replacement and will add in the appropriate fw:intl-token tags ex:

<%= fwml :intl, :description=>"bogus", :tokens=>{ :tier=>"Tier 1", :image_limit=>"10", :upgrade_link=>"www.blah.com" } do %>
  As a {tier} member, each of your products can have a maximum of {image_limit}.
  Need more? Time to upgrade!
  {upgrade_link}
<% end %>

Should Yield:

<fw:intl description="bogus">
  As a {tier} member, each of your products can have a maximum of {image_limit}.
  Need more? Time to upgrade!
  {upgrade_link}
  <fw:intl-token name="tier">Tier 1</fw:intl-token> 
  <fw:intl-token name="image_limit">10</fw:intl-token>
  <fw:intl-token name="upgrade_link">www.blah.com</fw:intl-token>
</fw:intl>

You should also be able to use it without a body, so this should work: <% rubystring = ‘hello world’ %> <%= fwml :intl, :value=rubystring %>

Should Yield

<fw:intl>hello world</fw:intl>



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/helper/tags.rb', line 39

def fwml tagname, options={}, &block
#        Rails.logger.debug "****** fwml #{tagname} #{options.inspect}"
  tagname = tagname.to_s unless tagname.nil?
  if ['sanitize', 'wizzywig'].include?(tagname)
    tag = self.send( "fw_#{tagname}", options, &block )
  else
    if block
      tag = render_tag_with_block tagname, options, false, &block
    else
      tag = inline_tag( tagname, options )
    end
  end

  html_safe_check( tag )
end