Skip to content

Commit

Permalink
✨ Ajoute les zones de dépot dans l'admin
Browse files Browse the repository at this point in the history
  • Loading branch information
Guitguitou committed Sep 27, 2024
1 parent 5b36520 commit 811b979
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/admin/questions_glisser_deposer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

permit_params :libelle, :nom_technique, :description, :illustration, :supprimer_illustration,
:supprimer_audio_modalite_reponse, :supprimer_audio_intitule,
:zone_depot_url, :supprimer_zone_depot_url,
transcriptions_attributes: %i[id categorie ecrit audio _destroy],
reponses_attributes: %i[id illustration position type_choix position_client
nom_technique _destroy]
Expand Down
11 changes: 11 additions & 0 deletions app/views/admin/questions_glisser_deposer/_form.html.arb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ active_admin_form_for [:admin, resource] do |f|
f.input :nom_technique
f.input :description
render partial: 'admin/questions/input_illustration', locals: { f: f }
f.input :zones_depot_url,
as: :file,
hint: "L'un des éléments cliquables doit contenir la classe css `zone-depot` " \
'et la classe css `zone-depot--reponse.nom_technique`',
input_html: { accept: 'image/svg+xml', multiple: true }
if f.object.zones_depot_url.attached? && f.object.errors[:zones_depot_url].blank?
f.input :supprimer_zones_depot_url,
as: :boolean,
label: t('.label.supprimer_zones_depot_url'),
hint: svg_attachment_base64(resource.zones_depot_url, class: 'image-preview')
end
end
f.inputs do
render partial: 'admin/questions/inputs_avec_transcriptions_audios',
Expand Down
13 changes: 13 additions & 0 deletions app/views/admin/questions_glisser_deposer/_show.html.arb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@ panel 'Détails de la question' do
end
end
end
row :zones_depot_url do
if resource.zones_depot_url.attached?
ul do
resource.zones_depot_url.each do |file|
li do
link_to(cdn_for(file), target: '_blank', rel: 'noopener') do
svg_attachment_base64(file, class: 'image-preview')
end
end
end
end
end
end
intitule = question_glisser_deposer.transcription_intitule
row :intitule do
div intitule.ecrit if intitule&.ecrit
Expand Down

0 comments on commit 811b979

Please sign in to comment.