2019-05-21 14:21:55 +02:00
|
|
|
class AttachmentsController < ApplicationController
|
|
|
|
before_action :authenticate_logged_user!
|
|
|
|
include ActiveStorage::SetBlob
|
|
|
|
|
|
|
|
def show
|
|
|
|
@attachment = @blob.attachments.find(params[:id])
|
|
|
|
@user_can_upload = params[:user_can_upload]
|
2020-04-08 17:53:04 +02:00
|
|
|
|
|
|
|
respond_to do |format|
|
2022-05-06 12:25:58 +02:00
|
|
|
format.turbo_stream
|
2020-04-08 18:07:28 +02:00
|
|
|
format.html { redirect_back(fallback_location: root_url) }
|
2020-04-08 17:53:04 +02:00
|
|
|
end
|
2019-05-21 14:21:55 +02:00
|
|
|
end
|
2019-05-29 12:05:28 +02:00
|
|
|
|
|
|
|
def destroy
|
2022-05-06 12:25:58 +02:00
|
|
|
@attachment = @blob.attachments.find(params[:id])
|
|
|
|
@attachment.purge_later
|
|
|
|
flash.notice = 'La pièce jointe a bien été supprimée.'
|
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
format.turbo_stream
|
|
|
|
format.html { redirect_back(fallback_location: root_url) }
|
|
|
|
end
|
2019-05-29 12:05:28 +02:00
|
|
|
end
|
2019-05-21 14:21:55 +02:00
|
|
|
end
|