Module: ActiveadminSettings::PictureMethods
- Included in:
- Picture
- Defined in:
- app/models/activeadmin_settings/picture.rb
Class Method Summary collapse
Instance Method Summary collapse
- #as_json(options = nil) ⇒ Object
- #as_json_methods ⇒ Object
-
#has_dimensions? ⇒ Boolean
Helpers.
- #image ⇒ Object
- #image? ⇒ Boolean
- #thumb ⇒ Object
- #url ⇒ Object
Class Method Details
.included(base) ⇒ Object
4 5 6 7 |
# File 'app/models/activeadmin_settings/picture.rb', line 4 def self.included(base) # Features base.mount_uploader :data, ActiveadminSettings::RedactorPictureUploader end |
Instance Method Details
#as_json(options = nil) ⇒ Object
34 35 36 37 38 39 |
# File 'app/models/activeadmin_settings/picture.rb', line 34 def as_json( = nil) = { :methods => as_json_methods } super end |
#as_json_methods ⇒ Object
30 31 32 |
# File 'app/models/activeadmin_settings/picture.rb', line 30 def as_json_methods [:image, :thumb] end |
#has_dimensions? ⇒ Boolean
Helpers
10 11 12 |
# File 'app/models/activeadmin_settings/picture.rb', line 10 def has_dimensions? respond_to?(:width) && respond_to?(:height) end |
#image ⇒ Object
22 23 24 |
# File 'app/models/activeadmin_settings/picture.rb', line 22 def image url end |
#image? ⇒ Boolean
14 15 16 |
# File 'app/models/activeadmin_settings/picture.rb', line 14 def image? ActiveadminSettings::IMAGE_TYPES.include?(data_content_type) end |
#thumb ⇒ Object
26 27 28 |
# File 'app/models/activeadmin_settings/picture.rb', line 26 def thumb data.thumb.url end |
#url ⇒ Object
18 19 20 |
# File 'app/models/activeadmin_settings/picture.rb', line 18 def url data.url end |