diff --git a/app/components/procedure/revision_changes_component/revision_changes_component.fr.yml b/app/components/procedure/revision_changes_component/revision_changes_component.fr.yml index d43071e9dc3..648e0c5b135 100644 --- a/app/components/procedure/revision_changes_component/revision_changes_component.fr.yml +++ b/app/components/procedure/revision_changes_component/revision_changes_component.fr.yml @@ -9,6 +9,7 @@ fr: other: "%{count} dossiers en cours de traitement portent ce champ. Les données associées avec ce champ seront supprimées." add_option: "ajoutés : %{items}" remove_option: "supprimés : %{items}" + invalid_routing_rules_alert: "Certains groupes d'instructeurs ont une règle de routage invalide. Veuillez mettre à jour la configuration des groupes d'instructeurs après avoir publié les modifications." public: add: Le champ « %{label} » a été ajouté. add_mandatory: Le champ obligatoire « %{label} » a été ajouté. diff --git a/app/components/procedure/revision_changes_component/revision_changes_component.html.haml b/app/components/procedure/revision_changes_component/revision_changes_component.html.haml index 3cbf2550558..ebb0d1cadb8 100644 --- a/app/components/procedure/revision_changes_component/revision_changes_component.html.haml +++ b/app/components/procedure/revision_changes_component/revision_changes_component.html.haml @@ -74,7 +74,7 @@ - if !total_dossiers.zero? && !change.can_rebase? .fr-alert.fr-alert--warning.fr-mt-1v %p= t('.breaking_change', count: total_dossiers) - - if removed.present? && change.type_de_champ.used_by_routing_rules? + - if (removed.present? || added.present? ) && change.type_de_champ.used_by_routing_rules? .fr-alert.fr-alert--warning.fr-mt-1v = t(".#{prefix}.update_drop_down_options_alert", label: change.label) - when :drop_down_other @@ -165,3 +165,7 @@ - if @private_move_changes.present? - list.with_item do = t(".private.move", count: @private_move_changes.size) + - if @previous_revision.procedure.groupe_instructeurs.any?(&:invalid_rule?) + - list.with_item do + .fr-alert.fr-alert--warning.fr-mt-1v + = t(".invalid_routing_rules_alert") diff --git a/app/controllers/champs/options_controller.rb b/app/controllers/champs/options_controller.rb index 4f55ce070b6..9629865a366 100644 --- a/app/controllers/champs/options_controller.rb +++ b/app/controllers/champs/options_controller.rb @@ -1,8 +1,12 @@ class Champs::OptionsController < ApplicationController + include TurboChampsConcern + before_action :authenticate_logged_user! def remove - @champ = policy_scope(Champ).includes(:champs).find(params[:champ_id]) - @champ.remove_option([params[:option]].compact) + champ = policy_scope(Champ).includes(:champs).find(params[:champ_id]) + champ.remove_option([params[:option]].compact) + champs = champ.private? ? champ.dossier.champs_private_all : champ.dossier.champs_public_all + @to_show, @to_hide, @to_update = champs_to_turbo_update({ params[:champ_id] => true }, champs) end end diff --git a/app/graphql/api/v2/stored_query.rb b/app/graphql/api/v2/stored_query.rb index 9111d77c0c7..5650db3fb2c 100644 --- a/app/graphql/api/v2/stored_query.rb +++ b/app/graphql/api/v2/stored_query.rb @@ -242,6 +242,7 @@ def self.get(query_id) } fragment DossierFragment on Dossier { + __typename id number archived @@ -463,6 +464,7 @@ def self.get(query_id) __typename label stringValue + updatedAt ... on DateChamp { date } @@ -592,11 +594,13 @@ def self.get(query_id) fragment FileFragment on File { + __typename filename contentType checksum byteSize: byteSizeBigInt url + createdAt } fragment AddressFragment on Address { @@ -643,6 +647,7 @@ def self.get(query_id) fragment PageInfoFragment on PageInfo { hasPreviousPage hasNextPage + startCursor endCursor } GRAPHQL diff --git a/app/graphql/extensions/attachment.rb b/app/graphql/extensions/attachment.rb index c0612d8fbdb..633d7a01133 100644 --- a/app/graphql/extensions/attachment.rb +++ b/app/graphql/extensions/attachment.rb @@ -35,7 +35,7 @@ def resolve(object:, **_rest) # is a lazy value (e.g., a Promise – like in our case) def after_resolve(value:, **_rest) if value.respond_to?(:map) - attachments = value.map { after_resolve_attachment(_1) } + attachments = value.map { after_resolve_attachment(_1) }.compact if options[:as] == :single attachments.first diff --git a/app/views/champs/options/remove.turbo_stream.haml b/app/views/champs/options/remove.turbo_stream.haml index b8c303ff193..679c610de07 100644 --- a/app/views/champs/options/remove.turbo_stream.haml +++ b/app/views/champs/options/remove.turbo_stream.haml @@ -1,3 +1 @@ -= fields_for @champ.input_name, @champ do |form| - = turbo_stream.replace @champ.input_group_id do - = render EditableChamp::EditableChampComponent.new champ: @champ, form: += render partial: 'shared/dossiers/update_champs', locals: { to_show: @to_show, to_hide: @to_hide, to_update: @to_update } diff --git a/app/views/instructeurs/dossiers/update_annotations.turbo_stream.haml b/app/views/instructeurs/dossiers/update_annotations.turbo_stream.haml index 83ca04a5dd1..679c610de07 100644 --- a/app/views/instructeurs/dossiers/update_annotations.turbo_stream.haml +++ b/app/views/instructeurs/dossiers/update_annotations.turbo_stream.haml @@ -1,8 +1 @@ -- if @to_show.present? - = turbo_stream.show_all(@to_show) -- if @to_hide.present? - = turbo_stream.hide_all(@to_hide) -- @to_update.each do |champ| - = fields_for champ.input_name, champ do |form| - = turbo_stream.replace champ.input_group_id do - = render EditableChamp::EditableChampComponent.new champ:, form: += render partial: 'shared/dossiers/update_champs', locals: { to_show: @to_show, to_hide: @to_hide, to_update: @to_update } diff --git a/app/views/shared/dossiers/_update_champs.turbo_stream.haml b/app/views/shared/dossiers/_update_champs.turbo_stream.haml new file mode 100644 index 00000000000..f3ce3e5f203 --- /dev/null +++ b/app/views/shared/dossiers/_update_champs.turbo_stream.haml @@ -0,0 +1,15 @@ +- if to_show.present? + = turbo_stream.show_all(to_show) +- if to_hide.present? + = turbo_stream.hide_all(to_hide) +- to_update.each do |champ| + = fields_for champ.input_name, champ do |form| + - if champ.refresh_after_update? + = turbo_stream.replace champ.input_group_id do + = render EditableChamp::EditableChampComponent.new champ:, form: + - else + = turbo_stream.update champ.labelledby_id do + = render EditableChamp::ChampLabelContentComponent.new champ:, form: + += turbo_stream.remove_all(".editable-champ .spinner-removable") += turbo_stream.hide_all(".editable-champ .spinner") diff --git a/app/views/user_mailer/invite_instructeur.html.haml b/app/views/user_mailer/invite_instructeur.html.haml index 2d597f427ce..996d00505a9 100644 --- a/app/views/user_mailer/invite_instructeur.html.haml +++ b/app/views/user_mailer/invite_instructeur.html.haml @@ -7,7 +7,7 @@ Vous venez d’être nommé instructeur sur #{APPLICATION_NAME}. %p - Votre compte a été créé pour l'adresse email #{@user.email}. Pour l’activer, je vous invite à cliquer sur le lien suivant :  + Votre compte a été créé pour l'adresse email #{@user.email}. Pour l’activer, nous vous invitons à cliquer sur le lien suivant :  = link_to(users_activate_url(token: @reset_password_token), users_activate_url(token: @reset_password_token)) %p diff --git a/app/views/users/dossiers/update.turbo_stream.haml b/app/views/users/dossiers/update.turbo_stream.haml index e998f507c1d..b7c234b2325 100644 --- a/app/views/users/dossiers/update.turbo_stream.haml +++ b/app/views/users/dossiers/update.turbo_stream.haml @@ -1,17 +1,4 @@ -- if @to_show.present? - = turbo_stream.show_all(@to_show) -- if @to_hide.present? - = turbo_stream.hide_all(@to_hide) -- @to_update.each do |champ| - = fields_for champ.input_name, champ do |form| - - if champ.refresh_after_update? - = turbo_stream.replace champ.input_group_id do - = render EditableChamp::EditableChampComponent.new champ:, form: - - else - = turbo_stream.update champ.labelledby_id do - = render EditableChamp::ChampLabelContentComponent.new champ:, form: += render partial: 'shared/dossiers/update_champs', locals: { to_show: @to_show, to_hide: @to_hide, to_update: @to_update, dossier: @dossier, annotation: false } -= turbo_stream.remove_all(".editable-champ .spinner-removable"); -= turbo_stream.hide_all(".editable-champ .spinner"); = turbo_stream.replace_all '.dossier-edit-sticky-footer' do = render Dossiers::EditFooterComponent.new(dossier: @dossier, annotation: false) diff --git a/package.json b/package.json index c45edfaf22d..71159b8c6e3 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "dependencies": { - "@coldwired/actions": "^0.11.0", - "@coldwired/turbo-stream": "^0.11.0", - "@coldwired/utils": "^0.10.0", + "@coldwired/actions": "^0.11.1", + "@coldwired/turbo-stream": "^0.11.1", + "@coldwired/utils": "^0.11.1", "@gouvfr/dsfr": "^1.7.2", "@graphiql/plugin-explorer": "^0.2.0", "@graphiql/toolkit": "^0.8.4", diff --git a/yarn.lock b/yarn.lock index a0d188b4b91..c470e449ac8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1173,28 +1173,28 @@ "@babel/helper-validator-identifier" "^7.19.1" to-fast-properties "^2.0.0" -"@coldwired/actions@^0.11.0": - version "0.11.0" - resolved "https://registry.yarnpkg.com/@coldwired/actions/-/actions-0.11.0.tgz#b50f833074ff4cd0b80afe022efb9c44b048b21a" - integrity sha512-IIF1fCCPWRywUfF1nG0QvOzjqKZWKBoniyS2qEJbejpE5FB17eohLIG4GZpkxFtzW+yb96ASRcqAFYcmMEjmYQ== +"@coldwired/actions@^0.11.1": + version "0.11.1" + resolved "https://registry.yarnpkg.com/@coldwired/actions/-/actions-0.11.1.tgz#1e2c387dcaadfd4d1d319a9611ab46695ad0726d" + integrity sha512-1KX5sjFCtOiLawxCUIq/oYboVE6t6ELKXJto+E7uMmERoHN/2lrr0JmmX5bIsjaHGeqTzZUweOa7Sp705kexIQ== dependencies: - "@coldwired/utils" "^0.10.0" + "@coldwired/utils" "^0.11.1" morphdom "^2.7.0" tiny-invariant "^1.3.1" -"@coldwired/turbo-stream@^0.11.0": - version "0.11.0" - resolved "https://registry.yarnpkg.com/@coldwired/turbo-stream/-/turbo-stream-0.11.0.tgz#fef5338cf95c5e331aa229c5edda92383bc6a05d" - integrity sha512-Ty1xvjBzqp9dXZfibH6mYTgESmccxe6utG9wZbla+GcsibgCDJJ7NWQEs13RNUhVeCeSRyDL8Ho//UpwqFUEHg== +"@coldwired/turbo-stream@^0.11.1": + version "0.11.1" + resolved "https://registry.yarnpkg.com/@coldwired/turbo-stream/-/turbo-stream-0.11.1.tgz#0f0f710422f61700cb8d8d8368799dbce64dd083" + integrity sha512-i8ubx6EeLAw84KGYxnxZUlEgVidBmAMCItZcgM3fpv9EN6f4tt3rc53sA+0wAECeZoP6FmqvkNxlPuFIMlBo3A== dependencies: - "@coldwired/actions" "^0.11.0" - "@coldwired/utils" "^0.10.0" + "@coldwired/actions" "^0.11.1" + "@coldwired/utils" "^0.11.1" tiny-invariant "^1.3.1" -"@coldwired/utils@^0.10.0": - version "0.10.0" - resolved "https://registry.yarnpkg.com/@coldwired/utils/-/utils-0.10.0.tgz#9d7fd3b3abc437db39abf714b263b55afa2fcc43" - integrity sha512-5rbSe+k60GgXb55uVvqloest7JWSdSIwRCSirs/u7JWWv6UP+UuYEYQjCpgQVTqBNwYMXiaB843VnWApxsf8oQ== +"@coldwired/utils@^0.11.1": + version "0.11.1" + resolved "https://registry.yarnpkg.com/@coldwired/utils/-/utils-0.11.1.tgz#d126246ab66591467e9e4c765769f133f6236ddb" + integrity sha512-vuW1hVhD5U4NX/0dl+fT4RL92T5fEITwc9l/DnaBoP5SAuCAVRnHCWcdyROGz55E4WvSXFqAHD6qkxRwOKG2og== "@emotion/is-prop-valid@^0.8.2": version "0.8.8"