Sha256: 4729cd48585f29c7951179afe4be05d363e7296bc296a7887ea6786bbd1ce3b4

Contents?: true

Size: 727 Bytes

Versions: 5

Compression:

Stored size: 727 Bytes

Contents

module Twitter::Bootstrap::Markup::Rails::Components
  class InlineLabel < Base
    attr_reader :message

    def initialize(message, options = {})
      super
      @message = message
    end

    def to_s
      output_buffer << content_tag(:span, message, build_tag_options).html_safe
      super
    end

    private
    def default_options
      {
        :class        => "label",
        :type         => nil,
        :html_options => {}
      }
    end

    def build_class
      classes = [options[:class]]
      classes << options[:type] if options[:type]
      classes.join(" ")
    end

    def build_tag_options
      ops = {:class => build_class}
      ops.reverse_merge(options[:html_options])
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
twitter-bootstrap-markup-rails-0.3.2.2 lib/twitter-bootstrap-markup-rails/components/inline_label.rb
twitter-bootstrap-markup-rails-0.3.2.1 lib/twitter-bootstrap-markup-rails/components/inline_label.rb
twitter-bootstrap-markup-rails-0.3.2 lib/twitter-bootstrap-markup-rails/components/inline_label.rb
twitter-bootstrap-markup-rails-0.3.1 lib/twitter-bootstrap-markup-rails/components/inline_label.rb
twitter-bootstrap-markup-rails-0.3.0 lib/twitter-bootstrap-markup-rails/components/inline_label.rb