commit
2400d094de
12 changed files with 41 additions and 82 deletions
|
@ -34,6 +34,7 @@ module CreateAvisConcern
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
dossier.avis.reload # unload non-persisted avis from dossier
|
||||||
|
|
||||||
persisted, failed = create_results.partition(&:persisted?)
|
persisted, failed = create_results.partition(&:persisted?)
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ class Champ < ApplicationRecord
|
||||||
:repetition?,
|
:repetition?,
|
||||||
:dossier_link?,
|
:dossier_link?,
|
||||||
:titre_identite?,
|
:titre_identite?,
|
||||||
|
:header_section?,
|
||||||
to: :type_de_champ
|
to: :type_de_champ
|
||||||
|
|
||||||
scope :updated_since?, -> (date) { where('champs.updated_at > ?', date) }
|
scope :updated_since?, -> (date) { where('champs.updated_at > ?', date) }
|
||||||
|
@ -86,6 +87,10 @@ class Champ < ApplicationRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def sections
|
||||||
|
siblings.filter(&:header_section?)
|
||||||
|
end
|
||||||
|
|
||||||
def mandatory_and_blank?
|
def mandatory_and_blank?
|
||||||
mandatory? && blank?
|
mandatory? && blank?
|
||||||
end
|
end
|
||||||
|
|
|
@ -22,9 +22,19 @@ class Champs::HeaderSectionChamp < Champ
|
||||||
# The user cannot enter any information here so it doesn’t make much sense to search
|
# The user cannot enter any information here so it doesn’t make much sense to search
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def libelle_with_section_index
|
||||||
|
if sections.none?(&:libelle_with_section_index?)
|
||||||
|
"#{section_index}. #{libelle}"
|
||||||
|
else
|
||||||
|
libelle
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def libelle_with_section_index?
|
||||||
|
libelle =~ /^\d/
|
||||||
|
end
|
||||||
|
|
||||||
def section_index
|
def section_index
|
||||||
siblings
|
sections.index(self) + 1
|
||||||
.filter { |c| c.type_champ == TypeDeChamp.type_champs.fetch(:header_section) }
|
|
||||||
.index(self) + 1
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -174,6 +174,10 @@ class TypeDeChamp < ApplicationRecord
|
||||||
])
|
])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def header_section?
|
||||||
|
type_champ == TypeDeChamp.type_champs.fetch(:header_section)
|
||||||
|
end
|
||||||
|
|
||||||
def linked_drop_down_list?
|
def linked_drop_down_list?
|
||||||
type_champ == TypeDeChamp.type_champs.fetch(:linked_drop_down_list)
|
type_champ == TypeDeChamp.type_champs.fetch(:linked_drop_down_list)
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
.col-xs-6
|
.col-xs-6
|
||||||
%h3 Ajouter un instructeur
|
%h3 Ajouter un instructeur
|
||||||
#procedure_new.section.section-label
|
#procedure_new.section.section-label
|
||||||
= form_with url: { controller: 'admin/instructeurs', action: :create }, local: true do
|
= form_with url: { controller: 'admin/instructeurs', action: :create } do
|
||||||
.row
|
.row
|
||||||
.col-xs-5
|
.col-xs-5
|
||||||
= render partial: 'admin/instructeurs/informations'
|
= render partial: 'admin/instructeurs/informations'
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
.container
|
.container
|
||||||
%h1
|
%h1
|
||||||
= form_with model: @procedure, url: url_for({ controller: 'new_administrateur/procedures', action: :update_jeton }), local: true, html: { class: 'form' } do |f|
|
= form_with model: @procedure, url: url_for({ controller: 'new_administrateur/procedures', action: :update_jeton }), html: { class: 'form' } do |f|
|
||||||
%p.explication
|
%p.explication
|
||||||
Démarches Simplifiées utilise
|
Démarches Simplifiées utilise
|
||||||
= link_to 'API Entreprise', "https://entreprise.api.gouv.fr/"
|
= link_to 'API Entreprise', "https://entreprise.api.gouv.fr/"
|
||||||
|
|
|
@ -1,5 +1,2 @@
|
||||||
%h2.header-section
|
%h2.header-section
|
||||||
- libelle_starts_with_number = (champ.libelle =~ /^\d/)
|
= champ.libelle_with_section_index
|
||||||
- if !libelle_starts_with_number
|
|
||||||
= "#{champ.section_index}."
|
|
||||||
= champ.libelle
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ Dotenv::Railtie.load
|
||||||
module TPS
|
module TPS
|
||||||
class Application < Rails::Application
|
class Application < Rails::Application
|
||||||
# Initialize configuration defaults for originally generated Rails version.
|
# Initialize configuration defaults for originally generated Rails version.
|
||||||
config.load_defaults 6.0
|
config.load_defaults 6.1
|
||||||
|
|
||||||
# Configuration for the application, engines, and railties goes here.
|
# Configuration for the application, engines, and railties goes here.
|
||||||
#
|
#
|
||||||
|
@ -65,6 +65,12 @@ module TPS
|
||||||
# disable the check performed by Rails.
|
# disable the check performed by Rails.
|
||||||
config.action_dispatch.ip_spoofing_check = false
|
config.action_dispatch.ip_spoofing_check = false
|
||||||
|
|
||||||
|
# Set the queue name for the mail delivery jobs to 'mailers'
|
||||||
|
config.action_mailer.deliver_later_queue_name = :mailers
|
||||||
|
|
||||||
|
# Set the queue name for the analysis jobs to 'active_storage_analysis'
|
||||||
|
config.active_storage.queues.analysis = :active_storage_analysis
|
||||||
|
|
||||||
config.to_prepare do
|
config.to_prepare do
|
||||||
# Make main application helpers available in administrate
|
# Make main application helpers available in administrate
|
||||||
Administrate::ApplicationController.helper(TPS::Application.helpers)
|
Administrate::ApplicationController.helper(TPS::Application.helpers)
|
||||||
|
|
|
@ -35,6 +35,9 @@ DS_ENV="staging"
|
||||||
# Personnalisation d'instance - URL du site web FAQ
|
# Personnalisation d'instance - URL du site web FAQ
|
||||||
# FAQ_URL="https://faq.demarches-simplifiees.fr"
|
# FAQ_URL="https://faq.demarches-simplifiees.fr"
|
||||||
|
|
||||||
|
# Personnalisation d'instance - URL de la déclaration d'accessibilité
|
||||||
|
# ACCESSIBILITE_URL=""
|
||||||
|
|
||||||
# Personnalisation d'instance - Page externe "Disponibilité" (status page)
|
# Personnalisation d'instance - Page externe "Disponibilité" (status page)
|
||||||
# STATUS_PAGE_URL=""
|
# STATUS_PAGE_URL=""
|
||||||
|
|
||||||
|
|
|
@ -1,67 +0,0 @@
|
||||||
# Be sure to restart your server when you modify this file.
|
|
||||||
#
|
|
||||||
# This file contains migration options to ease your Rails 6.1 upgrade.
|
|
||||||
#
|
|
||||||
# Once upgraded flip defaults one by one to migrate to the new default.
|
|
||||||
#
|
|
||||||
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
|
|
||||||
|
|
||||||
# Support for inversing belongs_to -> has_many Active Record associations.
|
|
||||||
# Rails.application.config.active_record.has_many_inversing = true
|
|
||||||
|
|
||||||
# Track Active Storage variants in the database.
|
|
||||||
# Rails.application.config.active_storage.track_variants = true
|
|
||||||
|
|
||||||
# Apply random variation to the delay when retrying failed jobs.
|
|
||||||
# Rails.application.config.active_job.retry_jitter = 0.15
|
|
||||||
|
|
||||||
# Stop executing `after_enqueue`/`after_perform` callbacks if
|
|
||||||
# `before_enqueue`/`before_perform` respectively halts with `throw :abort`.
|
|
||||||
# Rails.application.config.active_job.skip_after_callbacks_if_terminated = true
|
|
||||||
|
|
||||||
# Specify cookies SameSite protection level: either :none, :lax, or :strict.
|
|
||||||
#
|
|
||||||
# This change is not backwards compatible with earlier Rails versions.
|
|
||||||
# It's best enabled when your entire app is migrated and stable on 6.1.
|
|
||||||
# Rails.application.config.action_dispatch.cookies_same_site_protection = :lax
|
|
||||||
|
|
||||||
# Generate CSRF tokens that are encoded in URL-safe Base64.
|
|
||||||
#
|
|
||||||
# This change is not backwards compatible with earlier Rails versions.
|
|
||||||
# It's best enabled when your entire app is migrated and stable on 6.1.
|
|
||||||
# Rails.application.config.action_controller.urlsafe_csrf_tokens = true
|
|
||||||
|
|
||||||
# Specify whether `ActiveSupport::TimeZone.utc_to_local` returns a time with an
|
|
||||||
# UTC offset or a UTC time.
|
|
||||||
# ActiveSupport.utc_to_local_returns_utc_offset_times = true
|
|
||||||
|
|
||||||
# Change the default HTTP status code to `308` when redirecting non-GET/HEAD
|
|
||||||
# requests to HTTPS in `ActionDispatch::SSL` middleware.
|
|
||||||
# Rails.application.config.action_dispatch.ssl_default_redirect_status = 308
|
|
||||||
|
|
||||||
# Use new connection handling API. For most applications this won't have any
|
|
||||||
# effect. For applications using multiple databases, this new API provides
|
|
||||||
# support for granular connection swapping.
|
|
||||||
# Rails.application.config.active_record.legacy_connection_handling = false
|
|
||||||
|
|
||||||
# Make `form_with` generate non-remote forms by default.
|
|
||||||
# Rails.application.config.action_view.form_with_generates_remote_forms = false
|
|
||||||
|
|
||||||
# Set the default queue name for the analysis job to the queue adapter default.
|
|
||||||
# Rails.application.config.active_storage.queues.analysis = nil
|
|
||||||
|
|
||||||
# Set the default queue name for the purge job to the queue adapter default.
|
|
||||||
# Rails.application.config.active_storage.queues.purge = nil
|
|
||||||
|
|
||||||
# Set the default queue name for the incineration job to the queue adapter default.
|
|
||||||
# Rails.application.config.action_mailbox.queues.incineration = nil
|
|
||||||
|
|
||||||
# Set the default queue name for the routing job to the queue adapter default.
|
|
||||||
# Rails.application.config.action_mailbox.queues.routing = nil
|
|
||||||
|
|
||||||
# Set the default queue name for the mail deliver job to the queue adapter default.
|
|
||||||
# Rails.application.config.action_mailer.deliver_later_queue_name = nil
|
|
||||||
|
|
||||||
# Generate a `Link` header that gives a hint to modern browsers about
|
|
||||||
# preloading assets when using `javascript_include_tag` and `stylesheet_link_tag`.
|
|
||||||
# Rails.application.config.action_view.preload_links_header = true
|
|
|
@ -27,7 +27,7 @@ describe ActiveStorage::DownloadableFile do
|
||||||
|
|
||||||
context 'when there is a repetition bloc' do
|
context 'when there is a repetition bloc' do
|
||||||
before do
|
before do
|
||||||
dossier.champs << build(:champ_repetition_with_piece_jointe, dossier: dossier)
|
dossier.champs << create(:champ_repetition_with_piece_jointe, dossier: dossier)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should have 4 piece_justificatives' do
|
it 'should have 4 piece_justificatives' do
|
||||||
|
|
|
@ -23,15 +23,15 @@ describe DossierSearchService do
|
||||||
let!(:dossier_0) { create(:dossier, state: Dossier.states.fetch(:brouillon), procedure: procedure_1, user: create(:user, email: 'brouillon@clap.fr')) }
|
let!(:dossier_0) { create(:dossier, state: Dossier.states.fetch(:brouillon), procedure: procedure_1, user: create(:user, email: 'brouillon@clap.fr')) }
|
||||||
|
|
||||||
let!(:etablissement_1) { create(:etablissement, entreprise_raison_sociale: 'OCTO Academy', siret: '41636169600051') }
|
let!(:etablissement_1) { create(:etablissement, entreprise_raison_sociale: 'OCTO Academy', siret: '41636169600051') }
|
||||||
let!(:dossier_1) { create(:dossier, state: Dossier.states.fetch(:en_construction), procedure: procedure_1, user: create(:user, email: 'contact@test.com'), etablissement: etablissement_1) }
|
let!(:dossier_1) { create(:dossier, :en_construction, procedure: procedure_1, user: create(:user, email: 'contact@test.com'), etablissement: etablissement_1) }
|
||||||
|
|
||||||
let!(:etablissement_2) { create(:etablissement, entreprise_raison_sociale: 'Plop octo', siret: '41816602300012') }
|
let!(:etablissement_2) { create(:etablissement, entreprise_raison_sociale: 'Plop octo', siret: '41816602300012') }
|
||||||
let!(:dossier_2) { create(:dossier, state: Dossier.states.fetch(:en_construction), procedure: procedure_1, user: create(:user, email: 'plop@gmail.com'), etablissement: etablissement_2) }
|
let!(:dossier_2) { create(:dossier, :en_construction, procedure: procedure_1, user: create(:user, email: 'plop@gmail.com'), etablissement: etablissement_2) }
|
||||||
|
|
||||||
let!(:etablissement_3) { create(:etablissement, entreprise_raison_sociale: 'OCTO Technology', siret: '41816609600051') }
|
let!(:etablissement_3) { create(:etablissement, entreprise_raison_sociale: 'OCTO Technology', siret: '41816609600051') }
|
||||||
let!(:dossier_3) { create(:dossier, state: Dossier.states.fetch(:en_construction), procedure: procedure_2, user: create(:user, email: 'peace@clap.fr'), etablissement: etablissement_3) }
|
let!(:dossier_3) { create(:dossier, :en_construction, procedure: procedure_2, user: create(:user, email: 'peace@clap.fr'), etablissement: etablissement_3) }
|
||||||
|
|
||||||
let!(:dossier_archived) { create(:dossier, state: Dossier.states.fetch(:en_construction), procedure: procedure_1, archived: true, user: create(:user, email: 'archived@clap.fr')) }
|
let!(:dossier_archived) { create(:dossier, :en_construction, procedure: procedure_1, archived: true, user: create(:user, email: 'archived@clap.fr')) }
|
||||||
|
|
||||||
describe 'search is empty' do
|
describe 'search is empty' do
|
||||||
let(:terms) { '' }
|
let(:terms) { '' }
|
||||||
|
|
Loading…
Add table
Reference in a new issue