Sha256: e65cef48ee984e96480d90e130361fdcb50dddd9fa1605f456f1c9cbd4f4d86e

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

module BootstrapIt
  #
  module ViewHelpers
    #
    # Text
    #
    # @author [alexiss]
    #
    class Text < WrapIt::Base
      include WrapIt::TextContainer
      after_initialize do
        @tag ||= @helper_name == 'text' ? 'p' : @helper_name
      end
    end

    #
    # Label
    #
    # @author [alexiss]
    #
    class Label < Text
      default_tag 'span'
      html_class 'label'
      html_class_prefix 'label-'
      enum :appearence, %i[default primary success info warning danger],
           default: :default, html_class: true
    end

    #
    # Badge
    #
    # @author [alexiss]
    #
    # TODO: right-alignment
    class Badge < Text
      default_tag 'span'
      html_class 'badge'
    end

    WrapIt.register :text, 'BootstrapIt::ViewHelpers::Text'
    WrapIt.register :p, 'BootstrapIt::ViewHelpers::Text'
    WrapIt.register :span, 'BootstrapIt::ViewHelpers::Text'
    WrapIt.register :label, 'BootstrapIt::ViewHelpers::Label'
    WrapIt.register :badge, 'BootstrapIt::ViewHelpers::Badge'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bootstrap_it-0.1.1 lib/bootstrap_it/view_helpers/text.rb
bootstrap_it-0.1.0 lib/bootstrap_it/view_helpers/text.rb