Sha256: 2472eeef48d21fdd148af08e7bcc0d9c4d92193cad28c4bcde7387ef3c5bf786

Contents?: true

Size: 1.3 KB

Versions: 1

Compression:

Stored size: 1.3 KB

Contents

module UiBibz::Ui::Core::Navigations

  # Create a NavbarText
  #
  # ==== 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:
  # * +position+ - Symbol
  #   (+:right+, +:left+)
  #
  # ==== Signatures
  #
  #   UiBibz::Ui::Core::Navigations::NavbarText.new(content, options = nil, html_options = nil)
  #
  #   UiBibz::Ui::Core::Navigations::NavbarText.new(options = nil, html_options = nil) do
  #     content
  #   end
  #
  # ==== Examples
  #
  #   UiBibz::Ui::Core::Navigations::NavbarText.new('Exemple).render
  #
  #   UiBibz::Ui::Core::Navigations::NavbarText.new(position: :right) do
  #     'Exemple'
  #   end.render
  #
  class NavbarText < 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 :span, content, html_options
    end

  private

    def component_html_classes
      ["navbar-text", position]
    end

    def position
      "navbar-#{ options[:position] }" unless options[:position].nil?
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ui_bibz-2.0.0.beta2.6 lib/ui_bibz/ui/core/navigations/components/navbar_text.rb