Sha256: 722dc0880ad8d4447e58e509571174d0da5ef019f5eac4f3c9ee0eae2ca546ab

Contents?: true

Size: 1.06 KB

Versions: 130

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

module NfgUi
  module Bootstrap
    module Components
      # Bootstrap Card Header
      # https://getbootstrap.com/docs/4.1/components/card/#header-and-footer
      class CardImageOverlay < NfgUi::Bootstrap::Components::Base
        include NfgUi::Components::Utilities::Titleable

        def component_family
          :card
        end

        def image
          options.fetch(:image, '')
        end

        def render
          capture do
            if image
              concat(NfgUi::Bootstrap::Components::CardImage.new({ image: image }, view_context).render)
            end

            concat(content_tag(:div, html_options) {
              capture do
                concat(content_tag(:h5, title, class: 'card-title')) if title
                concat(block_given? ? yield : body)
              end
            })
          end
        end

        private

        def component_css_class
          'card-img-overlay'
        end

        def non_html_attribute_options
          super.push(:image)
        end
      end
    end
  end
end

Version data entries

130 entries across 130 versions & 1 rubygems

Version Path
nfg_ui-6.17.2 lib/nfg_ui/bootstrap/components/card_image_overlay.rb
nfg_ui-6.17.1 lib/nfg_ui/bootstrap/components/card_image_overlay.rb
nfg_ui-6.17.0 lib/nfg_ui/bootstrap/components/card_image_overlay.rb
nfg_ui-6.16.3 lib/nfg_ui/bootstrap/components/card_image_overlay.rb
nfg_ui-6.16.2 lib/nfg_ui/bootstrap/components/card_image_overlay.rb
nfg_ui-6.16.1 lib/nfg_ui/bootstrap/components/card_image_overlay.rb
nfg_ui-6.16.0 lib/nfg_ui/bootstrap/components/card_image_overlay.rb
nfg_ui-5.15.7 lib/nfg_ui/bootstrap/components/card_image_overlay.rb
nfg_ui-5.15.6 lib/nfg_ui/bootstrap/components/card_image_overlay.rb
nfg_ui-5.15.5 lib/nfg_ui/bootstrap/components/card_image_overlay.rb
nfg_ui-5.15.4 lib/nfg_ui/bootstrap/components/card_image_overlay.rb
nfg_ui-5.15.3 lib/nfg_ui/bootstrap/components/card_image_overlay.rb
nfg_ui-0.15.2 lib/nfg_ui/bootstrap/components/card_image_overlay.rb
nfg_ui-0.15.1 lib/nfg_ui/bootstrap/components/card_image_overlay.rb
nfg_ui-0.15.0 lib/nfg_ui/bootstrap/components/card_image_overlay.rb
nfg_ui-0.14.7 lib/nfg_ui/bootstrap/components/card_image_overlay.rb
nfg_ui-0.14.6.3 lib/nfg_ui/bootstrap/components/card_image_overlay.rb
nfg_ui-0.14.6.2 lib/nfg_ui/bootstrap/components/card_image_overlay.rb
nfg_ui-0.14.6.1 lib/nfg_ui/bootstrap/components/card_image_overlay.rb
nfg_ui-0.14.6 lib/nfg_ui/bootstrap/components/card_image_overlay.rb