Compare commits
8 commits
main
...
gh-readonl
Author | SHA1 | Date | |
---|---|---|---|
|
8e54b6cd83 | ||
|
bef9d26fc2 | ||
|
0d624aee25 | ||
|
316ca7b3e8 | ||
|
e16de77418 | ||
|
9c695cf39f | ||
|
26798e8ed9 | ||
|
c2461f230c |
8 changed files with 72 additions and 21 deletions
|
@ -61,7 +61,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type='date'] {
|
input[type='date'] {
|
||||||
display: inline;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ class Procedure::RevisionChangesComponent < ApplicationComponent
|
||||||
@changes = changes
|
@changes = changes
|
||||||
@previous_revision = previous_revision
|
@previous_revision = previous_revision
|
||||||
@public_move_changes, @private_move_changes = changes.filter { _1.op == :move }.partition { !_1.private? }
|
@public_move_changes, @private_move_changes = changes.filter { _1.op == :move }.partition { !_1.private? }
|
||||||
|
@delete_champ_warning = !total_dossiers.zero? && !@changes.all?(&:can_rebase?)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -4,6 +4,9 @@ fr:
|
||||||
breaking_change:
|
breaking_change:
|
||||||
one: Un dossier en cours de traitement n’est pas compatible avec ce changement.
|
one: Un dossier en cours de traitement n’est pas compatible avec ce changement.
|
||||||
other: "%{count} dossiers en cours de traitement ne sont pas compatible avec ce changement."
|
other: "%{count} dossiers en cours de traitement ne sont pas compatible avec ce changement."
|
||||||
|
delete_champ_html:
|
||||||
|
one: "Un dossier en cours de traitement porte ce champ. Les données associées à ce champ seront supprimées."
|
||||||
|
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}"
|
add_option: "ajoutés : %{items}"
|
||||||
remove_option: "supprimés : %{items}"
|
remove_option: "supprimés : %{items}"
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -12,11 +12,14 @@
|
||||||
- else
|
- else
|
||||||
= t(".#{prefix}.add", label: change.label)
|
= t(".#{prefix}.add", label: change.label)
|
||||||
- if !total_dossiers.zero? && !change.can_rebase?
|
- if !total_dossiers.zero? && !change.can_rebase?
|
||||||
%strong
|
.fr-alert.fr-alert--warning.fr-mt-1v
|
||||||
= t('.breaking_change', count: total_dossiers)
|
%p= t('.breaking_change', count: total_dossiers)
|
||||||
- when :remove
|
- when :remove
|
||||||
- list.with_item do
|
- list.with_item do
|
||||||
= t(".#{prefix}.remove", label: change.label)
|
= t(".#{prefix}.remove", label: change.label)
|
||||||
|
- if @delete_champ_warning
|
||||||
|
.fr-alert.fr-alert--warning.fr-mt-1v
|
||||||
|
%p= t('.delete_champ_html', count: total_dossiers)
|
||||||
- when :update
|
- when :update
|
||||||
- case change.attribute
|
- case change.attribute
|
||||||
- when :libelle
|
- when :libelle
|
||||||
|
@ -26,8 +29,8 @@
|
||||||
- list.with_item do
|
- list.with_item do
|
||||||
= t(".#{prefix}.update_type_champ", label: change.label, to: t("activerecord.attributes.type_de_champ.type_champs.#{change.to}"))
|
= t(".#{prefix}.update_type_champ", label: change.label, to: t("activerecord.attributes.type_de_champ.type_champs.#{change.to}"))
|
||||||
- if !total_dossiers.zero? && !change.can_rebase?
|
- if !total_dossiers.zero? && !change.can_rebase?
|
||||||
%strong
|
.fr-alert.fr-alert--warning.fr-mt-1v
|
||||||
= t('.breaking_change', count: total_dossiers)
|
%p= t('.breaking_change', count: total_dossiers)
|
||||||
- when :description
|
- when :description
|
||||||
- list.with_item do
|
- list.with_item do
|
||||||
- if change.to.blank?
|
- if change.to.blank?
|
||||||
|
@ -45,14 +48,14 @@
|
||||||
- list.with_item do
|
- list.with_item do
|
||||||
= t(".public.enable_mandatory", label: change.label)
|
= t(".public.enable_mandatory", label: change.label)
|
||||||
- if !total_dossiers.zero? && !change.can_rebase?
|
- if !total_dossiers.zero? && !change.can_rebase?
|
||||||
%strong
|
.fr-alert.fr-alert--warning.fr-mt-1v
|
||||||
= t('.breaking_change', count: total_dossiers)
|
%p= t('.breaking_change', count: total_dossiers)
|
||||||
- else
|
- else
|
||||||
- list.with_item do
|
- list.with_item do
|
||||||
= t(".public.disable_mandatory", label: change.label)
|
= t(".public.disable_mandatory", label: change.label)
|
||||||
- if !total_dossiers.zero? && !change.can_rebase?
|
- if !total_dossiers.zero? && !change.can_rebase?
|
||||||
%strong
|
.fr-alert.fr-alert--warning.fr-mt-1v
|
||||||
= t('.breaking_change', count: total_dossiers)
|
%p= t('.breaking_change', count: total_dossiers)
|
||||||
- when :piece_justificative_template
|
- when :piece_justificative_template
|
||||||
- list.with_item do
|
- list.with_item do
|
||||||
= t(".#{prefix}.update_piece_justificative_template", label: change.label)
|
= t(".#{prefix}.update_piece_justificative_template", label: change.label)
|
||||||
|
@ -69,21 +72,21 @@
|
||||||
- list.with_item do
|
- list.with_item do
|
||||||
= t('.remove_option', items: removed.map{ |term| "« #{term.strip} »" }.join(", "))
|
= t('.remove_option', items: removed.map{ |term| "« #{term.strip} »" }.join(", "))
|
||||||
- if !total_dossiers.zero? && !change.can_rebase?
|
- if !total_dossiers.zero? && !change.can_rebase?
|
||||||
%strong
|
.fr-alert.fr-alert--warning.fr-mt-1v
|
||||||
= t('.breaking_change', count: total_dossiers)
|
%p= t('.breaking_change', count: total_dossiers)
|
||||||
- when :drop_down_other
|
- when :drop_down_other
|
||||||
- if change.from == false
|
- if change.from == false
|
||||||
- list.with_item do
|
- list.with_item do
|
||||||
= t(".#{prefix}.enable_drop_down_other", label: change.label)
|
= t(".#{prefix}.enable_drop_down_other", label: change.label)
|
||||||
- if !total_dossiers.zero? && !change.can_rebase?
|
- if !total_dossiers.zero? && !change.can_rebase?
|
||||||
%strong
|
.fr-alert.fr-alert--warning.fr-mt-1v
|
||||||
= t('.breaking_change', count: total_dossiers)
|
%p= t('.breaking_change', count: total_dossiers)
|
||||||
- else
|
- else
|
||||||
- list.with_item do
|
- list.with_item do
|
||||||
= t(".#{prefix}.disable_drop_down_other", label: change.label)
|
= t(".#{prefix}.disable_drop_down_other", label: change.label)
|
||||||
- if !total_dossiers.zero? && !change.can_rebase?
|
- if !total_dossiers.zero? && !change.can_rebase?
|
||||||
%strong
|
.fr-alert.fr-alert--warning.fr-mt-1v
|
||||||
= t('.breaking_change', count: total_dossiers)
|
%p= t('.breaking_change', count: total_dossiers)
|
||||||
- when :carte_layers
|
- when :carte_layers
|
||||||
- added = change.to.sort - change.from.sort
|
- added = change.to.sort - change.from.sort
|
||||||
- removed = change.from.sort - change.to.sort
|
- removed = change.from.sort - change.to.sort
|
||||||
|
@ -114,20 +117,20 @@
|
||||||
- list.with_item do
|
- list.with_item do
|
||||||
= t(".#{prefix}.add_condition", label: change.label, to: change.to)
|
= t(".#{prefix}.add_condition", label: change.label, to: change.to)
|
||||||
- if !total_dossiers.zero? && !change.can_rebase?
|
- if !total_dossiers.zero? && !change.can_rebase?
|
||||||
%strong
|
.fr-alert.fr-alert--warning.fr-mt-1v
|
||||||
= t('.breaking_change', count: total_dossiers)
|
%p= t('.breaking_change', count: total_dossiers)
|
||||||
- elsif change.to.nil?
|
- elsif change.to.nil?
|
||||||
- list.with_item do
|
- list.with_item do
|
||||||
= t(".#{prefix}.remove_condition", label: change.label)
|
= t(".#{prefix}.remove_condition", label: change.label)
|
||||||
- if !total_dossiers.zero? && !change.can_rebase?
|
- if !total_dossiers.zero? && !change.can_rebase?
|
||||||
%strong
|
.fr-alert.fr-alert--warning.fr-mt-1v
|
||||||
= t('.breaking_change', count: total_dossiers)
|
%p= t('.breaking_change', count: total_dossiers)
|
||||||
- else
|
- else
|
||||||
- list.with_item do
|
- list.with_item do
|
||||||
= t(".#{prefix}.update_condition", label: change.label, to: change.to)
|
= t(".#{prefix}.update_condition", label: change.label, to: change.to)
|
||||||
- if !total_dossiers.zero? && !change.can_rebase?
|
- if !total_dossiers.zero? && !change.can_rebase?
|
||||||
%strong
|
.fr-alert.fr-alert--warning.fr-mt-1v
|
||||||
= t('.breaking_change', count: total_dossiers)
|
%p= t('.breaking_change', count: total_dossiers)
|
||||||
|
|
||||||
- if @public_move_changes.present?
|
- if @public_move_changes.present?
|
||||||
- list.with_item do
|
- list.with_item do
|
||||||
|
|
|
@ -21,4 +21,11 @@
|
||||||
# type_de_champ_id :integer
|
# type_de_champ_id :integer
|
||||||
#
|
#
|
||||||
class Champs::EmailChamp < Champs::TextChamp
|
class Champs::EmailChamp < Champs::TextChamp
|
||||||
|
validates :value,
|
||||||
|
format: {
|
||||||
|
with: Devise.email_regexp,
|
||||||
|
message: I18n.t('invalid', scope: 'activerecord.errors.models.email_champ.attributes.value')
|
||||||
|
},
|
||||||
|
allow_nil: true,
|
||||||
|
if: -> { validation_context != :brouillon }
|
||||||
end
|
end
|
||||||
|
|
|
@ -561,6 +561,10 @@ en:
|
||||||
attributes:
|
attributes:
|
||||||
email:
|
email:
|
||||||
taken: ': Invitation already sent'
|
taken: ': Invitation already sent'
|
||||||
|
email_champ:
|
||||||
|
attributes:
|
||||||
|
value:
|
||||||
|
invalid: "is invalid. Fill in a valid email address, example: john.doe@example.fr"
|
||||||
|
|
||||||
user:
|
user:
|
||||||
attributes: &error_attributes
|
attributes: &error_attributes
|
||||||
|
|
|
@ -562,6 +562,10 @@ fr:
|
||||||
attributes:
|
attributes:
|
||||||
email:
|
email:
|
||||||
taken: ': Invitation déjà envoyée'
|
taken: ': Invitation déjà envoyée'
|
||||||
|
email_champ:
|
||||||
|
attributes:
|
||||||
|
value:
|
||||||
|
invalid: "est invalide. Saisir une adresse éléctronique valide, exemple : john.doe@exemple.fr"
|
||||||
user:
|
user:
|
||||||
attributes: &error_attributes
|
attributes: &error_attributes
|
||||||
reset_password_token:
|
reset_password_token:
|
||||||
|
|
29
spec/models/champs/email_champ_spec.rb
Normal file
29
spec/models/champs/email_champ_spec.rb
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
describe Champs::EmailChamp do
|
||||||
|
subject { build(:champ_email, value: value).tap(&:valid?) }
|
||||||
|
|
||||||
|
describe '#valid?' do
|
||||||
|
context 'when the value is an email' do
|
||||||
|
let(:value) { 'jean@dupont.fr' }
|
||||||
|
|
||||||
|
it { is_expected.to be_valid }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when the value is not an email' do
|
||||||
|
let(:value) { 'jean@' }
|
||||||
|
|
||||||
|
it { is_expected.to_not be_valid }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when the value is blank' do
|
||||||
|
let(:value) { '' }
|
||||||
|
|
||||||
|
it { is_expected.to_not be_valid }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when the value is nil' do
|
||||||
|
let(:value) { nil }
|
||||||
|
|
||||||
|
it { is_expected.to be_valid }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue