Sha256: 7d43c298930aae4ab018212e6bc7ebd5f9eeb916a151722c59f94919117a72f2

Contents?: true

Size: 1.55 KB

Versions: 5

Compression:

Stored size: 1.55 KB

Contents

module Spurs
  module Section
    module Helper
      include ActionView::Helpers::TagHelper

      def spurs_collapsible_section(title,options={},&block)
        opts = Spurs::Section::collapsible_section_default_options.merge(options)
        if !opts[:builder]
          raise "Null builder"
        end

        options_to_pass_to_builder = {}
        builder = opts[:builder].new(options_to_pass_to_builder)
        section_content = capture(nil,&block)
        builder.build_collapsible_section(title.html_safe,section_content.html_safe)
      end

      def spurs_section(title,options={},&block)
        opts = Spurs::Section::section_default_options.merge(options)
        if !opts[:builder]
          raise "Null builder"
        end

        options_to_pass_to_builder = {}
        builder = opts[:builder].new(options_to_pass_to_builder)
        section_content = capture(nil,&block)
        builder.build_section(title.html_safe,section_content.html_safe)
      end

      def spurs_vcenter(options={}, &block)
        opts = options.clone
        if !opts[:class]
          opts[:class] = ""
        end
        opts[:class] = "vcenter_outer ".concat(opts[:class])

        # extract inner options
        inner_opts = opts[:inner_html] ? opts.delete(:inner_html) : {}
        if !inner_opts[:class]
          inner_opts[:class] = ""
        end
        inner_opts[:class].concat(" inner")

        section_content = capture(nil,&block)
        content_tag(:div,content_tag(:div, content_tag(:div,section_content,inner_opts),:class => "middle"),opts)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spurs-0.0.6.rc1 lib/spurs/section/helper.rb
spurs-0.0.5 lib/spurs/section/helper.rb
spurs-0.0.5.alpha.7 lib/spurs/section/helper.rb
spurs-0.0.5.alpha.6 lib/spurs/section/helper.rb
spurs-0.0.5.alpha.5 lib/spurs/section/helper.rb