Class: NfgUi::Components::Foundations::Image

Inherits:
Base show all
Includes:
Bootstrap::Utilities::Responsiveable, Bootstrap::Utilities::Tooltipable, Traits::Responsive
Defined in:
lib/nfg_ui/components/foundations/image.rb

Overview

Image doc coming soon

Direct Known Subclasses

Illustration

Constant Summary

Constants included from Traits::Responsive

Traits::Responsive::TRAITS

Constants included from Traits

Traits::REGISTERED_TRAITS, Traits::TRAIT_MODULES

Instance Attribute Summary

Attributes included from Bootstrap::Utilities::Disableable

#as

Attributes inherited from Bootstrap::Components::Base

#body, #options, #view_context

Instance Method Summary collapse

Methods included from Traits::Responsive

#responsive_trait

Methods included from Bootstrap::Utilities::Responsiveable

#responsive

Methods included from Bootstrap::Utilities::Tooltipable

#data, #disabled_component_tooltip_wrapper_html_options, #html_options, #tooltip

Methods included from Bootstrap::Utilities::Disableable

#disabled

Methods included from Utilities::Traitable

#traits, #utility_initialize

Methods included from Utilities::Renderable

#render_if, #render_unless

Methods included from Utilities::Describable

#data, #describe

Methods inherited from Bootstrap::Components::Base

#component_family, #data, #href, #html_options, #id, #initialize, #style

Constructor Details

This class inherits a constructor from NfgUi::Bootstrap::Components::Base

Instance Method Details

#imageObject

Prefer image, image is used on other components that pull in the image (e.g. Illustration)



15
16
17
# File 'lib/nfg_ui/components/foundations/image.rb', line 15

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

#renderObject



19
20
21
# File 'lib/nfg_ui/components/foundations/image.rb', line 19

def render
  image_tag(view_context.image_path(image_location), **html_options)
end

#srcObject

Allow :src to come through since :src is a native and viable to way source a image path / url



26
27
28
# File 'lib/nfg_ui/components/foundations/image.rb', line 26

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