Class: Integral::Image
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Integral::Image
- Defined in:
- app/models/integral/image.rb
Overview
Represents an image uploaded by a user
Class Method Summary collapse
-
.listable_options ⇒ Hash
Listable options to be used within a RecordSelector widget.
Instance Method Summary collapse
-
#dimensions ⇒ String
Represents the dimensions of the original image.
-
#to_list_item ⇒ Hash
The instance as a list item.
Class Method Details
.listable_options ⇒ Hash
Returns listable options to be used within a RecordSelector widget.
45 46 47 48 49 50 51 |
# File 'app/models/integral/image.rb', line 45 def self. { record_title: I18n.t('integral.backend.record_selector.images.record'), selector_path: Engine.routes.url_helpers.backend_images_path, selector_title: I18n.t('integral.backend.record_selector.images.title') } end |
Instance Method Details
#dimensions ⇒ String
Returns represents the dimensions of the original image.
29 30 31 |
# File 'app/models/integral/image.rb', line 29 def dimensions "#{width}x#{height}px" if width && height end |
#to_list_item ⇒ Hash
Returns the instance as a list item.
34 35 36 37 38 39 40 41 42 |
# File 'app/models/integral/image.rb', line 34 def to_list_item { id: id, title: title, subtitle: description, description: description, image: file } end |