Method: Platform::ActionViewExtension::InstanceMethods#platform_toggler_tag

Defined in:
lib/platform/extensions/action_view_extension.rb

#platform_toggler_tag(content_id, label = "", open = true, opts = {}) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/platform/extensions/action_view_extension.rb', line 33

def platform_toggler_tag(content_id, label = "", open = true, opts = {})
  style = opts[:style] || 'text-align:center; vertical-align:middle'

  html = "<span id='#{content_id}_open' "
  html << "style='display:none'" unless open
  html << ">"
  html << link_to_function("#{image_tag("platform/arrow_down.gif", :style=>style)} #{label}".html_safe, "Tr8n.Effects.hide('#{content_id}_open'); Tr8n.Effects.show('#{content_id}_closed'); Tr8n.Effects.blindUp('#{content_id}');", :style=> "text-decoration:none")
  html << "</span>" 
  html << "<span id='#{content_id}_closed' "
  html << "style='display:none'" if open
  html << ">"
  html << link_to_function("#{image_tag("platform/arrow_right.gif", :style=>style)} #{label}".html_safe, "Tr8n.Effects.show('#{content_id}_open'); Tr8n.Effects.hide('#{content_id}_closed'); Tr8n.Effects.blindDown('#{content_id}');", :style=> "text-decoration:none")
  html << "</span>"
  html.html_safe 
end