Sha256: 8a03639334b7088630abd2ef5af55d1d374d0293d4968c940a6ddb3adfc96446

Contents?: true

Size: 1.2 KB

Versions: 13

Compression:

Stored size: 1.2 KB

Contents

module UiBibz::Ui::Core

  # Create a card image
  #
  # ==== 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
  #   (+top+, +bottom+)
  #
  # ==== Signatures
  #
  #   UiBibz::Ui::Core::CardImage.new(content, options = nil, html_options = nil)
  #
  #   UiBibz::Ui::Core::CardImage.new(options = nil, html_options = nil) do
  #     content
  #   end
  #
  # ==== Examples
  #
  #   UiBibz::Ui::Core::CardImage.new.render
  #
  #   UiBibz::Ui::Core::CardImage.new do
  #     "/assets/images/test.png"
  #   end.render
  #
  class CardImage < Component

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

    # Render html tag
    def render
      image_tag asset_path("assets/#{content}"), html_options
    end

  private

    def component_html_classes
      position
    end

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

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

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