Class: Integral::PageDecorator
- Inherits:
-
BaseDecorator
- Object
- Draper::Decorator
- BaseDecorator
- Integral::PageDecorator
- Defined in:
- app/decorators/integral/page_decorator.rb
Overview
Page view-level logic
Instance Method Summary collapse
- #image_url(size: nil, transform: nil, fallback: true) ⇒ Object
-
#to_backend_card ⇒ Hash
The instance as a backend card.
Methods inherited from BaseDecorator
#activity_url, #backend_url, #edit_backend_url, #render_active_block_list
Instance Method Details
#image_url(size: nil, transform: nil, fallback: true) ⇒ Object
27 28 29 |
# File 'app/decorators/integral/page_decorator.rb', line 27 def image_url(size: nil, transform: nil, fallback: true) image_variant_url(image, size: size, transform: transform, fallback: fallback) end |
#to_backend_card ⇒ Hash
Returns the instance as a backend card.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/decorators/integral/page_decorator.rb', line 5 def to_backend_card attributes = [{ key: I18n.t('integral.records.attributes.status'), value: I18n.t("integral.records.status.#{status}") }] if Integral.multilingual_frontend? attributes += [{ key: I18n.t('integral.records.attributes.locale'), value: I18n.t("integral.language.#{locale}") }] end attributes += [ { key: I18n.t('integral.records.attributes.path'), value: path }, { key: I18n.t('integral.records.attributes.tag_list'), value: .join(', ') }, { key: I18n.t('integral.records.attributes.updated_at'), value: I18n.l(updated_at) }, { key: I18n.t('integral.records.attributes.created_at'), value: I18n.l(created_at) } ] image_url = object.image&.attached? ? app_url_helpers.url_for(image.) : nil { image: image_url, description: title, url: backend_url, attributes: attributes } end |