Sha256: 8cbb42b4e80df37ef677b60f3bd7c6d618354dd6ffe984f40ad13a3b9cf08783

Contents?: true

Size: 1.81 KB

Versions: 9

Compression:

Stored size: 1.81 KB

Contents

module UiBibz::Ui::Core::Buttons

  # Create a button link
  #
  # This element is an extend of UiBibz::Ui::Core::Buttons::Button.
  #
  # ==== 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::Buttons::ButtonLink.new(content, options = nil, html_options = nil)
  #
  #   UiBibz::Ui::Core::Buttons::ButtonLink.new(options = nil, html_options = nil) do
  #     content
  #   end
  #
  # ==== Examples
  #
  #   UiBibz::Ui::Core::Buttons::ButtonLink.new('test', type: :primary, url: '#')
  #
  #   UiBibz::Ui::Core::Buttons::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::Buttons::Button

    # See UiBibz::Ui::Core::Buttons::Button
    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

9 entries across 9 versions & 1 rubygems

Version Path
ui_bibz-2.0.0.alpha24 lib/ui_bibz/ui/core/buttons/button_link.rb
ui_bibz-2.0.0.alpha23 lib/ui_bibz/ui/core/buttons/button_link.rb
ui_bibz-2.0.0.alpha22 lib/ui_bibz/ui/core/buttons/button_link.rb
ui_bibz-2.0.0.alpha21 lib/ui_bibz/ui/core/buttons/button_link.rb
ui_bibz-2.0.0.alpha20 lib/ui_bibz/ui/core/buttons/button_link.rb
ui_bibz-2.0.0.alpha19 lib/ui_bibz/ui/core/buttons/button_link.rb
ui_bibz-2.0.0.alpha18 lib/ui_bibz/ui/core/buttons/button_link.rb
ui_bibz-2.0.0.alpha16 lib/ui_bibz/ui/core/buttons/button_link.rb
ui_bibz-2.0.0.alpha15 lib/ui_bibz/ui/core/buttons/button_link.rb