Sha256: 79a91941641278162bce44dd1eb974a26da9fa6c5c0a3d8d4d029ac17069e0ca

Contents?: true

Size: 1.75 KB

Versions: 13

Compression:

Stored size: 1.75 KB

Contents

module UiBibz::Ui::Core::Paths::Components

  # Create a BreadcrumbLink
  #
  # 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:
  # * +state+ - status 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::Core::Breadcrumb::Components::BreadcrumbLink.new(content, options = nil, html_options = nil)
  #
  #   UiBibz::Ui::Core::Breadcrumb::Components::BreadcrumbLink.new(options = nil, html_options = nil) do
  #     content
  #   end
  #
  # ==== Examples
  #
  #   UiBibz::Ui::Core::Breadcrumb::Components::BreadcrumbLink.new('Home', { glyph: 'home', state: :active },{ class: 'test' }).render
  #
  #   UiBibz::Ui::Core::Breadcrumb::Components::BreadcrumbLink.new({glyph: { name: 'eye', size: 3}, { class: 'test' }) do
  #     'Home'
  #   end.render
  #
  class BreadcrumbLink < UiBibz::Ui::Core::Component

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

    # Render html tag
    def render
      content_tag :li, link_html, html_options
    end

  private

    def component_html_classes
      "breadcrumb-item"
    end

    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

13 entries across 13 versions & 1 rubygems

Version Path
ui_bibz-2.0.0.beta2.5 lib/ui_bibz/ui/core/paths/components/breadcrumb_link.rb
ui_bibz-2.0.0.beta2.4 lib/ui_bibz/ui/core/paths/components/breadcrumb_link.rb
ui_bibz-2.0.0.beta2.3 lib/ui_bibz/ui/core/paths/components/breadcrumb_link.rb
ui_bibz-2.0.0.beta2.2 lib/ui_bibz/ui/core/paths/components/breadcrumb_link.rb
ui_bibz-2.0.0.beta2.1 lib/ui_bibz/ui/core/paths/components/breadcrumb_link.rb
ui_bibz-2.0.0.beta2 lib/ui_bibz/ui/core/paths/components/breadcrumb_link.rb
ui_bibz-2.0.0.alpha32 lib/ui_bibz/ui/core/paths/components/breadcrumb_link.rb
ui_bibz-2.0.0.alpha31 lib/ui_bibz/ui/core/paths/components/breadcrumb_link.rb
ui_bibz-2.0.0.alpha30 lib/ui_bibz/ui/core/paths/components/breadcrumb_link.rb
ui_bibz-2.0.0.alpha29 lib/ui_bibz/ui/core/paths/components/breadcrumb_link.rb
ui_bibz-2.0.0.alpha28 lib/ui_bibz/ui/core/paths/components/breadcrumb_link.rb
ui_bibz-2.0.0.alpha27 lib/ui_bibz/ui/core/paths/components/breadcrumb_link.rb
ui_bibz-2.0.0.alpha26 lib/ui_bibz/ui/core/paths/components/breadcrumb_link.rb