2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-08-01 10:58:41 +02:00
|
|
|
class ProceduresController < ApplicationController
|
|
|
|
before_action :retrieve_procedure
|
|
|
|
|
|
|
|
def logo
|
|
|
|
if @procedure.logo.attached?
|
2024-07-03 18:07:33 +02:00
|
|
|
logo_variant = @procedure.logo.variant(resize_to_limit: [400, 400])
|
|
|
|
if logo_variant.key.present?
|
|
|
|
redirect_to url_for(logo_variant.processed)
|
|
|
|
else
|
|
|
|
redirect_to url_for(@procedure.logo)
|
|
|
|
end
|
2023-08-01 10:58:41 +02:00
|
|
|
else
|
2023-08-23 12:14:10 +02:00
|
|
|
redirect_to ActionController::Base.helpers.image_url(PROCEDURE_DEFAULT_LOGO_SRC)
|
2023-08-01 10:58:41 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def retrieve_procedure
|
|
|
|
@procedure = Procedure.find(params[:id])
|
|
|
|
end
|
|
|
|
end
|