Skip to content

Commit

Permalink
Merge tag '2023-08-10-01' into devpf
Browse files Browse the repository at this point in the history
  • Loading branch information
maatinito committed Dec 12, 2023
2 parents 441ff75 + 8996077 commit 815d182
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ fr:
other: "%{count} dossiers en cours de traitement portent ce champ. Les <strong>données</strong> associées avec ce champ seront <strong>supprimées</strong>."
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é.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
8 changes: 6 additions & 2 deletions app/controllers/champs/options_controller.rb
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions app/graphql/api/v2/stored_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ def self.get(query_id)
}
fragment DossierFragment on Dossier {
__typename
id
number
archived
Expand Down Expand Up @@ -463,6 +464,7 @@ def self.get(query_id)
__typename
label
stringValue
updatedAt
... on DateChamp {
date
}
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -643,6 +647,7 @@ def self.get(query_id)
fragment PageInfoFragment on PageInfo {
hasPreviousPage
hasNextPage
startCursor
endCursor
}
GRAPHQL
Expand Down
2 changes: 1 addition & 1 deletion app/graphql/extensions/attachment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions app/views/champs/options/remove.turbo_stream.haml
Original file line number Diff line number Diff line change
@@ -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 }
Original file line number Diff line number Diff line change
@@ -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 }
15 changes: 15 additions & 0 deletions app/views/shared/dossiers/_update_champs.turbo_stream.haml
Original file line number Diff line number Diff line change
@@ -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")
2 changes: 1 addition & 1 deletion app/views/user_mailer/invite_instructeur.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 1 addition & 14 deletions app/views/users/dossiers/update.turbo_stream.haml
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
30 changes: 15 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 815d182

Please sign in to comment.