Sha256: d574c42fec459b91e65b3c9e74c5471762c92145566fd9f27f9eb122de1589d5

Contents?: true

Size: 1.56 KB

Versions: 10

Compression:

Stored size: 1.56 KB

Contents

module UiBibz::Ui::Core

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

10 entries across 10 versions & 1 rubygems

Version Path
ui_bibz-2.0.0.alpha10 lib/ui_bibz/ui/core/breadcrumb/components/breadcrumb_link.rb
ui_bibz-2.0.0.alpha9 lib/ui_bibz/ui/core/breadcrumb/components/breadcrumb_link.rb
ui_bibz-2.0.0.alpha8 lib/ui_bibz/ui/core/breadcrumb/components/breadcrumb_link.rb
ui_bibz-2.0.0.alpha7 lib/ui_bibz/ui/core/breadcrumb/components/breadcrumb_link.rb
ui_bibz-2.0.0.alpha6 lib/ui_bibz/ui/core/breadcrumb/components/breadcrumb_link.rb
ui_bibz-2.0.0.alpha5 lib/ui_bibz/ui/core/breadcrumb/components/breadcrumb_link.rb
ui_bibz-2.0.0.alpha4 lib/ui_bibz/ui/core/breadcrumb/components/breadcrumb_link.rb
ui_bibz-2.0.0.alpha3 lib/ui_bibz/ui/core/breadcrumb/components/breadcrumb_link.rb
ui_bibz-2.0.0.alpha2 lib/ui_bibz/ui/core/breadcrumb/components/breadcrumb_link.rb
ui_bibz-2.0.0.alpha lib/ui_bibz/ui/core/breadcrumb/components/breadcrumb_link.rb