Class: PostIllustration
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- PostIllustration
- Includes:
- HasOwner
- Defined in:
- app/models/post_illustration.rb
Overview
Inline post illustration
Attributes:
agent_id [Agent], optional
created_at [DateTime]
image [SimpleImageUploader]
ip [Inet], optional
updated_at [DateTime]
user_id [User], optional
Class Method Summary collapse
Instance Method Summary collapse
-
#ckeditor_data ⇒ Object
Response data for CKEditor upload.
-
#editable_by?(user) ⇒ Boolean
deprecated
Deprecated.
use component handler
- #name ⇒ Object
Class Method Details
.ckeditor_upload!(parameters) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/models/post_illustration.rb', line 31 def self.ckeditor_upload!(parameters) entity = new(parameters) if entity.save entity.ckeditor_data else { uploaded: 0, error: 'Could not upload image' } end end |
.page_for_administration(page = 1) ⇒ Object
26 27 28 |
# File 'app/models/post_illustration.rb', line 26 def self.page_for_administration(page = 1) list_for_administration.page(page) end |
Instance Method Details
#ckeditor_data ⇒ Object
Response data for CKEditor upload
56 57 58 59 60 61 62 |
# File 'app/models/post_illustration.rb', line 56 def ckeditor_data { uploaded: 1, fileName: File.basename(image.path), url: image.hd_url } end |
#editable_by?(user) ⇒ Boolean
Deprecated.
use component handler
51 52 53 |
# File 'app/models/post_illustration.rb', line 51 def editable_by?(user) Biovision::Components::BaseComponent.handler('posts', user).editable?(self) end |
#name ⇒ Object
43 44 45 46 47 |
# File 'app/models/post_illustration.rb', line 43 def name return '—' if image.blank? CGI::unescape(File.basename(image.path)) end |