Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
mfo committed Jan 13, 2025
1 parent 38c660f commit c8575b1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions app/components/referentiels/mapping_form_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,12 @@ def cast_tag(jsonpath, value)
def prefill_tag(jsonpath)
attribute = "prefill"
current_value = lookup_existing_value(jsonpath, attribute) || false

check_box_tag "#{PREFIX}[#{attribute}]", "1", current_value, class: "fr-checkbox", data: { "action": "change->referentiel-mapping#onCheckboxChange" }
tag.div(class: "fr-checkbox-group") do
safe_join([
check_box_tag("#{PREFIX}[#{attribute}]", "1", current_value, class: "fr-checkbox", id: jsonpath.parameterize, data: { "action": "change->referentiel-mapping#onCheckboxChange" }),
tag.label(for: jsonpath.parameterize, class: "fr-label") { " ".html_safe }
])
end
end

def libelle_tag(jsonpath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
= hidden_field_tag "type_de_champ[referentiel_mapping][][jsonpath]", jsonpath
%td.fr-cell--multiline= example_value
%td= cast_tag(jsonpath, example_value)
%td= prefill_tag(jsonpath)
%td.text-center= prefill_tag(jsonpath)
%td= libelle_tag(jsonpath)
%ul.fr-btns-group.fr-btns-group--inline-sm
Expand Down
5 changes: 4 additions & 1 deletion app/controllers/administrateurs/referentiels_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ def update_mapping_type_de_champ
else
{ alert: "ko" }
end
redirect_to mapping_type_de_champ_admin_procedure_referentiel_path(@procedure, @type_de_champ.stable_id, @referentiel), flash:
redirect_to prefill_and_visibility_admin_procedure_referentiel_path(@procedure, @type_de_champ.stable_id, @referentiel), flash:
end

def prefill_and_visibility
end

private
Expand Down
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,7 @@
member do
get :mapping_type_de_champ
patch :update_mapping_type_de_champ
get :prefill_and_visibility
end
end

Expand Down

0 comments on commit c8575b1

Please sign in to comment.