Class: FlexiAdmin::Components::Resources::GridViewComponent::Element
- Inherits:
-
Struct
- Object
- Struct
- FlexiAdmin::Components::Resources::GridViewComponent::Element
- Includes:
- Helpers::UrlHelper
- Defined in:
- lib/flexi_admin/components/resources/grid_view_component.rb
Instance Attribute Summary collapse
-
#attribute ⇒ Object
Returns the value of attribute attribute.
-
#main_app ⇒ Object
Returns the value of attribute main_app.
-
#options ⇒ Object
Returns the value of attribute options.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
Instance Attribute Details
#attribute ⇒ Object
Returns the value of attribute attribute
11 12 13 |
# File 'lib/flexi_admin/components/resources/grid_view_component.rb', line 11 def attribute @attribute end |
#main_app ⇒ Object
Returns the value of attribute main_app
11 12 13 |
# File 'lib/flexi_admin/components/resources/grid_view_component.rb', line 11 def main_app @main_app end |
#options ⇒ Object
Returns the value of attribute options
11 12 13 |
# File 'lib/flexi_admin/components/resources/grid_view_component.rb', line 11 def @options end |
#value ⇒ Object
Returns the value of attribute value
11 12 13 |
# File 'lib/flexi_admin/components/resources/grid_view_component.rb', line 11 def value @value end |
Instance Method Details
#formatted_value(value) ⇒ Object
14 15 16 |
# File 'lib/flexi_admin/components/resources/grid_view_component.rb', line 14 def formatted_value(value) [:formatter].call(value) end |
#media_type(resource) ⇒ Object
28 29 30 |
# File 'lib/flexi_admin/components/resources/grid_view_component.rb', line 28 def media_type(resource) resource.media_type.to_s end |
#src(image, variant: nil) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/flexi_admin/components/resources/grid_view_component.rb', line 18 def src(image, variant: nil) raise "ActiveStorage::Attached::One required, got #{image.class}" if image.class != ActiveStorage::Attached::One return unless variant && image.attached? main_app.url_for(image.variant(variant)) rescue ActiveStorage::InvariableError main_app.url_for(image) end |