Sha256: 15d0c29083713209c348a44eabb859077d33efe51cacbe9c8ac04ef0b2a1dca6

Contents?: true

Size: 1.75 KB

Versions: 4

Compression:

Stored size: 1.75 KB

Contents

module UiBibz::Ui::Core

  # Create a button link
  #
  # This element is an extend of UiBibz::Ui::Core::Component.
  #
  # ==== Attributes
  #
  # * +content+ - Content of element
  # * +options+ - Options of element
  # * +html_options+ - Html Options of element
  #
  # ==== Options
  #
  # You can add HTML attributes using the +html_options+.
  # You can pass arguments in options attribute:
  # * +status+ - status of élement with symbol value:
  #   (+:primary+, +:secondary+, +:info+, +:warning+, +:danger+)
  # * +size+
  #   (+:xs+, +:sm+, +:lg+)
  # * +url+ - String url
  # * +outline+ - Boolean
  # * +state+ - Symbol (+:active+, +:disabled)
  # * +type+ - Symbol (+:block)
  # * +glyph+ - Add glyph with name or hash options
  #   * +name+ - String
  #   * +size+ - Integer
  #   * +type+ - Symbol
  #
  # ==== Signatures
  #
  #   UiBibz::Ui::Core::ButtonLink.new(content, options = nil, html_options = nil)
  #
  #   UiBibz::Ui::Core::ButtonLink.new(options = nil, html_options = nil) do
  #     content
  #   end
  #
  # ==== Examples
  #
  #   UiBibz::Ui::Core::ButtonLink.new('test', type: :primary, url: '#')
  #
  #   UiBibz::Ui::Core::ButtonLink.new(type: :primary, url: '#') do
  #     test
  #   end.render
  #
  # ==== Helper
  #
  #   button_link(content, options = {}, html_options = {})
  #
  #   button_link(options = {}, html_options = {}) do
  #     content
  #   end
  #
  class ButtonLink < UiBibz::Ui::Core::Button

    # See UiBibz::Ui::Core::Component.initialize
    def initialize content = nil, options = nil, html_options = nil, &block
      super
    end

    # Render html tag
    def render
      link_to glyph_and_content_html, options[:url], html_options
    end

  private

    def component_html_classes
      ['btn', size, type]
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ui_bibz-2.0.0.alpha14 lib/ui_bibz/ui/core/button/button_link.rb
ui_bibz-2.0.0.alpha13 lib/ui_bibz/ui/core/button/button_link.rb
ui_bibz-2.0.0.alpha12 lib/ui_bibz/ui/core/button/button_link.rb
ui_bibz-2.0.0.alpha11 lib/ui_bibz/ui/core/button/button_link.rb