Class: CafeCar::ActiveStorage::AttachmentPresenter
- Inherits:
-
Object
- Object
- CafeCar::ActiveStorage::AttachmentPresenter
show all
- Defined in:
- app/presenters/cafe_car/active_storage/attachment_presenter.rb
Instance Method Summary
collapse
Instance Method Details
#blank ⇒ Object
8
9
10
11
|
# File 'app/presenters/cafe_car/active_storage/attachment_presenter.rb', line 8
def blank = options[:blank]
|
#image ⇒ Object
14
15
16
|
# File 'app/presenters/cafe_car/active_storage/attachment_presenter.rb', line 14
def image
@template.image_tag url, **options, class: ui.class(:image, size) if url
end
|
#logo ⇒ Object
An attachment is its own logo — it renders as its own image. Keep the base
logo(*, **, &) signature so callers (e.g. the grid item's logo(href:))
don't hit an arity mismatch; the args aren't needed since we return self.
12
|
# File 'app/presenters/cafe_car/active_storage/attachment_presenter.rb', line 12
def logo(*, **, &) = self
|
#preview ⇒ Object
18
|
# File 'app/presenters/cafe_car/active_storage/attachment_presenter.rb', line 18
def preview = image || blank
|
#url ⇒ Object
def url = object.representation(resize_to_limit: [300, 300])&.processed&.url
7
|
# File 'app/presenters/cafe_car/active_storage/attachment_presenter.rb', line 7
def url = object.try(:url)
|