fix(champ): use public_id in views

This commit is contained in:
Paul Chavard 2024-03-21 12:01:55 +01:00
parent 15b5c5b6dd
commit 6ad0b901b6
10 changed files with 68 additions and 27 deletions

View file

@ -54,7 +54,7 @@ class Attachment::EditComponent < ApplicationComponent
end
def destroy_attachment_path
attachment_path(champ_id: champ&.id)
attachment_path(champ_id: champ&.public_id)
end
def attachment_input_class

View file

@ -35,7 +35,7 @@ class Attachment::MultipleComponent < ApplicationComponent
end
def empty_component_id
"attachment-multiple-empty-#{champ.id}"
"attachment-multiple-empty-#{champ.public_id}"
end
def auto_attach_url

View file

@ -2,20 +2,20 @@
.fr-fieldset__content
- @champ.enabled_non_empty_options.each_with_index do |option, index|
.fr-radio-group
= @form.radio_button :value, option, id: "#{@champ.id}_radio_option_#{index}"
%label.fr-label{ for: "#{@champ.id}_radio_option_#{index}" }
= @form.radio_button :value, option, id: dom_id(@champ, "radio_option_#{index}")
%label.fr-label{ for: dom_id(@champ, "radio_option_#{index}") }
= option
- if !@champ.mandatory?
.fr-radio-group
= @form.radio_button :value, '', checked: @champ.value.blank? && !@champ.other?, id: "#{@champ.id}_radio_option_blank"
%label.fr-label{ for: "#{@champ.id}_radio_option_blank" }
= @form.radio_button :value, '', checked: @champ.value.blank? && !@champ.other?, id: dom_id(@champ, "radio_option_blank")
%label.fr-label{ for: dom_id(@champ, "radio_option_blank") }
Non renseigné
- if @champ.drop_down_other?
.fr-radio-group
= @form.radio_button :value, Champs::DropDownListChamp::OTHER, checked: @champ.other?, id: "#{@champ.id}_radio_option_other"
%label.fr-label{ for: "#{@champ.id}_radio_option_other" }
= @form.radio_button :value, Champs::DropDownListChamp::OTHER, checked: @champ.other?, id: dom_id(@champ, "radio_option_other")
%label.fr-label{ for: dom_id(@champ, "radio_option_other") }
= t('shared.champs.drop_down_list.other')
- elsif @champ.render_as_combobox?
= render Dsfr::ComboboxComponent.new form: @form, options: @champ.enabled_non_empty_options(other: true), selected: @champ.selected, input_html_options: { name: :value, id: @champ.input_id, class: select_class_names, describedby: @champ.describedby_id }