Class: CafeCar::ActiveStorage::AttachmentPresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/cafe_car/active_storage/attachment_presenter.rb

Instance Method Summary collapse

Instance Method Details

#blankObject



8
# File 'app/presenters/cafe_car/active_storage/attachment_presenter.rb', line 8

def blank = options[:blank]

#imageObject



11
12
13
# File 'app/presenters/cafe_car/active_storage/attachment_presenter.rb', line 11

def image
  @template.image_tag url, **options, class: ui.class(:image, size) if url
end

#logoObject



9
# File 'app/presenters/cafe_car/active_storage/attachment_presenter.rb', line 9

def  = self

#previewObject



15
# File 'app/presenters/cafe_car/active_storage/attachment_presenter.rb', line 15

def preview = image || blank

#urlObject

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)