Class: PrometheeController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- PrometheeController
- Defined in:
- app/controllers/promethee_controller.rb
Instance Method Summary collapse
Instance Method Details
#blob_create ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'app/controllers/promethee_controller.rb', line 10 def blob_create io = params[:file].to_io filename = params[:file].original_filename content_type = params[:file].content_type blob_create_method = ActiveStorage::Blob.respond_to?(:create_and_upload!) ? :create_and_upload! : :create_after_upload! blob = ActiveStorage::Blob.public_send(blob_create_method, io: io, filename: filename, content_type: content_type) render json: { id: blob.signed_id, name: filename } end |
#blob_show ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/promethee_controller.rb', line 19 def blob_show # as this is called only from promethee preview it sends an image resized to 720 begin blob_find_method = ActiveStorage::Blob.respond_to?(:find_signed!) ? :find_signed! : :find_signed blob = ActiveStorage::Blob.public_send(blob_find_method, params[:id]) rescue raise ActiveRecord::RecordNotFound end if blob.image? && blob.variable? redirect_to url_for(blob.variant(resize: '720>')) elsif blob.video? redirect_to url_for(blob.preview(resize: '720>')) else redirect_to url_for(blob) end end |
#preview ⇒ Object
5 6 7 8 |
# File 'app/controllers/promethee_controller.rb', line 5 def preview @data = params[:data] render 'preview', layout: params[:preview_layout] if params.include? :preview_layout end |