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 abbfe84 commit cf4b4c8
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

Check warning on line 50 in app/components/referentiels/mapping_form_component.rb

View check run for this annotation

Codecov / codecov/patch

app/components/referentiels/mapping_form_component.rb#L41-L50

Added lines #L41 - L50 were not covered by tests

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

Check warning on line 48 in app/controllers/administrateurs/referentiels_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/administrateurs/referentiels_controller.rb#L41-L48

Added lines #L41 - L48 were not covered by tests

def prefill_and_visibility
end

Check warning on line 51 in app/controllers/administrateurs/referentiels_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/administrateurs/referentiels_controller.rb#L50-L51

Added lines #L50 - L51 were not covered by tests

private

Check warning on line 53 in app/controllers/administrateurs/referentiels_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/administrateurs/referentiels_controller.rb#L53

Added line #L53 was not covered by tests
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 cf4b4c8

Please sign in to comment.