Sha256: 1bf63b01bbc41c949a87625343559b14d96fa26a7d8fa4609b8175c04cb13361

Contents?: true

Size: 1.37 KB

Versions: 14

Compression:

Stored size: 1.37 KB

Contents

module UiBibz::Ui::Core

  # Create a Container
  #
  # 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+.
  # * +type+ - Symbol (:fluid)
  #
  # ==== Signatures
  #
  #   UiBibz::Ui::Core::Container.new(content, options = nil, html_options = nil)
  #
  #   UiBibz::Ui::Core::Container.new(options = nil, html_options = nil) do
  #     content
  #   end
  #
  # ==== Examples
  #
  #   UiBibz::Ui::Core::Container.new(content, { type: :fluid },{ class: 'test' }).render
  #
  #   UiBibz::Ui::Core::Container.new({ class: 'test' }) do
  #     content
  #   end.render
  #
  # ==== Helper
  #
  #   container(content, options = {}, html_options = {})
  #
  #   container(options = {}, html_options = {}) do
  #     content
  #   end
  #
  class Container < 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 :div, content, html_options
    end

  private

    def component_html_classes
      type
    end

    def type
      options[:type] == :fluid ? "container-fluid" : "container"
    end

  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
ui_bibz-2.0.0.alpha14 lib/ui_bibz/ui/core/layout/container.rb
ui_bibz-2.0.0.alpha13 lib/ui_bibz/ui/core/layout/container.rb
ui_bibz-2.0.0.alpha12 lib/ui_bibz/ui/core/layout/container.rb
ui_bibz-2.0.0.alpha11 lib/ui_bibz/ui/core/layout/container.rb
ui_bibz-2.0.0.alpha10 lib/ui_bibz/ui/core/layout/container.rb
ui_bibz-2.0.0.alpha9 lib/ui_bibz/ui/core/layout/container.rb
ui_bibz-2.0.0.alpha8 lib/ui_bibz/ui/core/layout/container.rb
ui_bibz-2.0.0.alpha7 lib/ui_bibz/ui/core/layout/container.rb
ui_bibz-2.0.0.alpha6 lib/ui_bibz/ui/core/layout/container.rb
ui_bibz-2.0.0.alpha5 lib/ui_bibz/ui/core/layout/container.rb
ui_bibz-2.0.0.alpha4 lib/ui_bibz/ui/core/layout/container.rb
ui_bibz-2.0.0.alpha3 lib/ui_bibz/ui/core/layout/container.rb
ui_bibz-2.0.0.alpha2 lib/ui_bibz/ui/core/layout/container.rb
ui_bibz-2.0.0.alpha lib/ui_bibz/ui/core/layout/container.rb