Sha256: 7f8945f936b98c8e9a17af33e011d67d93a083dd66a891fce6dcfbb8a20f70dc

Contents?: true

Size: 1.47 KB

Versions: 2

Compression:

Stored size: 1.47 KB

Contents

module UiBibz::Ui

  # Create a BreadcrumbLink
  #
  # This element is an extend of UiBibz::Ui::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+ - State of élement with symbol value:
  #   (+:active+)
  # * +url+ - String
  # * +glyph+ - Add glyph with name or hash options
  #   * +name+ - String
  #   * +size+ - Integer
  #   * +type+ - Symbol
  #
  # ==== Signatures
  #
  #   UiBibz::Ui::BreadcrumbLink.new(content, options = nil, html_options = nil)
  #
  #   UiBibz::Ui::BreadcrumbLink.new(options = nil, html_options = nil) do
  #     content
  #   end
  #
  # ==== Examples
  #
  #   UiBibz::Ui::BreadcrumbLink.new('Home', { glyph: 'home', status: :active },{ class: 'test' }).render
  #
  #   UiBibz::Ui::BreadcrumbLink.new({glyph: { name: 'eye', size: 3}, { class: 'test' }) do
  #     'Home'
  #   end.render
  #
  class BreadcrumbLink < Component

    def initialize content = nil, options = nil, html_options = nil, &block
      super
    end

    def render
      content_tag :li, link_html, class_and_html_options
    end

  private

    def link_html
      if @options[:url]
        link_to glyph_and_content_html, @options[:url], @options[:link_html_options]
      else
        glyph_and_content_html
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ui_bibz-1.0.0 lib/ui_bibz/ui/breadcrumb/components/breadcrumb_link.rb
ui_bibz-0.9.0 lib/ui_bibz/ui/breadcrumb/components/breadcrumb_link.rb