commit
04377fb429
22 changed files with 361 additions and 98 deletions
2
Gemfile
2
Gemfile
|
@ -19,7 +19,7 @@ gem 'daemons'
|
|||
gem 'deep_cloneable' # Enable deep clone of active record models
|
||||
gem 'delayed_cron_job' # Cron jobs
|
||||
gem 'delayed_job_active_record'
|
||||
gem 'delayed_job_web'
|
||||
gem 'delayed_job_web', '>= 1.4.4'
|
||||
gem 'devise' # Gestion des comptes utilisateurs
|
||||
gem 'devise-async'
|
||||
gem 'devise-i18n'
|
||||
|
|
|
@ -123,7 +123,7 @@ GEM
|
|||
babel-source (>= 4.0, < 6)
|
||||
execjs (~> 2.0)
|
||||
bcrypt (3.1.16)
|
||||
bindata (2.4.8)
|
||||
bindata (2.4.10)
|
||||
bindex (0.8.1)
|
||||
bootsnap (1.7.2)
|
||||
msgpack (~> 1.0)
|
||||
|
@ -195,7 +195,7 @@ GEM
|
|||
delayed_job_active_record (4.1.5)
|
||||
activerecord (>= 3.0, < 6.2)
|
||||
delayed_job (>= 3.0, < 5)
|
||||
delayed_job_web (1.4.3)
|
||||
delayed_job_web (1.4.4)
|
||||
activerecord (> 3.0.0)
|
||||
delayed_job (> 2.0.3)
|
||||
rack-protection (>= 1.5.5)
|
||||
|
@ -801,7 +801,7 @@ DEPENDENCIES
|
|||
deep_cloneable
|
||||
delayed_cron_job
|
||||
delayed_job_active_record
|
||||
delayed_job_web
|
||||
delayed_job_web (>= 1.4.4)
|
||||
devise
|
||||
devise-async
|
||||
devise-i18n
|
||||
|
|
|
@ -109,3 +109,15 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
ul.revision-changes {
|
||||
list-style: none;
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
|
||||
li {
|
||||
padding-top: 0.25 * $default-padding;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ module NewAdministrateur
|
|||
end
|
||||
|
||||
def apercu
|
||||
@dossier = procedure_without_control.new_dossier
|
||||
@dossier = procedure_without_control.draft_revision.new_dossier
|
||||
@tab = apercu_tab
|
||||
end
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ module Users
|
|||
end
|
||||
|
||||
def generate_empty_pdf(procedure)
|
||||
@dossier = procedure.new_dossier
|
||||
@dossier = procedure.active_revision.new_dossier
|
||||
s = render_to_string(template: 'dossiers/dossier_vide', formats: [:pdf])
|
||||
send_data(s, :filename => "#{procedure.libelle}.pdf")
|
||||
end
|
||||
|
|
|
@ -340,6 +340,67 @@ type DecimalNumberChamp implements Champ {
|
|||
value: Float
|
||||
}
|
||||
|
||||
"""
|
||||
Un dossier supprimé
|
||||
"""
|
||||
type DeletedDossier {
|
||||
"""
|
||||
Date de suppression.
|
||||
"""
|
||||
dateSupression: ISO8601DateTime!
|
||||
id: ID!
|
||||
|
||||
"""
|
||||
Le numéro du dossier qui a été supprimé.
|
||||
"""
|
||||
number: Int!
|
||||
|
||||
"""
|
||||
La raison de la suppression du dossier.
|
||||
"""
|
||||
reason: String!
|
||||
|
||||
"""
|
||||
L’état du dossier supprimé.
|
||||
"""
|
||||
state: DossierState!
|
||||
}
|
||||
|
||||
"""
|
||||
The connection type for DeletedDossier.
|
||||
"""
|
||||
type DeletedDossierConnection {
|
||||
"""
|
||||
A list of edges.
|
||||
"""
|
||||
edges: [DeletedDossierEdge]
|
||||
|
||||
"""
|
||||
A list of nodes.
|
||||
"""
|
||||
nodes: [DeletedDossier]
|
||||
|
||||
"""
|
||||
Information to aid in pagination.
|
||||
"""
|
||||
pageInfo: PageInfo!
|
||||
}
|
||||
|
||||
"""
|
||||
An edge in a connection.
|
||||
"""
|
||||
type DeletedDossierEdge {
|
||||
"""
|
||||
A cursor for use in pagination.
|
||||
"""
|
||||
cursor: String!
|
||||
|
||||
"""
|
||||
The item at the end of the edge.
|
||||
"""
|
||||
node: DeletedDossier
|
||||
}
|
||||
|
||||
interface Demandeur {
|
||||
id: ID!
|
||||
}
|
||||
|
@ -381,6 +442,41 @@ type Demarche {
|
|||
"""
|
||||
declarative: DossierDeclarativeState
|
||||
|
||||
"""
|
||||
Liste de tous les dossiers supprimés d’une démarche.
|
||||
"""
|
||||
deletedDossiers(
|
||||
"""
|
||||
Returns the elements in the list that come after the specified cursor.
|
||||
"""
|
||||
after: String
|
||||
|
||||
"""
|
||||
Returns the elements in the list that come before the specified cursor.
|
||||
"""
|
||||
before: String
|
||||
|
||||
"""
|
||||
Dossiers supprimés depuis la date.
|
||||
"""
|
||||
deletedSince: ISO8601DateTime
|
||||
|
||||
"""
|
||||
Returns the first _n_ elements from the list.
|
||||
"""
|
||||
first: Int
|
||||
|
||||
"""
|
||||
Returns the last _n_ elements from the list.
|
||||
"""
|
||||
last: Int
|
||||
|
||||
"""
|
||||
L’ordre des dossiers supprimés.
|
||||
"""
|
||||
order: Order = ASC
|
||||
): DeletedDossierConnection!
|
||||
|
||||
"""
|
||||
Description de la démarche.
|
||||
"""
|
||||
|
|
16
app/graphql/types/deleted_dossier_type.rb
Normal file
16
app/graphql/types/deleted_dossier_type.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
module Types
|
||||
class DeletedDossierType < Types::BaseObject
|
||||
description "Un dossier supprimé"
|
||||
|
||||
global_id_field :id
|
||||
field :number, Int, "Le numéro du dossier qui a été supprimé.", null: false, method: :dossier_id
|
||||
field :state, Types::DossierType::DossierState, "L’état du dossier supprimé.", null: false
|
||||
field :reason, String, "La raison de la suppression du dossier.", null: false
|
||||
|
||||
field :date_supression, GraphQL::Types::ISO8601DateTime, "Date de suppression.", null: false, method: :deleted_at
|
||||
|
||||
def self.authorized?(object, context)
|
||||
context.authorized_demarche?(object.procedure)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -43,6 +43,11 @@ module Types
|
|||
argument :min_revision, ID, required: false, description: "Seulement les dossiers pour les révisons après la révision donnée."
|
||||
end
|
||||
|
||||
field :deleted_dossiers, Types::DeletedDossierType.connection_type, "Liste de tous les dossiers supprimés d’une démarche.", null: false do
|
||||
argument :order, Types::Order, default_value: :asc, required: false, description: "L’ordre des dossiers supprimés."
|
||||
argument :deleted_since, GraphQL::Types::ISO8601DateTime, required: false, description: "Dossiers supprimés depuis la date."
|
||||
end
|
||||
|
||||
field :champ_descriptors, [Types::ChampDescriptorType], null: false, method: :types_de_champ
|
||||
field :annotation_descriptors, [Types::ChampDescriptorType], null: false, method: :types_de_champ_private
|
||||
|
||||
|
@ -102,6 +107,16 @@ module Types
|
|||
dossiers
|
||||
end
|
||||
|
||||
def deleted_dossiers(deleted_since: nil, order:)
|
||||
dossiers = object.deleted_dossiers
|
||||
|
||||
if deleted_since.present?
|
||||
dossiers = dossiers.deleted_since(deleted_since)
|
||||
end
|
||||
|
||||
dossiers.order(deleted_at: order)
|
||||
end
|
||||
|
||||
def self.authorized?(object, context)
|
||||
context.authorized_demarche?(object)
|
||||
end
|
||||
|
|
|
@ -36,29 +36,12 @@ class Champs::CarteChamp < Champ
|
|||
end
|
||||
end
|
||||
|
||||
def layer_enabled?(layer)
|
||||
type_de_champ.options && type_de_champ.options[layer] && type_de_champ.options[layer] != '0'
|
||||
end
|
||||
|
||||
def cadastres?
|
||||
layer_enabled?(:cadastres)
|
||||
type_de_champ.layer_enabled?(:cadastres)
|
||||
end
|
||||
|
||||
def optional_layers
|
||||
[
|
||||
:unesco,
|
||||
:arretes_protection,
|
||||
:conservatoire_littoral,
|
||||
:reserves_chasse_faune_sauvage,
|
||||
:reserves_biologiques,
|
||||
:reserves_naturelles,
|
||||
:natura_2000,
|
||||
:zones_humides,
|
||||
:znieff,
|
||||
:cadastres
|
||||
].filter_map do |layer|
|
||||
layer_enabled?(layer) ? layer : nil
|
||||
end
|
||||
type_de_champ.carte_optional_layers
|
||||
end
|
||||
|
||||
def render_options
|
||||
|
|
|
@ -20,6 +20,7 @@ class DeletedDossier < ApplicationRecord
|
|||
validates :dossier_id, uniqueness: true
|
||||
|
||||
scope :order_by_updated_at, -> (order = :desc) { order(created_at: order) }
|
||||
scope :deleted_since, -> (since) { where('deleted_dossiers.deleted_at >= ?', since) }
|
||||
|
||||
enum reason: {
|
||||
user_request: 'user_request',
|
||||
|
|
|
@ -361,21 +361,13 @@ class Procedure < ApplicationRecord
|
|||
end
|
||||
|
||||
def draft_changed?
|
||||
publiee? && published_revision.changed?(draft_revision)
|
||||
publiee? && published_revision.changed?(draft_revision) && revision_changes.present?
|
||||
end
|
||||
|
||||
def revision_changes
|
||||
published_revision.compare(draft_revision)
|
||||
end
|
||||
|
||||
def revision_types_de_champ_private_changes
|
||||
revision_changes.filter { |change| change[:private] }
|
||||
end
|
||||
|
||||
def revision_types_de_champ_changes
|
||||
revision_changes.filter { |change| !change[:private] }
|
||||
end
|
||||
|
||||
def accepts_new_dossiers?
|
||||
publiee? || brouillon?
|
||||
end
|
||||
|
@ -406,17 +398,6 @@ class Procedure < ApplicationRecord
|
|||
Flipper.enabled?(feature, self)
|
||||
end
|
||||
|
||||
# Warning: dossier after_save build_default_champs must be removed
|
||||
# to save a dossier created from this method
|
||||
def new_dossier
|
||||
Dossier.new(
|
||||
revision: active_revision,
|
||||
champs: active_revision.build_champs,
|
||||
champs_private: active_revision.build_champs_private,
|
||||
groupe_instructeur: defaut_groupe_instructeur
|
||||
)
|
||||
end
|
||||
|
||||
def path_customized?
|
||||
!path.match?(/[[:xdigit:]]{8}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{12}/)
|
||||
end
|
||||
|
|
|
@ -112,6 +112,15 @@ class ProcedureRevision < ApplicationRecord
|
|||
changes
|
||||
end
|
||||
|
||||
def new_dossier
|
||||
Dossier.new(
|
||||
revision: self,
|
||||
champs: build_champs,
|
||||
champs_private: build_champs_private,
|
||||
groupe_instructeur: procedure.defaut_groupe_instructeur
|
||||
)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def compare_types_de_champ(from_tdc, to_tdc)
|
||||
|
@ -207,6 +216,17 @@ class ProcedureRevision < ApplicationRecord
|
|||
to: to_type_de_champ.drop_down_list_options
|
||||
}
|
||||
end
|
||||
elsif to_type_de_champ.carte?
|
||||
if from_type_de_champ.carte_optional_layers != to_type_de_champ.carte_optional_layers
|
||||
changes << {
|
||||
op: :update,
|
||||
attribute: :carte_layers,
|
||||
label: from_type_de_champ.libelle,
|
||||
private: from_type_de_champ.private?,
|
||||
from: from_type_de_champ.carte_optional_layers,
|
||||
to: to_type_de_champ.carte_optional_layers
|
||||
}
|
||||
end
|
||||
elsif to_type_de_champ.piece_justificative?
|
||||
if from_type_de_champ.piece_justificative_template_checksum != to_type_de_champ.piece_justificative_template_checksum
|
||||
changes << {
|
||||
|
|
|
@ -206,6 +206,10 @@ class TypeDeChamp < ApplicationRecord
|
|||
type_champ == TypeDeChamp.type_champs.fetch(:titre_identite)
|
||||
end
|
||||
|
||||
def carte?
|
||||
type_champ == TypeDeChamp.type_champs.fetch(:carte)
|
||||
end
|
||||
|
||||
def public?
|
||||
!private?
|
||||
end
|
||||
|
@ -260,6 +264,16 @@ class TypeDeChamp < ApplicationRecord
|
|||
(drop_down_list_options - drop_down_list_disabled_options).reject(&:empty?)
|
||||
end
|
||||
|
||||
def layer_enabled?(layer)
|
||||
options && options[layer] && options[layer] != '0'
|
||||
end
|
||||
|
||||
def carte_optional_layers
|
||||
TypesDeChamp::CarteTypeDeChamp::LAYERS.filter_map do |layer|
|
||||
layer_enabled?(layer) ? layer : nil
|
||||
end.sort
|
||||
end
|
||||
|
||||
def to_typed_id
|
||||
GraphQL::Schema::UniqueWithinType.encode('Champ', stable_id)
|
||||
end
|
||||
|
@ -269,16 +283,7 @@ class TypeDeChamp < ApplicationRecord
|
|||
end
|
||||
|
||||
def editable_options
|
||||
options.slice(:cadastres,
|
||||
:unesco,
|
||||
:arretes_protection,
|
||||
:conservatoire_littoral,
|
||||
:reserves_chasse_faune_sauvage,
|
||||
:reserves_biologiques,
|
||||
:reserves_naturelles,
|
||||
:natura_2000,
|
||||
:zones_humides,
|
||||
:znieff)
|
||||
options.slice(*TypesDeChamp::CarteTypeDeChamp::LAYERS)
|
||||
end
|
||||
|
||||
FEATURE_FLAGS = {}
|
||||
|
|
|
@ -1,2 +1,14 @@
|
|||
class TypesDeChamp::CarteTypeDeChamp < TypesDeChamp::TypeDeChampBase
|
||||
LAYERS = [
|
||||
:unesco,
|
||||
:arretes_protection,
|
||||
:conservatoire_littoral,
|
||||
:reserves_chasse_faune_sauvage,
|
||||
:reserves_biologiques,
|
||||
:reserves_naturelles,
|
||||
:natura_2000,
|
||||
:zones_humides,
|
||||
:znieff,
|
||||
:cadastres
|
||||
]
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
%h2.card-title Publiez votre démarche
|
||||
= form_tag admin_procedure_publish_path(procedure_id: procedure.id), method: :put, class: 'form' do
|
||||
- if procedure.draft_changed?
|
||||
%p.mb-4 Publiez une nouvelle version de votre démarche. Les changements suivants seront appliqués :
|
||||
%p.mb-4 Publiez une nouvelle version de votre démarche. Les modifications suivantes seront appliquées :
|
||||
= render partial: 'revision_changes', locals: { changes: procedure.revision_changes }
|
||||
- else
|
||||
%p.mb-4 Publiez votre démarche, et partagez la à vos usagers. Aucune modification ne sera possible.
|
||||
|
|
|
@ -1,35 +1,48 @@
|
|||
%ul
|
||||
%ul.revision-changes
|
||||
- changes.each do |change|
|
||||
- postfix = change[:private] ? '_private' : ''
|
||||
- case change[:op]
|
||||
- when :add
|
||||
%li.mb-1= "Le champ « #{change[:label]} » a été ajouté."
|
||||
%li.mb-1= t("add#{postfix}", label: change[:label], scope: [:new_administrateur, :revision_changes])
|
||||
- when :remove
|
||||
%li.mb-1= "Le champ « #{change[:label]} » a été supprimé."
|
||||
%li.mb-1= t("remove#{postfix}", label: change[:label], scope: [:new_administrateur, :revision_changes])
|
||||
- when :update
|
||||
- case change[:attribute]
|
||||
- when :libelle
|
||||
%li.mb-1= "Le libellé du champ « #{change[:label]} » a changé en « #{change[:to]} »."
|
||||
%li.mb-1= t("update_libelle#{postfix}", label: change[:label], to: change[:to], scope: [:new_administrateur, :revision_changes])
|
||||
- when :type_champ
|
||||
%li.mb-1= "Le type du champ « #{change[:label]} » a changé. Il est maintenant de type « #{t("activerecord.attributes.type_de_champ.type_champs.#{change[:to]}")} »."
|
||||
%li.mb-1= t("update_type_champ#{postfix}", label: change[:label], to: t("activerecord.attributes.type_de_champ.type_champs.#{change[:to]}"), scope: [:new_administrateur, :revision_changes])
|
||||
- when :description
|
||||
%li.mb-1= "La description du champ « #{change[:label]} » a changé. La nouvelle description est « #{change[:to]} »."
|
||||
%li.mb-1= t("update_description#{postfix}", label: change[:label], to: change[:to], scope: [:new_administrateur, :revision_changes])
|
||||
- when :mandatory
|
||||
- if change[:from] == false
|
||||
%li.mb-1= "Le champ « #{change[:label]} » est maintenant obligatoire."
|
||||
%li.mb-1= t(:enabled, label: change[:label], scope: [:new_administrateur, :revision_changes, "update_mandatory#{postfix}"])
|
||||
- else
|
||||
%li.mb-1= "Le champ « #{change[:label]} » n'est plus obligatoire."
|
||||
%li.mb-1= t(:disabled, label: change[:label], scope: [:new_administrateur, :revision_changes, "update_mandatory#{postfix}"])
|
||||
- when :piece_justificative_template
|
||||
%li.mb-1= "Le champ « #{change[:label]} » a changé de modèle de pièce justificative."
|
||||
%li.mb-1= t("update_piece_justificative_template#{postfix}", label: change[:label], scope: [:new_administrateur, :revision_changes])
|
||||
- when :drop_down_options
|
||||
- added = change[:to].sort - change[:from].sort
|
||||
- removed = change[:from].sort - change[:to].sort
|
||||
%li.mb-1
|
||||
= "Les options de sélection du champ « #{change[:label]} » ont changé."
|
||||
= t("update_drop_down_options#{postfix}", label: change[:label], scope: [:new_administrateur, :revision_changes])
|
||||
%ul
|
||||
- if added.present?
|
||||
%li= "Valeurs ajoutés : #{added.map{ |term| "« #{term.strip} »" }.join(", ")}."
|
||||
%li= t(:add_option, items: added.map{ |term| "« #{term.strip} »" }.join(", "), scope: [:new_administrateur, :revision_changes])
|
||||
- if removed.present?
|
||||
%li= "Valeurs supprimés : #{removed.map{ |term| "« #{term.strip} »" }.join(", ")}."
|
||||
- move_changes = changes.filter { |change| change[:op] == :move }.size
|
||||
- if move_changes != 0
|
||||
%li.mb-1= t(:has_move_changes, count: move_changes, scope: [:new_administrateur, :revision_changes])
|
||||
%li= t(:remove_option, items: removed.map{ |term| "« #{term.strip} »" }.join(", "), scope: [:new_administrateur, :revision_changes])
|
||||
- when :carte_layers
|
||||
- added = change[:to].sort - change[:from].sort
|
||||
- removed = change[:from].sort - change[:to].sort
|
||||
%li.mb-1
|
||||
= t("update_carte_layers#{postfix}", label: change[:label], scope: [:new_administrateur, :revision_changes])
|
||||
%ul
|
||||
- if added.present?
|
||||
%li= t(:add_option, items: added.map{ |term| "« #{t(term, scope: [:new_administrateur, :carte_layers])} »" }.join(", "), scope: [:new_administrateur, :revision_changes])
|
||||
- if removed.present?
|
||||
%li= t(:remove_option, items: removed.map{ |term| "« #{t(term, scope: [:new_administrateur, :carte_layers])} »" }.join(", "), scope: [:new_administrateur, :revision_changes])
|
||||
- move_changes, move_private_changes = changes.filter { |change| change[:op] == :move }.partition { |change| !change[:private] }
|
||||
- if move_changes.size != 0
|
||||
%li.mb-1= t(:move, count: move_changes.size, scope: [:new_administrateur, :revision_changes])
|
||||
- if move_private_changes.size != 0
|
||||
%li.mb-1= t(:move_private, count: move_private_changes.size, scope: [:new_administrateur, :revision_changes])
|
||||
|
|
|
@ -33,22 +33,11 @@
|
|||
= link_to 'Publier les modifications', admin_procedure_publication_path(@procedure), class: 'button primary', id: 'publish-procedure-link', data: { disable_with: "Publication..." }
|
||||
|
||||
- if @procedure.draft_changed?
|
||||
- types_de_champ_changes = @procedure.revision_types_de_champ_changes
|
||||
- types_de_champ_private_changes = @procedure.revision_types_de_champ_private_changes
|
||||
|
||||
- if types_de_champ_changes.present?
|
||||
.container
|
||||
.card.featured
|
||||
.card-title
|
||||
= t(:has_changes, count: types_de_champ_changes.size, scope: [:new_administrateur, :revision_changes])
|
||||
= render partial: 'revision_changes', locals: { changes: types_de_champ_changes }
|
||||
|
||||
- if types_de_champ_private_changes.present?
|
||||
.container
|
||||
.card.featured
|
||||
.card-title
|
||||
= t(:has_private_changes, count: types_de_champ_private_changes.size, scope: [:new_administrateur, :revision_changes])
|
||||
= render partial: 'revision_changes', locals: { changes: types_de_champ_private_changes }
|
||||
= t(:has_changes, scope: [:new_administrateur, :revision_changes])
|
||||
= render partial: 'revision_changes', locals: { changes: @procedure.revision_changes }
|
||||
|
||||
.container
|
||||
%h2.procedure-admin-explanation Indispensable avant publication
|
||||
|
|
|
@ -27,13 +27,3 @@ fr:
|
|||
existing_groupe:
|
||||
one: "%{count} groupe existe"
|
||||
other: "%{count} groupes existent"
|
||||
revision_changes:
|
||||
has_changes:
|
||||
one: Un champ a été changé
|
||||
other: "%{count} champs ont été changés"
|
||||
has_private_changes:
|
||||
one: Une annotation privée a été changée
|
||||
other: "%{count} deux annotations privées ont été changées"
|
||||
has_move_changes:
|
||||
one: Un champ a changé de position
|
||||
other: "%{count} champs ont changé de position"
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
fr:
|
||||
new_administrateur:
|
||||
revision_changes:
|
||||
has_changes: Modifications en cours (appliqué à la prochaine publication)
|
||||
add: Le champ « %{label} » a été ajouté
|
||||
remove: Le champ « %{label} » a été supprimé
|
||||
move:
|
||||
one: La position d’un champ a été modifiée
|
||||
other: Les positions de %{count} champs ont été modifiées
|
||||
update_libelle: Le libellé du champ « %{label} » a été modifié. Le nouveau libellé est « %{to} »
|
||||
update_description: La description du champ « %{label} » a été modifiée. La nouvelle description est « %{to} »
|
||||
update_type_champ: Le type du champ « %{label} » a été modifié. Il est maintenant de type « %{to} »
|
||||
update_mandatory:
|
||||
enable: Le champ « %{label} » est maintenant obligatoire
|
||||
disable: Le champ « %{label} » n’est plus obligatoire
|
||||
update_piece_justificative_template: Le modèle de pièce justificative du champ « %{label} » a été modifié
|
||||
update_drop_down_options: Les options de sélection du champ « %{label} » ont été modifiées
|
||||
update_carte_layers: Les référentiels cartographiques du champ « %{label} » ont été modifiés
|
||||
add_private: L’annotation privée « %{label} » a été ajoutée
|
||||
remove_private: L’annotation privée « %{label} » a été supprimée
|
||||
move_private:
|
||||
one: La position d’une annotation privée a été modifiée
|
||||
other: Les positions de %{count} annotations privées ont été modifiées
|
||||
update_libelle_private: Le libellé de l’annotation privée « %{label} » a été modifié. Le nouveau libellé est « %{to} »
|
||||
update_description_private: La description de l’annotation privée « %{label} » a été modifiée. La nouvelle description est « %{to} »
|
||||
update_type_champ_private: Le type de l’annotation privée « %{label} » a été modifié. Elle est maintenant de type « %{to} »
|
||||
update_mandatory_private:
|
||||
enable: L’annotation privée « %{label} » est maintenant obligatoire
|
||||
disable: L’annotation privée « %{label} » n’est plus obligatoire
|
||||
update_piece_justificative_template_private: Le modèle de pièce justificative de l’annotation privée « %{label} » a été modifié
|
||||
update_drop_down_options_private: Les options de sélection de l’annotation privée « %{label} » ont été modifiées
|
||||
update_carte_layers_private: Les référentiels cartographiques de l’annotation privée « %{label} » ont été modifiés
|
||||
add_option: "ajoutés : %{items}"
|
||||
remove_option: "supprimés : %{items}"
|
||||
carte_layers:
|
||||
unesco: UNESCO
|
||||
arretes_protection: Arrêtés de protection
|
||||
conservatoire_littoral: Conservatoire du Littoral
|
||||
reserves_chasse_faune_sauvage: Réserves nationales de chasse et de faune sauvage
|
||||
reserves_biologiques: Réserves biologiques
|
||||
reserves_naturelles: Réserves naturelles
|
||||
natura_2000: Natura 2000
|
||||
zones_humides: Zones humides d’importance internationale
|
||||
znieff: ZNIEFF
|
||||
cadastres: Cadastre
|
|
@ -649,6 +649,44 @@ describe API::V2::GraphqlController do
|
|||
end
|
||||
end
|
||||
|
||||
context "deletedDossiers" do
|
||||
let(:query) do
|
||||
"{
|
||||
demarche(number: #{procedure.id}) {
|
||||
deletedDossiers {
|
||||
nodes {
|
||||
id
|
||||
number
|
||||
state
|
||||
reason
|
||||
dateSupression
|
||||
}
|
||||
}
|
||||
}
|
||||
}"
|
||||
end
|
||||
let(:deleted_dossier) { create(:deleted_dossier, procedure: procedure) }
|
||||
|
||||
before { deleted_dossier }
|
||||
|
||||
it "should be returned" do
|
||||
expect(gql_errors).to eq(nil)
|
||||
expect(gql_data).to eq(demarche: {
|
||||
deletedDossiers: {
|
||||
nodes: [
|
||||
{
|
||||
id: deleted_dossier.to_typed_id,
|
||||
number: deleted_dossier.dossier_id,
|
||||
state: deleted_dossier.state,
|
||||
reason: deleted_dossier.reason,
|
||||
dateSupression: deleted_dossier.deleted_at.iso8601
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
context "champ" do
|
||||
let(:champ) { create(:champ_piece_justificative, dossier: dossier) }
|
||||
let(:byte_size) { 2712286911 }
|
||||
|
|
|
@ -312,6 +312,53 @@ describe ProcedureRevision do
|
|||
to: ["one", "two"]
|
||||
}
|
||||
])
|
||||
|
||||
new_revision.find_or_clone_type_de_champ(new_revision.types_de_champ.last.types_de_champ.first.stable_id).update(type_champ: :carte)
|
||||
new_revision.find_or_clone_type_de_champ(new_revision.types_de_champ.last.types_de_champ.first.stable_id).update(options: { cadastres: true, znieff: true })
|
||||
expect(procedure.active_revision.compare(new_revision.reload)).to eq([
|
||||
{
|
||||
op: :remove,
|
||||
label: type_de_champ_first.libelle,
|
||||
private: false
|
||||
},
|
||||
{
|
||||
op: :add,
|
||||
label: "Un champ text",
|
||||
private: false
|
||||
},
|
||||
{
|
||||
op: :update,
|
||||
attribute: :description,
|
||||
label: type_de_champ_second.libelle,
|
||||
private: false,
|
||||
from: type_de_champ_second.description,
|
||||
to: "une description"
|
||||
},
|
||||
{
|
||||
op: :update,
|
||||
attribute: :mandatory,
|
||||
label: type_de_champ_second.libelle,
|
||||
private: false,
|
||||
from: false,
|
||||
to: true
|
||||
},
|
||||
{
|
||||
op: :update,
|
||||
attribute: :type_champ,
|
||||
label: "sub type de champ",
|
||||
private: false,
|
||||
from: "text",
|
||||
to: "carte"
|
||||
},
|
||||
{
|
||||
op: :update,
|
||||
attribute: :carte_layers,
|
||||
label: "sub type de champ",
|
||||
private: false,
|
||||
from: [],
|
||||
to: [:cadastres, :znieff]
|
||||
}
|
||||
])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -927,7 +927,7 @@ describe Procedure do
|
|||
])
|
||||
end
|
||||
|
||||
let(:dossier) { procedure.new_dossier }
|
||||
let(:dossier) { procedure.active_revision.new_dossier }
|
||||
|
||||
it { expect(dossier.procedure).to eq(procedure) }
|
||||
|
||||
|
|
Loading…
Reference in a new issue