Sha256: 95c7b9782ea0c13cab187c5a7cc2750577b9509c6adc643dfe08e6d5639c2d41
Contents?: true
Size: 1023 Bytes
Versions: 9
Compression:
Stored size: 1023 Bytes
Contents
class Spurs::Section::CollapsibleSectionBuilder include ActionView::Helpers::TagHelper @options_from_helper def initialize(args={}) @options_from_helper = args.clone end def build_collapsible_section(title,content) r = SecureRandom::hex(5) section_id = "section_#{r}" header_output = build_header(title,section_id) body_output = build_body(content) content_tag(:div,header_output.concat(body_output), :class => "spurs_collapsible_section #{section_id}") end private def build_header(title,section_id) header_content = build_toggle_button(section_id) header_content.concat(content_tag(:h4,title)) content_tag(:div,header_content,:class => "section_header", :onclick => "spurs.sections.toggle($('.#{section_id}'));") end def build_toggle_button(section_id) content_tag(:a, content_tag(:i,"",:class => "icon-chevron-right"), :class => "section_toggle") end def build_body(content) content_tag(:div, content.html_safe, :class => "section_body") end end
Version data entries
9 entries across 9 versions & 1 rubygems