Merge branch 'dev'

This commit is contained in:
gregoirenovel 2018-02-23 10:54:53 +01:00
commit c3f39a7941
70 changed files with 595 additions and 264 deletions

View file

@ -523,7 +523,7 @@ Performance/FlatMap:
Enabled: true
Performance/HashEachMethods:
Enabled: true
Enabled: false
Performance/LstripRstrip:
Enabled: true

View file

@ -2,6 +2,9 @@ source 'https://rubygems.org'
gem 'rails', '~> 5.2.0.rc1'
# Temporary lock ffi version. Read more: https://github.com/ffi/ffi/commit/0fef6d44d09018d03c24af7fa4f9fcd38f36b642
gem 'ffi', '1.9.18'
# Use SCSS for stylesheets
gem 'sass-rails'
# Use Uglifier as compressor for JavaScript assets

View file

@ -96,7 +96,7 @@ GEM
apipie-rails (0.5.6)
rails (>= 4.1)
arel (9.0.0)
ast (2.3.0)
ast (2.4.0)
attr_required (1.0.1)
autoprefixer-rails (7.2.5)
execjs
@ -115,8 +115,8 @@ GEM
brakeman (4.1.1)
browser (2.5.2)
builder (3.2.3)
byebug (9.1.0)
capybara (2.17.0)
byebug (10.0.0)
capybara (2.18.0)
addressable
mini_mime (>= 0.1.3)
nokogiri (>= 1.3.3)
@ -296,7 +296,7 @@ GEM
multi_json (~> 1.10)
fog-local (0.4.0)
fog-core (~> 1.27)
fog-openstack (0.1.23)
fog-openstack (0.1.24)
fog-core (~> 1.40)
fog-json (>= 1.0)
ipaddress (>= 0.8)
@ -403,7 +403,7 @@ GEM
domain_name (~> 0.5)
http_parser.rb (0.6.0)
httpclient (2.8.3)
i18n (0.9.3)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
inflecto (0.0.2)
ipaddress (0.8.3)
@ -448,7 +448,7 @@ GEM
activesupport (>= 4.0)
logstash-event (~> 1.2.0)
request_store
loofah (2.1.1)
loofah (2.2.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
lumberjack (1.0.12)
@ -474,7 +474,7 @@ GEM
multi_json (1.13.1)
multi_xml (0.6.0)
multipart-post (2.0.0)
mustermann (1.0.1)
mustermann (1.0.2)
nenv (0.3.0)
netrc (0.11.0)
nio4r (2.2.0)
@ -510,12 +510,12 @@ GEM
validate_email
validate_url
webfinger (>= 1.0.1)
openstack (3.3.12)
openstack (3.3.15)
json
orm_adapter (0.5.0)
parallel (1.12.1)
parser (2.4.0.2)
ast (~> 2.3)
parser (2.5.0.1)
ast (~> 2.4.0)
pdf-core (0.7.0)
pg (0.19.0)
powerpack (0.1.1)
@ -528,11 +528,11 @@ GEM
pry (0.11.3)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
pry-byebug (3.5.1)
byebug (~> 9.1)
pry-byebug (3.6.0)
byebug (~> 10.0)
pry (~> 0.10)
public_suffix (3.0.1)
rack (2.0.3)
public_suffix (3.0.2)
rack (2.0.4)
rack-handlers (0.7.3)
rack
rack-mini-profiler (0.10.7)
@ -543,7 +543,7 @@ GEM
httpclient (>= 2.4)
multi_json (>= 1.3.6)
rack (>= 1.1)
rack-protection (2.0.0)
rack-protection (2.0.1)
rack
rack-test (0.8.2)
rack (>= 1.0, < 3)
@ -604,27 +604,27 @@ GEM
activesupport (>= 3.0, < 6.0)
builder (~> 3.0)
rubyzip (~> 1.0)
rspec (3.5.0)
rspec-core (~> 3.5.0)
rspec-expectations (~> 3.5.0)
rspec-mocks (~> 3.5.0)
rspec-core (3.5.4)
rspec-support (~> 3.5.0)
rspec-expectations (3.5.0)
rspec (3.7.0)
rspec-core (~> 3.7.0)
rspec-expectations (~> 3.7.0)
rspec-mocks (~> 3.7.0)
rspec-core (3.7.1)
rspec-support (~> 3.7.0)
rspec-expectations (3.7.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0)
rspec-mocks (3.5.0)
rspec-support (~> 3.7.0)
rspec-mocks (3.7.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0)
rspec-rails (3.5.2)
rspec-support (~> 3.7.0)
rspec-rails (3.7.2)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 3.5.0)
rspec-expectations (~> 3.5.0)
rspec-mocks (~> 3.5.0)
rspec-support (~> 3.5.0)
rspec-support (3.5.0)
rspec-core (~> 3.7.0)
rspec-expectations (~> 3.7.0)
rspec-mocks (~> 3.7.0)
rspec-support (~> 3.7.0)
rspec-support (3.7.1)
rspec_junit_formatter (0.3.0)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (0.52.1)
@ -670,21 +670,21 @@ GEM
selenium-webdriver (3.8.0)
childprocess (~> 0.5)
rubyzip (~> 1.0)
sentry-raven (2.7.1)
sentry-raven (2.7.2)
faraday (>= 0.7.6, < 1.0)
sexp_processor (4.10.0)
shellany (0.0.1)
shoulda-matchers (3.1.2)
activesupport (>= 4.0.0)
simple_form (3.5.0)
simple_form (3.5.1)
actionpack (> 4, < 5.2)
activemodel (> 4, < 5.2)
sinatra (2.0.0)
sinatra (2.0.1)
mustermann (~> 1.0)
rack (~> 2.0)
rack-protection (= 2.0.0)
rack-protection (= 2.0.1)
tilt (~> 2.0)
skylight (1.5.0)
skylight (1.5.1)
activesupport (>= 3.0.0)
spreadsheet_architect (1.4.8)
axlsx (>= 2.0)
@ -718,9 +718,9 @@ GEM
turbolinks (5.1.0)
turbolinks-source (~> 5.1)
turbolinks-source (5.1.0)
tzinfo (1.2.4)
tzinfo (1.2.5)
thread_safe (~> 0.1)
uglifier (4.1.4)
uglifier (4.1.6)
execjs (>= 0.3.0, < 3)
unf (0.1.4)
unf_ext
@ -789,6 +789,7 @@ DEPENDENCIES
dotenv-rails
draper
factory_bot
ffi (= 1.9.18)
fog
fog-openstack
font-awesome-rails

View file

@ -7,3 +7,7 @@ $footer-height: 267px;
$footer-height-mobile: 531px;
$small-footer-height: 2 * $default-padding;
// layouts
$two-columns-padding: 60px;
$two-columns-breakpoint: $page-width + (2 * $two-columns-padding);

View file

@ -3,24 +3,7 @@
@import "placeholders";
@import "mixins";
$auth-breakpoint: 820px;
@media (max-width: $auth-breakpoint) {
.preview {
display: none;
}
.two-columns .column.auth-form {
@include horizontal-padding(0);
width: 100%;
}
}
@media (max-width: $auth-breakpoint) {
.two-columns.auth {
background: #FFFFFF;
}
}
$auth-breakpoint: $two-columns-breakpoint;
.preview {
font-size: 24px;
@ -28,6 +11,10 @@ $auth-breakpoint: 820px;
.paperless-logo {
width: 100%;
margin-bottom: 60px;
@media (max-width: $auth-breakpoint) {
display: none;
}
}
h3 {
@ -41,11 +28,19 @@ $auth-breakpoint: 820px;
.procedure-title {
font-size: 30px;
margin: 50px 0 32px;
margin: 20px 0 0;
@media (min-width: $auth-breakpoint) {
margin: 50px 0 32px;
}
}
.procedure-description {
font-size: 14px;
@media (max-width: $auth-breakpoint) {
display: none; // TO FIX : make this description available for small devices
}
}
.procedure-logos {
@ -53,8 +48,14 @@ $auth-breakpoint: 820px;
justify-content: space-around;
img {
max-height: 130px;
max-height: 50px;
max-width: 100%;
margin: 0 10px;
@media (min-width: $auth-breakpoint) {
max-height: 130px;
max-width: 500px;
}
}
}
}

View file

@ -25,6 +25,13 @@
display: block;
margin-top: $default-spacer;
}
&.required {
&::after {
color: $dark-red;
content: " *";
}
}
}
.editable-champ {
@ -70,6 +77,10 @@
&:disabled {
background-color: $border-grey;
}
&.small {
padding: $default-padding / 2;
}
}
input[type=text],
@ -114,11 +125,17 @@
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background: image-url("icons/chevron-down.svg") no-repeat;
background-color: #FFFFFF;
background-image: image-url("icons/chevron-down.svg");
background-repeat: no-repeat;
background-size: 14px;
background-position: right 10px center;
padding-right: 4 * $default-spacer;
&.small {
padding-right: 3 * $default-spacer;
}
// CAUTION: IE hackery ahead
&::-ms-expand {
display: none; // remove default arrow in IE 10 and 11 */
@ -208,4 +225,18 @@
margin-bottom: $default-padding;
}
}
.inline-champ {
margin-left: $default-spacer;
margin-right: $default-spacer;
width: 100%;
&:first-child {
margin-left: 0;
}
&:last-child {
margin-right: 0;
}
}
}

View file

@ -0,0 +1,5 @@
@import "constants";
.mb-1 {
margin-bottom: $default-spacer;
}

View file

@ -3,23 +3,34 @@
@import "constants";
.two-columns {
$column-padding: 60px;
$two-columns-breakpoint: $page-width + (2 * $column-padding);
background-color: #FFFFFF;
background: linear-gradient(to right, #FFFFFF 0%, #FFFFFF 50%, $light-grey 50%, $light-grey 100%);
@media (min-width: $two-columns-breakpoint) {
background: linear-gradient(to right, #FFFFFF 0%, #FFFFFF 50%, $light-grey 50%, $light-grey 100%);
}
.columns-container {
@extend .container;
display: flex;
flex-direction: row;
align-items: center;
flex-direction: column;
@media (min-width: $two-columns-breakpoint) {
flex-direction: row;
align-items: center;
justify-content: center;
}
}
.column {
width: 50%;
padding: $column-padding;
padding: $two-columns-padding 0 0;
width: 100%;
max-width: 500px;
margin: auto;
@media (min-width: $two-columns-breakpoint) {
padding: $two-columns-padding;
width: 50%;
&:first-child {
padding-left: 0;
}

View file

@ -34,7 +34,7 @@ module NewGestionnaire
def update
avis.update_attributes(avis_params)
flash.notice = 'Votre réponse est enregistrée.'
redirect_to instruction_avis_path(avis)
redirect_to instruction_gestionnaire_avis_path(avis)
end
def messagerie
@ -46,7 +46,7 @@ module NewGestionnaire
if @commentaire.save
flash.notice = "Message envoyé"
redirect_to messagerie_avis_path(avis)
redirect_to messagerie_gestionnaire_avis_path(avis)
else
flash.alert = @commentaire.errors.full_messages
render :messagerie
@ -56,7 +56,7 @@ module NewGestionnaire
def create_avis
confidentiel = avis.confidentiel || params[:avis][:confidentiel]
Avis.create(create_avis_params.merge(claimant: current_gestionnaire, dossier: avis.dossier, confidentiel: confidentiel))
redirect_to instruction_avis_path(avis)
redirect_to instruction_gestionnaire_avis_path(avis)
end
def sign_up
@ -76,10 +76,10 @@ module NewGestionnaire
sign_in(gestionnaire, scope: :gestionnaire)
Avis.link_avis_to_gestionnaire(gestionnaire)
avis = Avis.find(params[:id])
redirect_to url_for(avis_index_path)
redirect_to url_for(gestionnaire_avis_index_path)
else
flash[:alert] = gestionnaire.errors.full_messages
redirect_to url_for(sign_up_avis_path(params[:id], email))
redirect_to url_for(sign_up_gestionnaire_avis_path(params[:id], email))
end
end
@ -96,7 +96,7 @@ module NewGestionnaire
if current_gestionnaire.present?
# a gestionnaire is authenticated ... lets see if it can view the dossier
redirect_to avis_url(avis)
redirect_to gestionnaire_avis_url(avis)
elsif avis.gestionnaire.present? && avis.gestionnaire.email == params[:email]
# the avis gestionnaire has already signed up and it sould sign in

View file

@ -40,31 +40,31 @@ module NewGestionnaire
recipient = Gestionnaire.find(params[:recipient])
GestionnaireMailer.send_dossier(current_gestionnaire, dossier, recipient).deliver_later
flash.notice = "Dossier envoyé"
redirect_to(personnes_impliquees_dossier_path(procedure, dossier))
redirect_to(personnes_impliquees_gestionnaire_dossier_path(procedure, dossier))
end
def follow
current_gestionnaire.follow(dossier)
flash.notice = 'Dossier suivi'
redirect_back(fallback_location: procedures_url)
redirect_back(fallback_location: gestionnaire_procedures_url)
end
def unfollow
current_gestionnaire.unfollow(dossier)
flash.notice = "Vous ne suivez plus le dossier nº #{dossier.id}"
redirect_back(fallback_location: procedures_url)
redirect_back(fallback_location: gestionnaire_procedures_url)
end
def archive
dossier.update_attributes(archived: true)
current_gestionnaire.unfollow(dossier)
redirect_back(fallback_location: procedures_url)
redirect_back(fallback_location: gestionnaire_procedures_url)
end
def unarchive
dossier.update_attributes(archived: false)
redirect_back(fallback_location: procedures_url)
redirect_back(fallback_location: gestionnaire_procedures_url)
end
def passer_en_instruction
@ -72,14 +72,14 @@ module NewGestionnaire
current_gestionnaire.follow(dossier)
flash.notice = 'Dossier passé en instruction.'
redirect_to dossier_path(procedure, dossier)
redirect_to gestionnaire_dossier_path(procedure, dossier)
end
def repasser_en_construction
dossier.en_construction!
flash.notice = 'Dossier repassé en construction.'
redirect_to dossier_path(procedure, dossier)
redirect_to gestionnaire_dossier_path(procedure, dossier)
end
def terminer
@ -118,7 +118,7 @@ module NewGestionnaire
NotificationMailer.send_notification(dossier, template, attestation_pdf).deliver_now!
redirect_to dossier_path(procedure, dossier)
redirect_to gestionnaire_dossier_path(procedure, dossier)
end
def create_commentaire
@ -135,7 +135,7 @@ module NewGestionnaire
if @commentaire.save
current_gestionnaire.follow(dossier)
flash.notice = "Message envoyé"
redirect_to messagerie_dossier_path(procedure, dossier)
redirect_to messagerie_gestionnaire_dossier_path(procedure, dossier)
else
flash.alert = @commentaire.errors.full_messages
render :messagerie
@ -160,14 +160,14 @@ module NewGestionnaire
def create_avis
Avis.create(avis_params.merge(claimant: current_gestionnaire, dossier: dossier))
redirect_to avis_dossier_path(procedure, dossier)
redirect_to avis_gestionnaire_dossier_path(procedure, dossier)
end
def update_annotations
dossier = current_gestionnaire.dossiers.includes(champs_private: :type_de_champ).find(params[:dossier_id])
# FIXME: add attachements validation, cf. Champ#piece_justificative_file_errors
dossier.update_attributes(champs_private_params)
redirect_to annotations_privees_dossier_path(procedure, dossier)
redirect_to annotations_privees_gestionnaire_dossier_path(procedure, dossier)
end
def print

View file

@ -3,5 +3,9 @@ module NewGestionnaire
layout "new_application"
before_action :authenticate_gestionnaire!
def nav_bar_profile
:gestionnaire
end
end
end

View file

@ -116,7 +116,7 @@ module NewGestionnaire
procedure_presentation.update_attributes(sort: Procedure.default_sort)
end
redirect_back(fallback_location: procedure_url(procedure))
redirect_back(fallback_location: gestionnaire_procedure_url(procedure))
end
def update_sort
@ -138,7 +138,7 @@ module NewGestionnaire
procedure_presentation.update_attributes(sort: sort)
redirect_back(fallback_location: procedure_url(procedure))
redirect_back(fallback_location: gestionnaire_procedure_url(procedure))
end
def add_filter
@ -157,7 +157,7 @@ module NewGestionnaire
procedure_presentation.update_attributes(filters: filters.to_json)
end
redirect_back(fallback_location: procedure_url(procedure))
redirect_back(fallback_location: gestionnaire_procedure_url(procedure))
end
def remove_filter
@ -170,7 +170,7 @@ module NewGestionnaire
procedure_presentation.update_attributes(filters: filters.to_json)
redirect_back(fallback_location: procedure_url(procedure))
redirect_back(fallback_location: gestionnaire_procedure_url(procedure))
end
def download_dossiers
@ -203,7 +203,7 @@ module NewGestionnaire
def redirect_to_avis_if_needed
if current_gestionnaire.procedures.count == 0 && current_gestionnaire.avis.count > 0
redirect_to avis_index_path
redirect_to gestionnaire_avis_index_path
end
end

View file

@ -6,10 +6,35 @@ module NewUser
send_data(dossier.attestation.pdf.read, filename: 'attestation.pdf', type: 'application/pdf')
end
def identite
@dossier = dossier
@user = current_user
end
def update_identite
@dossier = dossier
individual_updated = @dossier.individual.update(individual_params)
dossier_updated = @dossier.update(dossier_params)
if individual_updated && dossier_updated
flash.notice = "Identité enregistrée"
if @dossier.procedure.module_api_carto.use_api_carto
redirect_to users_dossier_carte_path(@dossier.id)
else
redirect_to users_dossier_description_path(@dossier) # Simon should replace this with dossier_path when done
end
else
flash.now.alert = @dossier.errors.full_messages
render :identite
end
end
private
def dossier
Dossier.find(params[:dossier_id])
Dossier.find(params[:id] || params[:dossier_id])
end
def ensure_ownership!
@ -18,5 +43,13 @@ module NewUser
redirect_to root_path
end
end
def individual_params
params.require(:individual).permit(:gender, :nom, :prenom, :birthdate)
end
def dossier_params
params.require(:dossier).permit(:autorisation_donnees)
end
end
end

View file

@ -1,5 +1,11 @@
module NewUser
class UserController < ApplicationController
layout "new_application"
before_action :authenticate_user!
def nav_bar_profile
:user
end
end
end

View file

@ -5,7 +5,7 @@ class RootController < ApplicationController
if administrateur_signed_in?
return redirect_to admin_procedures_path
elsif gestionnaire_signed_in?
return redirect_to procedures_path
return redirect_to gestionnaire_procedures_path
elsif user_signed_in?
return redirect_to users_dossiers_path
elsif administration_signed_in?

View file

@ -73,7 +73,11 @@ class Users::DossiersController < UsersController
update_current_user_siret! siret if siret.present?
redirect_to users_dossier_path(id: dossier.id)
if dossier.procedure.for_individual
redirect_to identite_dossier_path(dossier)
else
redirect_to users_dossier_path(id: dossier.id)
end
rescue ActiveRecord::RecordNotFound
error_procedure
end

View file

@ -26,7 +26,7 @@ class Users::SessionsController < Sessions::SessionsController
if user_signed_in?
redirect_to after_sign_in_path_for(:user)
elsif gestionnaire_signed_in?
location = stored_location_for(:gestionnaire) || procedures_path
location = stored_location_for(:gestionnaire) || gestionnaire_procedures_path
redirect_to location
elsif administrateur_signed_in?
redirect_to admin_path

View file

@ -1,11 +1,11 @@
module DossierLinkHelper
def dossier_linked_path(gestionnaire, dossier)
if dossier.procedure.gestionnaires.include?(gestionnaire)
dossier_path(dossier.procedure, dossier)
gestionnaire_dossier_path(dossier.procedure, dossier)
else
avis = dossier.avis.find_by(gestionnaire: gestionnaire)
if avis.present?
avis_path(avis)
gestionnaire_avis_path(avis)
end
end
end

View file

@ -6,4 +6,8 @@ class ApplicationJob < ActiveJob::Base
after_perform do |job|
Rails.logger.info("#{job.class.name} ended at #{Time.now}")
end
def error(job, exception)
Raven.capture_exception(exception)
end
end

View file

@ -2,9 +2,23 @@ class AutoReceiveDossiersForProcedureJob < ApplicationJob
queue_as :cron
def perform(procedure_id, state)
procedure = Procedure.find_by(id: procedure_id)
if procedure
procedure.dossiers.state_en_construction.update_all(state: state, en_instruction_at: Time.now)
procedure = Procedure.find(procedure_id)
attrs = case state
when :en_instruction
{
state: :en_instruction,
en_instruction_at: DateTime.now
}
when :accepte
{
state: :accepte,
en_instruction_at: DateTime.now,
processed_at: DateTime.now
}
else
raise "Receiving Procedure##{procedure_id} in invalid state \"#{state}\""
end
procedure.dossiers.state_en_construction.update_all(attrs)
end
end

View file

@ -7,7 +7,7 @@ class WeeklyOverviewJob < ApplicationJob
Gestionnaire.all
.map { |gestionnaire| [gestionnaire, gestionnaire.last_week_overview] }
.reject { |_, overview| overview.nil? }
.each { |gestionnaire, overview| GestionnaireMailer.last_week_overview(gestionnaire, overview).deliver_now }
.each { |gestionnaire, _| GestionnaireMailer.last_week_overview(gestionnaire).deliver_later }
end
end
end

View file

@ -5,8 +5,9 @@ class GestionnaireMailer < ApplicationMailer
send_mail email, password, "Vous avez été nommé accompagnateur sur la plateforme TPS"
end
def last_week_overview(gestionnaire, overview)
def last_week_overview(gestionnaire)
headers['X-mailjet-campaign'] = 'last_week_overview'
overview = gestionnaire.last_week_overview
send_mail gestionnaire.email, overview, 'Vos activités sur TPS'
end

View file

@ -37,6 +37,8 @@ class Dossier < ActiveRecord::Base
accepts_nested_attributes_for :champs
accepts_nested_attributes_for :champs_private
validates :autorisation_donnees, acceptance: { message: 'doit être coché' }, allow_nil: false, on: :update
default_scope { where(hidden_at: nil) }
scope :state_brouillon, -> { where(state: 'brouillon') }
scope :state_not_brouillon, -> { where.not(state: 'brouillon') }
@ -177,7 +179,7 @@ class Dossier < ActiveRecord::Base
etablissement.destroy
entreprise.destroy
update_attributes(autorisation_donnees: false)
update_columns(autorisation_donnees: false)
end
def total_follow

View file

@ -101,14 +101,28 @@ class Gestionnaire < ActiveRecord::Base
end
end
def notifications_for_procedure(procedure)
dossiers = procedure.dossiers.en_cours.followed_by(self)
def notifications_for_procedure(procedure, state = :en_cours)
dossiers = case state
when :termine
procedure.dossiers.termine
when :not_archived
procedure.dossiers.not_archived
else
procedure.dossiers.en_cours
end.followed_by(self)
dossiers_id_with_notifications(dossiers)
end
def notifications_per_procedure
dossiers = Dossier.en_cours.followed_by(self)
def notifications_per_procedure(state = :en_cours)
dossiers = case state
when :termine
Dossier.termine
when :not_archived
Dossier.not_archived
else
Dossier.en_cours
end.followed_by(self)
Dossier.where(id: dossiers_id_with_notifications(dossiers)).group(:procedure_id).count
end

View file

@ -2,5 +2,18 @@ class Individual < ActiveRecord::Base
belongs_to :dossier
validates_uniqueness_of :dossier_id
validates :gender, presence: true, allow_nil: false, on: :update
validates :nom, presence: true, allow_blank: false, allow_nil: false, on: :update
validates :prenom, presence: true, allow_blank: false, allow_nil: false, on: :update
validates :birthdate, format: { with: /\A\d{4}\-\d{2}\-\d{2}\z/, message: "La date n'est pas au format AAAA-MM-JJ" }, allow_nil: true
before_validation :set_iso_date, if: -> { birthdate_changed? }
private
def set_iso_date
if birthdate.present?
self.birthdate = Date.parse(birthdate).iso8601
end
end
end

View file

@ -50,7 +50,8 @@ class TypeDeChamp < ActiveRecord::Base
def params_for_champ
{
private: private?
private: private?,
type: "Champs::#{type_champ.classify}Champ"
}
end
@ -77,4 +78,8 @@ class TypeDeChamp < ActiveRecord::Base
def public?
!private?
end
def self.type_champ_to_class_name(type_champ)
"TypesDeChamp::#{type_champ.classify}TypeDeChamp"
end
end

View file

@ -18,6 +18,10 @@ class TypesDeChampService
parameters[attributes].each do |index, param|
param[:private] = private
if param[:type_champ]
param[:type] = TypeDeChamp.type_champ_to_class_name(param[:type_champ])
end
if param[:libelle].empty?
parameters[attributes].delete(index.to_s)
end

View file

@ -12,10 +12,10 @@
- if @avis.gestionnaire.present?
%p
= link_to "Connectez-vous pour donner votre avis", dossier_url(@avis.dossier.procedure, @avis.dossier)
= link_to "Connectez-vous pour donner votre avis", gestionnaire_dossier_url(@avis.dossier.procedure, @avis.dossier)
- else
%p
= link_to "Inscrivez-vous pour donner votre avis", sign_up_avis_url(@avis.id, @avis.email)
= link_to "Inscrivez-vous pour donner votre avis", sign_up_gestionnaire_avis_url(@avis.id, @avis.email)
Bonne journée,
%br

View file

@ -14,4 +14,4 @@
- if user_signed_in? && current_user == dossier.user
= link_to 'Télécharger', dossier_attestation_path(dossier), target: '_blank', class: 'btn btn-primary'
- else
= link_to 'Télécharger', attestation_dossier_path(dossier.procedure, dossier), target: '_blank', class: 'btn btn-primary'
= link_to 'Télécharger', attestation_gestionnaire_dossier_path(dossier.procedure, dossier), target: '_blank', class: 'btn btn-primary'

View file

@ -1,3 +1,5 @@
- nav_bar_profile = controller.try(:nav_bar_profile)
.new-header{ class: current_page?(root_path) ? nil : "new-header-with-border" }
.header-inner-content
@ -5,15 +7,15 @@
= link_to root_path, class: "header-logo" do
%img{ src: image_url("header/logo-tps.svg") }
- if gestionnaire_signed_in?
- if nav_bar_profile == :gestionnaire && gestionnaire_signed_in?
- current_url = request.path_info
%ul.header-tabs
- if current_gestionnaire.procedures.count > 0
%li
= link_to "Procédures", procedures_path, class: (controller_name != 'avis') ? "tab-link active" : 'tab-link'
= link_to "Procédures", gestionnaire_procedures_path, class: (controller_name != 'avis') ? "tab-link active" : 'tab-link'
- if current_gestionnaire.avis.count > 0
%li
= link_to avis_index_path, class: (controller_name == 'avis') ? "tab-link active" : 'tab-link' do
= link_to gestionnaire_avis_index_path, class: (controller_name == 'avis') ? "tab-link active" : 'tab-link' do
Avis
- avis_counter = current_gestionnaire.avis.without_answer.count
- if avis_counter > 0
@ -29,13 +31,15 @@
par email : <a href="mailto:contact@tps.apientreprise.fr">contact@tps.apientreprise.fr</a>
%ul.header-right-content
- if gestionnaire_signed_in?
- if nav_bar_profile == :gestionnaire && gestionnaire_signed_in?
%li
.header-search
= form_tag recherche_path, method: :get, class: "form" do
= form_tag gestionnaire_recherche_path, method: :get, class: "form" do
= text_field_tag "q", "#{@search_terms if @search_terms.present?}", placeholder: "Rechercher un dossier"
%button{ title: "Rechercher" }
= image_tag "icons/search-blue.svg"
- if gestionnaire_signed_in? || user_signed_in?
%li
.header-menu-opener
= image_tag "icons/account-circle.svg", onclick: "javascript:TPS.toggleHeaderMenu(event);", title: "Mon compte"
@ -49,17 +53,17 @@
= image_tag "icons/super-admin.svg"
Passer en super-admin
- if SwitchDeviseProfileService.new(warden).multiple_devise_profile_connect?
- if user_signed_in?
- if user_signed_in? && nav_bar_profile != :usager
%li
= link_to users_dossiers_path, class: "menu-item menu-link" do
= image_tag "icons/switch-profile.svg"
Passer en usager
- if gestionnaire_signed_in?
- if gestionnaire_signed_in? && nav_bar_profile != :gestionnaire
%li
= link_to procedures_path, class: "menu-item menu-link" do
= link_to gestionnaire_procedures_path, class: "menu-item menu-link" do
= image_tag "icons/switch-profile.svg"
Passer en accompagnateur
- if administrateur_signed_in?
- if administrateur_signed_in? && nav_bar_profile != :administrateur
%li
= link_to admin_procedures_path, class: "menu-item menu-link" do
= image_tag "icons/switch-profile.svg"

View file

@ -12,7 +12,7 @@
Usager
- if gestionnaire_signed_in?
%li
= link_to(procedures_path) do
= link_to(gestionnaire_procedures_path) do
%i.fa.fa-user
&nbsp;
Accompagnateur

View file

@ -1,15 +1,15 @@
.accompagnateur-header
.container
%ul.breadcrumbs
%li= link_to('Avis', avis_index_path)
%li= link_to('Avis', gestionnaire_avis_index_path)
%li= "#{dossier.procedure.libelle}, dossier nº #{dossier.id}"
%ul.tabs
%li{ class: current_page?(avis_path(avis)) ? 'active' : nil }
= link_to 'Demande', avis_path(avis)
%li{ class: current_page?(instruction_avis_path(avis)) ? 'active' : nil }
= link_to 'Avis', instruction_avis_path(avis)
%li{ class: current_page?(gestionnaire_avis_path(avis)) ? 'active' : nil }
= link_to 'Demande', gestionnaire_avis_path(avis)
%li{ class: current_page?(instruction_gestionnaire_avis_path(avis)) ? 'active' : nil }
= link_to 'Avis', instruction_gestionnaire_avis_path(avis)
- if avis.answer == nil
%span.notifications{ 'aria-label': 'notifications' }
%li{ class: current_page?(messagerie_avis_path(avis)) ? 'active' : nil }
= link_to 'Messagerie', messagerie_avis_path(avis)
%li{ class: current_page?(messagerie_gestionnaire_avis_path(avis)) ? 'active' : nil }
= link_to 'Messagerie', messagerie_gestionnaire_avis_path(avis)

View file

@ -7,14 +7,14 @@
%h1.tab-title Avis
%ul.tabs
%li{ class: (@statut == NewGestionnaire::AvisController::A_DONNER_STATUS) ? 'active' : nil }>
= link_to(avis_index_path(statut: NewGestionnaire::AvisController::A_DONNER_STATUS)) do
= link_to(gestionnaire_avis_index_path(statut: NewGestionnaire::AvisController::A_DONNER_STATUS)) do
avis à donner
%span.badge= @avis_a_donner.count
- if @avis_a_donner.any?
%span.notifications
%li{ class: (@statut == NewGestionnaire::AvisController::DONNES_STATUS) ? 'active' : nil }>
= link_to(avis_index_path(statut: NewGestionnaire::AvisController::DONNES_STATUS)) do
= link_to(gestionnaire_avis_index_path(statut: NewGestionnaire::AvisController::DONNES_STATUS)) do
avis #{'donné'.pluralize(@avis_donnes.count)}
%span.badge= @avis_donnes.count
@ -30,11 +30,11 @@
- @avis.each do |avis|
%tr
%td.number-col
= link_to(avis_path(avis), class: 'cell-link') do
= link_to(gestionnaire_avis_path(avis), class: 'cell-link') do
%span.icon.folder
#{avis.dossier.id}
%td= link_to(avis.dossier.user.email, avis_path(avis), class: 'cell-link')
%td= link_to(avis.dossier.procedure.libelle, avis_path(avis), class: 'cell-link')
%td= link_to(avis.dossier.user.email, gestionnaire_avis_path(avis), class: 'cell-link')
%td= link_to(avis.dossier.procedure.libelle, gestionnaire_avis_path(avis), class: 'cell-link')
= paginate(@avis)
- else
%h2.empty-text Aucun avis

View file

@ -11,7 +11,7 @@
%span.date Demande d'avis envoyée le #{I18n.l(@avis.created_at.localtime, format: '%d/%m/%y')}
%p.introduction= @avis.introduction
= form_for @avis, url: avis_path(@avis), html: { class: 'form' } do |f|
= form_for @avis, url: gestionnaire_avis_path(@avis), html: { class: 'form' } do |f|
= f.text_area :answer, rows: 3, placeholder: 'Votre avis', required: true
.flex.justify-between.align-baseline
%p.confidentiel.flex
@ -21,6 +21,6 @@
.send-wrapper
= f.submit 'Envoyer votre avis', class: 'button send'
= render partial: "new_gestionnaire/shared/avis/form", locals: { url: avis_avis_path(@avis), must_be_confidentiel: @avis.confidentiel? }
= render partial: "new_gestionnaire/shared/avis/form", locals: { url: avis_gestionnaire_avis_path(@avis), must_be_confidentiel: @avis.confidentiel? }
= render partial: 'new_gestionnaire/shared/avis/list', locals: { avis: @dossier.avis_for(current_gestionnaire), avis_seen_at: nil }

View file

@ -2,4 +2,4 @@
= render partial: 'header', locals: { avis: @avis, dossier: @dossier }
= render partial: "new_gestionnaire/shared/messagerie", locals: { dossier: @dossier, messagerie_seen_at: nil, new_commentaire: @commentaire, form_url: commentaire_avis_path(@avis) }
= render partial: "new_gestionnaire/shared/messagerie", locals: { dossier: @dossier, messagerie_seen_at: nil, new_commentaire: @commentaire, form_url: commentaire_gestionnaire_avis_path(@avis) }

View file

@ -4,7 +4,7 @@
%p.tab-paragraph
Vous êtes le seul accompagnateur assigné sur cette procédure
- else
= form_for dossier, url: envoyer_a_accompagnateur_dossier_path(dossier.procedure, dossier), method: :post, html: { class: 'form' } do |f|
= form_for dossier, url: envoyer_a_accompagnateur_gestionnaire_dossier_path(dossier.procedure, dossier), method: :post, html: { class: 'form' } do |f|
.flex.justify-start.align-baseline
= select_tag(:recipient, options_from_collection_for_select(potential_recipients, :id, :email))
= f.submit "Envoyer", class: "button large send gap-left"

View file

@ -3,7 +3,7 @@
.flex.justify-between
%ul.breadcrumbs
%li
= link_to dossier.procedure.libelle.truncate_words(10), procedure_path(dossier.procedure), title: dossier.procedure.libelle
= link_to dossier.procedure.libelle.truncate_words(10), gestionnaire_procedure_path(dossier.procedure), title: dossier.procedure.libelle
%li
= "Dossier nº #{dossier.id}"
.mixed-buttons-bar
@ -11,7 +11,7 @@
%span.icon.printer
%ul.print-menu
%li
= link_to "Tout le dossier", print_dossier_path(dossier.procedure, dossier), target: "_blank", class: "menu-item menu-link"
= link_to "Tout le dossier", print_gestionnaire_dossier_path(dossier.procedure, dossier), target: "_blank", class: "menu-item menu-link"
%li
= link_to "Uniquement cet onglet", "#", onclick: "TPS.togglePrintMenu; window.print()", class: "menu-item menu-link"
@ -19,24 +19,24 @@
= render partial: "state_button", locals: { dossier: dossier }
%ul.tabs
- notifications_summary = current_gestionnaire.notifications_for_dossier(dossier)
%li{ class: current_page?(dossier_path(dossier.procedure, dossier)) ? 'active' : nil }
%li{ class: current_page?(gestionnaire_dossier_path(dossier.procedure, dossier)) ? 'active' : nil }
- if notifications_summary[:demande]
%span.notifications{ 'aria-label': 'notifications' }
= link_to "Demande", dossier_path(dossier.procedure, dossier)
%li{ class: current_page?(annotations_privees_dossier_path(dossier.procedure, dossier)) ? 'active' : nil }
= link_to "Demande", gestionnaire_dossier_path(dossier.procedure, dossier)
%li{ class: current_page?(annotations_privees_gestionnaire_dossier_path(dossier.procedure, dossier)) ? 'active' : nil }
- if notifications_summary[:annotations_privees]
%span.notifications{ 'aria-label': 'notifications' }
= link_to "Annotations privées", annotations_privees_dossier_path(dossier.procedure, dossier)
%li{ class: current_page?(avis_dossier_path(dossier.procedure, dossier)) ? 'active' : nil }
= link_to "Annotations privées", annotations_privees_gestionnaire_dossier_path(dossier.procedure, dossier)
%li{ class: current_page?(avis_gestionnaire_dossier_path(dossier.procedure, dossier)) ? 'active' : nil }
- if notifications_summary[:avis]
%span.notifications{ 'aria-label': 'notifications' }
= link_to "Avis externes", avis_dossier_path(dossier.procedure, dossier)
%li{ class: current_page?(messagerie_dossier_path(dossier.procedure, dossier)) ? 'active' : nil }
= link_to "Avis externes", avis_gestionnaire_dossier_path(dossier.procedure, dossier)
%li{ class: current_page?(messagerie_gestionnaire_dossier_path(dossier.procedure, dossier)) ? 'active' : nil }
- if notifications_summary[:messagerie]
%span.notifications{ 'aria-label': 'notifications' }
= link_to "Messagerie", messagerie_dossier_path(dossier.procedure, dossier)
%li{ class: current_page?(personnes_impliquees_dossier_path(dossier.procedure, dossier)) ? 'active' : nil }
= link_to "Personnes impliquées", personnes_impliquees_dossier_path(dossier.procedure, dossier)
= link_to "Messagerie", messagerie_gestionnaire_dossier_path(dossier.procedure, dossier)
%li{ class: current_page?(personnes_impliquees_gestionnaire_dossier_path(dossier.procedure, dossier)) ? 'active' : nil }
= link_to "Personnes impliquées", personnes_impliquees_gestionnaire_dossier_path(dossier.procedure, dossier)
.container
.print-header

View file

@ -14,7 +14,7 @@
= "Parcelle n° #{p.numero} - Feuille #{p.code_arr} #{p.section} #{p.feuille}"
:javascript
var getPositionUrl = "#{position_dossier_path(dossier.procedure, dossier)}";
var getPositionUrl = "#{position_gestionnaire_dossier_path(dossier.procedure, dossier)}";
var dossierJsonLatLngs = #{dossier.json_latlngs};
var dossierCadastres = #{dossier.cadastres.to_json};
var dossierQuartiersPrioritaires = #{dossier.quartier_prioritaires.to_json};

View file

@ -10,7 +10,7 @@
%h4 En construction
Vous permettez à l'usager de modifier ses réponses au formulaire
%li
= link_to passer_en_instruction_dossier_path(dossier.procedure, dossier), method: :post, data: { confirm: "Confirmer vous le passage en instruction de ce dossier ?" } do
= link_to passer_en_instruction_gestionnaire_dossier_path(dossier.procedure, dossier), method: :post, data: { confirm: "Confirmer vous le passage en instruction de ce dossier ?" } do
%span.icon.in-progress
.description
%h4 Passer en instruction
@ -18,7 +18,7 @@
- if dossier.en_instruction?
%li
= link_to repasser_en_construction_dossier_path(dossier.procedure, dossier), method: :post, data: { confirm: "Confirmer vous le passage en construction de ce dossier ?" } do
= link_to repasser_en_construction_gestionnaire_dossier_path(dossier.procedure, dossier), method: :post, data: { confirm: "Confirmer vous le passage en construction de ce dossier ?" } do
%span.icon.edit
.description
%h4 Repasser en construction
@ -59,7 +59,7 @@
- if dossier.attestation.present?
%h4 Attestation
%p.attestation L'acceptation du dossier a envoyé automatiquement une attestation au demandeur
= link_to "Voir l'attestation", attestation_dossier_path(dossier.procedure, dossier), target: '_blank', class: 'button'
= link_to "Voir l'attestation", attestation_gestionnaire_dossier_path(dossier.procedure, dossier), target: '_blank', class: 'button'
- else
%span.label{ class: button_or_label_class(dossier) }
= dossier.statut

View file

@ -3,7 +3,7 @@
%span.icon{ class: popup_class }
#{popup_title}
= form_tag(terminer_dossier_path(dossier.procedure, dossier), method: :post, class: 'form') do
= form_tag(terminer_gestionnaire_dossier_path(dossier.procedure, dossier), method: :post, class: 'form') do
= text_area :dossier, :motivation, class: 'motivation-text-area', placeholder: 'Rédigez votre motivation ici (facultative)'
- if title == 'Accepter'
%p.help

View file

@ -5,7 +5,7 @@
#dossier-annotations-privees.container
- if @dossier.ordered_champs_private.present?
%section
= form_for @dossier, url: annotations_dossier_path(@dossier.procedure, @dossier), html: { class: 'form' } do |f|
= form_for @dossier, url: annotations_gestionnaire_dossier_path(@dossier.procedure, @dossier), html: { class: 'form' } do |f|
= f.fields_for :champs_private, f.object.ordered_champs_private do |champ_form|
- champ = champ_form.object
= render partial: "new_gestionnaire/dossiers/editable_champs/editable_champ",

View file

@ -3,6 +3,6 @@
= render partial: "header", locals: { dossier: @dossier }
.container
= render partial: "new_gestionnaire/shared/avis/form", locals: { url: avis_dossier_path(@dossier.procedure, @dossier), must_be_confidentiel: false }
= render partial: "new_gestionnaire/shared/avis/form", locals: { url: avis_gestionnaire_dossier_path(@dossier.procedure, @dossier), must_be_confidentiel: false }
= render partial: 'new_gestionnaire/shared/avis/list', locals: { avis: @dossier.avis, avis_seen_at: @avis_seen_at }

View file

@ -2,4 +2,4 @@
= render partial: "header", locals: { dossier: @dossier }
= render partial: "new_gestionnaire/shared/messagerie", locals: { dossier: @dossier, messagerie_seen_at: @messagerie_seen_at , new_commentaire: @commentaire, form_url: commentaire_dossier_path(@dossier.procedure, @dossier) }
= render partial: "new_gestionnaire/shared/messagerie", locals: { dossier: @dossier, messagerie_seen_at: @messagerie_seen_at , new_commentaire: @commentaire, form_url: commentaire_gestionnaire_dossier_path(@dossier.procedure, @dossier) }

View file

@ -1,19 +1,19 @@
- if dossier.en_construction_ou_instruction?
- if dossier_is_followed
= link_to unfollow_dossier_path(procedure, dossier), method: :patch, class: 'button' do
= link_to unfollow_gestionnaire_dossier_path(procedure, dossier), method: :patch, class: 'button' do
%span.icon.unfollow>
Ne plus suivre
- else
= link_to follow_dossier_path(procedure, dossier), method: :patch, class: 'button' do
= link_to follow_gestionnaire_dossier_path(procedure, dossier), method: :patch, class: 'button' do
%span.icon.follow>
Suivre le dossier
- elsif dossier.termine?
- if dossier.archived
= link_to unarchive_dossier_path(procedure, dossier), method: :patch, class: 'button' do
= link_to unarchive_gestionnaire_dossier_path(procedure, dossier), method: :patch, class: 'button' do
%span.icon.unarchive>
Désarchiver le dossier
- else
= link_to archive_dossier_path(procedure, dossier), method: :patch, class: 'button' do
= link_to archive_gestionnaire_dossier_path(procedure, dossier), method: :patch, class: 'button' do
%span.icon.archive>
Archiver le dossier

View file

@ -4,8 +4,8 @@
.dropdown-content.fade-in-down
%ul.dropdown-items
%li
= link_to "Au format .csv", download_dossiers_procedure_path(format: :csv, procedure_id: procedure.id), target: "_blank"
= link_to "Au format .csv", download_dossiers_gestionnaire_procedure_path(format: :csv, procedure_id: procedure.id), target: "_blank"
%li
= link_to "Au format .xlsx", download_dossiers_procedure_path(format: :xlsx, procedure_id: procedure.id), target: "_blank"
= link_to "Au format .xlsx", download_dossiers_gestionnaire_procedure_path(format: :xlsx, procedure_id: procedure.id), target: "_blank"
%li
= link_to "Au format .ods", download_dossiers_procedure_path(format: :ods, procedure_id: procedure.id), target: "_blank"
= link_to "Au format .ods", download_dossiers_gestionnaire_procedure_path(format: :ods, procedure_id: procedure.id), target: "_blank"

View file

@ -1,5 +1,5 @@
%th{ class: classname }
= link_to update_sort_procedure_path(@procedure, table: field['table'], column: field['column']) do
= link_to update_sort_gestionnaire_procedure_path(@procedure, table: field['table'], column: field['column']) do
= field['label']
- if @procedure_presentation.sort['table'] == field['table'] && @procedure_presentation.sort['column'] == field['column']
- if @procedure_presentation.sort['order'] == 'asc'

View file

@ -6,7 +6,7 @@
%ul.procedure-list
- @procedures.each do |p|
%li.procedure-item.flex.align-start
= link_to(procedure_path(p)) do
= link_to(gestionnaire_procedure_path(p)) do
.flex
.procedure-logo{ style: p.logo.present? ? "background-image: url(#{p.logo.url})" : nil }
@ -18,7 +18,7 @@
%ul.procedure-stats.flex
%li
%object
= link_to(procedure_path(p, statut: 'a-suivre')) do
= link_to(gestionnaire_procedure_path(p, statut: 'a-suivre')) do
- a_suivre_count = @dossiers_a_suivre_count_per_procedure[p.id] || 0
.stats-number
= a_suivre_count
@ -26,7 +26,7 @@
à suivre
%li
%object
= link_to(procedure_path(p, statut: 'suivis')) do
= link_to(gestionnaire_procedure_path(p, statut: 'suivis')) do
- if current_gestionnaire.notifications_per_procedure[p.id].present?
%span.notifications{ 'aria-label': "notifications" }
- followed_count = @followed_dossiers_count_per_procedure[p.id] || 0
@ -36,7 +36,9 @@
= t('pluralize.followed', count: followed_count)
%li
%object
= link_to(procedure_path(p, statut: 'traites')) do
= link_to(gestionnaire_procedure_path(p, statut: 'traites')) do
- if current_gestionnaire.notifications_per_procedure(:termine)[p.id].present?
%span.notifications{ 'aria-label': "notifications" }
- termines_count = @dossiers_termines_count_per_procedure[p.id] || 0
.stats-number
= termines_count
@ -44,7 +46,7 @@
= t('pluralize.processed', count: termines_count)
%li
%object
= link_to(procedure_path(p, statut: 'tous')) do
= link_to(gestionnaire_procedure_path(p, statut: 'tous')) do
- dossier_count = @dossiers_count_per_procedure[p.id] || 0
.stats-number
= dossier_count
@ -52,7 +54,7 @@
= t('pluralize.case', count: dossier_count)
%li
%object
= link_to(procedure_path(p, statut: 'archives')) do
= link_to(gestionnaire_procedure_path(p, statut: 'archives')) do
- archived_count = @dossiers_archived_count_per_procedure[p.id] || 0
.stats-number
= archived_count

View file

@ -11,31 +11,31 @@
%h1= @procedure.libelle
%ul.tabs
%li{ class: (@statut == 'a-suivre') ? 'active' : nil }>
= link_to(procedure_path(@procedure, statut: 'a-suivre')) do
= link_to(gestionnaire_procedure_path(@procedure, statut: 'a-suivre')) do
à suivre
%span.badge= @a_suivre_dossiers.count
%li{ class: (@statut == 'suivis') ? 'active' : nil }>
- if current_gestionnaire.notifications_for_procedure(@procedure).present?
%span.notifications{ 'aria-label': 'notifications' }
= link_to(procedure_path(@procedure, statut: 'suivis')) do
= link_to(gestionnaire_procedure_path(@procedure, statut: 'suivis')) do
= t('pluralize.followed', count: @followed_dossiers.count)
%span.badge= @followed_dossiers.count
%li{ class: (@statut == 'traites') ? 'active' : nil }>
= link_to(procedure_path(@procedure, statut: 'traites')) do
- if current_gestionnaire.notifications_for_procedure(@procedure, :termine).present?
%span.notifications{ 'aria-label': 'notifications' }
= link_to(gestionnaire_procedure_path(@procedure, statut: 'traites')) do
= t('pluralize.processed', count: @termines_dossiers.count)
%span.badge= @termines_dossiers.count
%li{ class: (@statut == 'tous') ? 'active' : nil }>
- if current_gestionnaire.notifications_for_procedure(@procedure).present?
%span.notifications{ 'aria-label': 'notifications' }
= link_to(procedure_path(@procedure, statut: 'tous')) do
= link_to(gestionnaire_procedure_path(@procedure, statut: 'tous')) do
tous les dossiers
%span.badge= @all_state_dossiers.count
%li{ class: (@statut == 'archives') ? 'active' : nil }>
= link_to(procedure_path(@procedure, statut: 'archives')) do
= link_to(gestionnaire_procedure_path(@procedure, statut: 'archives')) do
= t('pluralize.archived', count: @archived_dossiers.count)
%span.badge= @archived_dossiers.count
@ -47,7 +47,7 @@
%span.button.dropdown
Filtrer
.dropdown-content.left-aligned.fade-in-down
= form_tag add_filter_procedure_path(@procedure), method: :post, class: 'dropdown-form large' do
= form_tag add_filter_gestionnaire_procedure_path(@procedure), method: :post, class: 'dropdown-form large' do
= label_tag :field, "Colonne"
= select_tag :field, options_for_select(@available_fields_to_filters)
%br
@ -60,7 +60,7 @@
- @current_filters.each do |filter|
%span.filter
= "#{filter['label']} : #{filter['value']}"
= link_to remove_filter_procedure_path(@procedure, statut: @statut, table: filter['table'], column: filter['column']) do
= link_to remove_filter_gestionnaire_procedure_path(@procedure, statut: @statut, table: filter['table'], column: filter['column']) do
%img.close-icon{ src: image_url("close.svg") }
%table.table.dossiers-table.hoverable
@ -82,7 +82,7 @@
%span.button.dropdown
Personnaliser
.dropdown-content.fade-in-down
= form_tag update_displayed_fields_procedure_path(@procedure), method: :patch, class: 'dropdown-form' do
= form_tag update_displayed_fields_gestionnaire_procedure_path(@procedure), method: :patch, class: 'dropdown-form' do
= select_tag :values,
options_for_select(@procedure.fields_for_select,
selected: @displayed_fields_values),
@ -94,22 +94,22 @@
- @dossiers.each do |dossier|
%tr
%td.folder-col
= link_to(dossier_path(@procedure, dossier), class: 'cell-link') do
= link_to(gestionnaire_dossier_path(@procedure, dossier), class: 'cell-link') do
%span.icon.folder
- if current_gestionnaire.notifications_for_procedure(@procedure).include?(dossier.id)
- if current_gestionnaire.notifications_for_procedure(@procedure, :not_archived).include?(dossier.id)
%span.notifications{ 'aria-label': 'notifications' }
%td.number-col
= link_to(dossier_path(@procedure, dossier), class: 'cell-link') do
= link_to(gestionnaire_dossier_path(@procedure, dossier), class: 'cell-link') do
= dossier.id
- @displayed_fields.each do |field|
%td
= link_to(dossier_path(@procedure, dossier), class: 'cell-link') do
= link_to(gestionnaire_dossier_path(@procedure, dossier), class: 'cell-link') do
= dossier.get_value(field['table'], field['column'])
%td.status-col
= link_to(dossier_path(@procedure, dossier), class: 'cell-link') do
= link_to(gestionnaire_dossier_path(@procedure, dossier), class: 'cell-link') do
= render partial: 'status', locals: { dossier: dossier }
%td.follow-col= render partial: 'dossier_actions', locals: { procedure: @procedure, dossier: dossier, dossier_is_followed: @followed_dossiers_id.include?(dossier.id) }
= paginate @dossiers

View file

@ -0,0 +1,45 @@
.two-columns
.columns-container
.column.preview
.procedure-logos
= image_tag @dossier.procedure.decorate.logo_img
- if @dossier.procedure.euro_flag
= image_tag "flag_of_europe.svg"
%h2.procedure-title
= @dossier.procedure.libelle
%p.procedure-description
= h sanitize(@dossier.procedure.description)
.column
= form_for @dossier.individual, url: update_identite_dossier_path(@dossier), html: { class: "form" } do |f|
%h1 Données d'identité
%p.mb-1 Merci de remplir vos informations personnelles pour accéder à la démarche.
%label
%span.mandatory *
champs requis
= f.label :gender, class: "required"
= f.select :gender, ['M.', 'Mme'], {}, class: "small"
.flex
.inline-champ
= f.label :prenom, class: "required"
= f.text_field :prenom, class: "small", required: true
.inline-champ
= f.label :nom, class: "required"
= f.text_field :nom, class: "small", required: true
- if @dossier.procedure.ask_birthday?
= f.label :birthdate, class: "required"
= f.date_field :birthdate, value: @dossier.individual.birthdate, placeholder: 'format : AAAA-MM-JJ', required: true, class: "small"
= fields_for :dossier, @dossier do |df|
= label_tag do
= df.check_box :autorisation_donnees, required: true
J'accepte
= link_to "les CGU", CGU_URL, target: :blank
= f.submit "Continuer", class: "button large primary expand"

View file

@ -15,7 +15,7 @@ ActiveSupport::Inflector.inflections(:en) do |inflect|
inflect.irregular 'type_de_champ', 'types_de_champ'
inflect.irregular 'type_de_champ_private', 'types_de_champ_private'
inflect.irregular 'assign_to', 'assign_tos'
inflect.irregular('avis', 'avis')
inflect.uncountable(['avis', 'pays'])
end
# From https://github.com/davidcelis/inflections

View file

@ -14,6 +14,7 @@ fr:
accepte: "Accepté"
refuse: "Refusé"
sans_suite: "Sans suite"
autorisation_donnees: Acceptation des CGU
errors:
models:

View file

@ -2,6 +2,7 @@ fr:
activerecord:
attributes:
individual:
gender: Civilité
nom: Nom
prenom: Prénom
birthdate: Date de naissance
@ -9,6 +10,8 @@ fr:
models:
individual:
attributes:
gender:
blank: 'doit être rempli'
nom:
blank: 'doit être rempli'
prenom:

View file

@ -202,11 +202,15 @@ Rails.application.routes.draw do
scope module: 'new_user' do
resources :dossiers, only: [] do
member do
get 'identite'
patch 'update_identite'
end
get 'attestation'
end
end
scope module: 'new_gestionnaire' do
scope module: 'new_gestionnaire', as: 'gestionnaire' do
resources :procedures, only: [:index, :show], param: :procedure_id do
member do
patch 'update_displayed_fields'

View file

@ -0,0 +1,14 @@
namespace :'2018_02_13_fill_champ_private_and_type' do
task set: :environment do
Champ.includes(:type_de_champ).find_each do |champ|
champ.update_columns(champ.type_de_champ.params_for_champ)
end
TypeDeChamp.find_each do |type_de_champ|
type_de_champ.update_columns(
private: type_de_champ.private?,
type: TypeDeChamp.type_champ_to_class_name(type_de_champ.type_champ)
)
end
end
end

View file

@ -0,0 +1,17 @@
namespace :'2018_02_20_remove_duplicated_assign_tos' do
task remove: :environment do
duplicates = AssignTo.group(:gestionnaire_id, :procedure_id)
.having("COUNT(*) > 1")
.size
.to_a
duplicates.each do |duplicate|
keys = duplicate.first
gestionnaire_id = keys.first
procedure_id = keys.last
assign_tos = AssignTo.where(gestionnaire_id: gestionnaire_id, procedure_id: procedure_id).to_a
assign_tos.shift
assign_tos.each(&:destroy)
end
end
end

View file

@ -0,0 +1,7 @@
namespace :'2018_02_20_set_processed_at' do
task set: :environment do
Dossier.where(state: :accepte, processed_at: nil).find_each do |dossier|
dossier.update_column(:processed_at, dossier.en_instruction_at)
end
end
end

View file

@ -58,7 +58,7 @@ describe NewGestionnaire::AvisController, type: :controller do
avis_without_answer.reload
end
it { expect(response).to redirect_to(instruction_avis_path(avis_without_answer)) }
it { expect(response).to redirect_to(instruction_gestionnaire_avis_path(avis_without_answer)) }
it { expect(avis_without_answer.answer).to eq('answer') }
it { expect(flash.notice).to eq('Votre réponse est enregistrée.') }
end
@ -76,7 +76,7 @@ describe NewGestionnaire::AvisController, type: :controller do
it do
subject
expect(response).to redirect_to(messagerie_avis_path(avis_without_answer))
expect(response).to redirect_to(messagerie_gestionnaire_avis_path(avis_without_answer))
expect(dossier.commentaires.map(&:body)).to match(['commentaire body'])
end
@ -119,7 +119,7 @@ describe NewGestionnaire::AvisController, type: :controller do
it { expect(created_avis.introduction).to eq(intro) }
it { expect(created_avis.dossier).to eq(previous_avis.dossier) }
it { expect(created_avis.claimant).to eq(gestionnaire) }
it { expect(response).to redirect_to(instruction_avis_path(previous_avis)) }
it { expect(response).to redirect_to(instruction_gestionnaire_avis_path(previous_avis)) }
end
context 'when the user asked for a confidentiel avis' do
@ -179,7 +179,7 @@ describe NewGestionnaire::AvisController, type: :controller do
get :sign_up, params: { id: avis.id, email: invited_email }
end
it { is_expected.to redirect_to avis_url(avis) }
it { is_expected.to redirect_to gestionnaire_avis_url(avis) }
end
context 'when the gestionnaire is not authenticated' do
@ -201,7 +201,7 @@ describe NewGestionnaire::AvisController, type: :controller do
end
# redirected to dossier but then the gestionnaire gonna be banished !
it { is_expected.to redirect_to avis_url(avis) }
it { is_expected.to redirect_to gestionnaire_avis_url(avis) }
end
end
@ -243,14 +243,14 @@ describe NewGestionnaire::AvisController, type: :controller do
it { expect(Avis).to have_received(:link_avis_to_gestionnaire) }
it { expect(subject.current_gestionnaire).to eq(created_gestionnaire) }
it { is_expected.to redirect_to avis_index_path }
it { is_expected.to redirect_to gestionnaire_avis_index_path }
end
context 'when the gestionnaire creation fails' do
let(:password) { '' }
it { expect(created_gestionnaire).to be_nil }
it { is_expected.to redirect_to sign_up_avis_path(avis_id, invited_email) }
it { is_expected.to redirect_to sign_up_gestionnaire_avis_path(avis_id, invited_email) }
it { expect(flash.alert).to eq(['Password : Le mot de passe est vide']) }
end
end

View file

@ -54,7 +54,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
)
end
it { expect(response).to redirect_to(personnes_impliquees_dossier_url) }
it { expect(response).to redirect_to(personnes_impliquees_gestionnaire_dossier_url) }
end
describe '#follow' do
@ -64,7 +64,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
it { expect(gestionnaire.followed_dossiers).to match([dossier]) }
it { expect(flash.notice).to eq('Dossier suivi') }
it { expect(response).to redirect_to(procedures_url) }
it { expect(response).to redirect_to(gestionnaire_procedures_url) }
end
describe '#unfollow' do
@ -76,7 +76,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
it { expect(gestionnaire.followed_dossiers).to match([]) }
it { expect(flash.notice).to eq("Vous ne suivez plus le dossier nº #{dossier.id}") }
it { expect(response).to redirect_to(procedures_url) }
it { expect(response).to redirect_to(gestionnaire_procedures_url) }
end
describe '#archive' do
@ -88,7 +88,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
end
it { expect(dossier.archived).to be true }
it { expect(response).to redirect_to(procedures_url) }
it { expect(response).to redirect_to(gestionnaire_procedures_url) }
it { expect(gestionnaire.followed_dossiers).not_to include(dossier) }
end
@ -100,7 +100,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
end
it { expect(dossier.archived).to be false }
it { expect(response).to redirect_to(procedures_url) }
it { expect(response).to redirect_to(gestionnaire_procedures_url) }
end
describe '#passer_en_instruction' do
@ -112,7 +112,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
end
it { expect(dossier.state).to eq('en_instruction') }
it { is_expected.to redirect_to dossier_path(procedure, dossier) }
it { is_expected.to redirect_to gestionnaire_dossier_path(procedure, dossier) }
it { expect(gestionnaire.follow?(dossier)).to be true }
end
@ -131,7 +131,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
expect(dossier.state).to eq('en_construction')
end
it { is_expected.to redirect_to dossier_path(procedure, dossier) }
it { is_expected.to redirect_to gestionnaire_dossier_path(procedure, dossier) }
end
describe '#terminer' do
@ -158,7 +158,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
subject
end
it { is_expected.to redirect_to redirect_to dossier_path(procedure, dossier) }
it { is_expected.to redirect_to redirect_to gestionnaire_dossier_path(procedure, dossier) }
end
context "with classer_sans_suite" do
@ -184,7 +184,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
subject
end
it { is_expected.to redirect_to redirect_to dossier_path(procedure, dossier) }
it { is_expected.to redirect_to redirect_to gestionnaire_dossier_path(procedure, dossier) }
end
context "with accepter" do
@ -233,7 +233,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
it 'Notification email is sent with the attestation' do
subject
is_expected.to redirect_to redirect_to dossier_path(procedure, dossier)
is_expected.to redirect_to redirect_to gestionnaire_dossier_path(procedure, dossier)
end
end
@ -246,7 +246,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
subject
is_expected.to redirect_to redirect_to dossier_path(procedure, dossier)
is_expected.to redirect_to redirect_to gestionnaire_dossier_path(procedure, dossier)
end
end
end
@ -307,7 +307,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
expect(saved_commentaire.body).to eq("<p>avant\n<br />apres</p>")
expect(saved_commentaire.email).to eq(gestionnaire.email)
expect(saved_commentaire.dossier).to eq(dossier)
expect(response).to redirect_to(messagerie_dossier_path(dossier.procedure, dossier))
expect(response).to redirect_to(messagerie_gestionnaire_dossier_path(dossier.procedure, dossier))
expect(gestionnaire.followed_dossiers).to include(dossier)
expect(saved_commentaire.file.present?).to eq(false)
end
@ -350,7 +350,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
it { expect(saved_avis.confidentiel).to eq(true) }
it { expect(saved_avis.dossier).to eq(dossier) }
it { expect(saved_avis.claimant).to eq(gestionnaire) }
it { expect(response).to redirect_to(avis_dossier_path(dossier.procedure, dossier)) }
it { expect(response).to redirect_to(avis_gestionnaire_dossier_path(dossier.procedure, dossier)) }
end
describe "#update_annotations" do
@ -394,6 +394,6 @@ describe NewGestionnaire::DossiersController, type: :controller do
it { expect(champ_multiple_drop_down_list.value).to eq('["un", "deux"]') }
it { expect(champ_datetime.value).to eq('21/12/2019 13:17') }
it { expect(response).to redirect_to(annotations_privees_dossier_path(dossier.procedure, dossier)) }
it { expect(response).to redirect_to(annotations_privees_gestionnaire_dossier_path(dossier.procedure, dossier)) }
end
end

View file

@ -78,7 +78,7 @@ describe NewGestionnaire::ProceduresController, type: :controller do
end
it "redirects avis" do
expect(@controller).to have_received(:redirect_to).with(avis_index_path)
expect(@controller).to have_received(:redirect_to).with(gestionnaire_avis_index_path)
end
end
end

View file

@ -64,4 +64,43 @@ describe NewUser::DossiersController, type: :controller do
end
end
end
describe 'update_identite' do
let(:procedure) { create(:procedure, :for_individual) }
let(:dossier) { create(:dossier, user: user, procedure: procedure) }
subject { post :update_identite, params: { id: dossier.id, individual: individual_params, dossier: dossier_params } }
before do
sign_in(user)
subject
end
context 'with correct individual and dossier params' do
let(:individual_params) { { gender: 'M', nom: 'Mouse', prenom: 'Mickey' } }
let(:dossier_params) { { autorisation_donnees: true } }
it do
expect(response).to redirect_to(users_dossier_description_path(dossier))
end
context 'on a procedure with carto' do
let(:procedure) { create(:procedure, :for_individual, :with_api_carto) }
it do
expect(response).to redirect_to(users_dossier_carte_path(dossier))
end
end
end
context 'with incorrect individual and dossier params' do
let(:individual_params) { { gender: '', nom: '', prenom: '' } }
let(:dossier_params) { { autorisation_donnees: nil } }
it do
expect(response).not_to have_http_status(:redirect)
expect(flash[:alert]).to include("Civilité doit être rempli", "Nom doit être rempli", "Prénom doit être rempli", "Acceptation des CGU doit être coché")
end
end
end
end

View file

@ -21,7 +21,7 @@ describe RootController, type: :controller do
sign_in gestionnaire
end
it { expect(subject).to redirect_to(procedures_path) }
it { expect(subject).to redirect_to(gestionnaire_procedures_path) }
end
context 'when Administrateur is connected' do

View file

@ -365,6 +365,8 @@ describe Users::DossiersController, type: :controller do
before do
sign_in dossier.user
dossier.update_columns(autorisation_donnees: nil)
dossier.reload
subject
end

View file

@ -1,5 +1,6 @@
FactoryBot.define do
factory :dossier do
autorisation_donnees true
state 'brouillon'
association :user, factory: [:user]

View file

@ -10,13 +10,13 @@ feature 'The gestionnaire part' do
scenario 'A gestionnaire can accept a dossier' do
log_in(gestionnaire.email, password)
expect(page).to have_current_path(procedures_path)
expect(page).to have_current_path(gestionnaire_procedures_path)
click_on procedure.libelle
expect(page).to have_current_path(procedure_path(procedure))
expect(page).to have_current_path(gestionnaire_procedure_path(procedure))
click_on dossier.user.email
expect(page).to have_current_path(dossier_path(procedure, dossier))
expect(page).to have_current_path(gestionnaire_dossier_path(procedure, dossier))
click_on 'Passer en instruction'
dossier.reload
@ -40,16 +40,16 @@ feature 'The gestionnaire part' do
dossier_present?(dossier.id, 'en construction')
click_on 'Suivre le dossier'
expect(page).to have_current_path(procedure_path(procedure))
expect(page).to have_current_path(gestionnaire_procedure_path(procedure))
test_statut_bar(suivi: 1, tous_les_dossiers: 1)
expect(page).to have_text('Aucun dossier')
click_on 'suivi'
expect(page).to have_current_path(procedure_path(procedure, statut: 'suivis'))
expect(page).to have_current_path(gestionnaire_procedure_path(procedure, statut: 'suivis'))
dossier_present?(dossier.id, 'en construction')
click_on 'Ne plus suivre'
expect(page).to have_current_path(procedure_path(procedure, statut: 'suivis'))
expect(page).to have_current_path(gestionnaire_procedure_path(procedure, statut: 'suivis'))
test_statut_bar(a_suivre: 1, tous_les_dossiers: 1)
expect(page).to have_text('Aucun dossier')
end
@ -63,7 +63,7 @@ feature 'The gestionnaire part' do
click_on dossier.user.email
click_on 'Avis externes'
expect(page).to have_current_path(avis_dossier_path(procedure, dossier))
expect(page).to have_current_path(avis_gestionnaire_dossier_path(procedure, dossier))
expert_email = 'expert@tps.com'
ask_confidential_avis(expert_email, 'a good introduction')
@ -71,21 +71,21 @@ feature 'The gestionnaire part' do
log_out
avis = dossier.avis.first
test_mail(expert_email, sign_up_avis_path(avis, expert_email))
test_mail(expert_email, sign_up_gestionnaire_avis_path(avis, expert_email))
avis_sign_up(avis, expert_email, 'a good password')
expect(page).to have_current_path(avis_index_path)
expect(page).to have_current_path(gestionnaire_avis_index_path)
expect(page).to have_text('avis à donner 1')
expect(page).to have_text('avis donnés 0')
click_on dossier.user.email
expect(page).to have_current_path(avis_path(dossier.avis.first))
expect(page).to have_current_path(gestionnaire_avis_path(dossier.avis.first))
within(:css, '.tabs') do
click_on 'Avis'
end
expect(page).to have_current_path(instruction_avis_path(dossier.avis.first))
expect(page).to have_current_path(instruction_gestionnaire_avis_path(dossier.avis.first))
within(:css, '.give-avis') do
expect(page).to have_text("Demandeur : #{gestionnaire.email}")
@ -115,7 +115,7 @@ feature 'The gestionnaire part' do
click_on dossier.user.email
click_on 'Avis externes'
expect(page).to have_current_path(avis_dossier_path(procedure, dossier))
expect(page).to have_current_path(avis_gestionnaire_dossier_path(procedure, dossier))
expert_email = 'expert@tps.com'
ask_confidential_avis(expert_email, 'a good introduction')
@ -136,7 +136,7 @@ feature 'The gestionnaire part' do
fill_in 'user_email', with: email
fill_in 'user_password', with: password
click_on 'Se connecter'
expect(page).to have_current_path(procedures_path)
expect(page).to have_current_path(gestionnaire_procedures_path)
end
def log_out
@ -169,10 +169,10 @@ feature 'The gestionnaire part' do
end
def avis_sign_up(avis, email, password)
visit sign_up_avis_path(avis, email)
visit sign_up_gestionnaire_avis_path(avis, email)
fill_in 'gestionnaire_password', with: 'a good password'
click_on 'Créer un compte'
expect(page).to have_current_path(avis_index_path)
expect(page).to have_current_path(gestionnaire_avis_index_path)
end
def dossier_present?(id, statut)

View file

@ -11,7 +11,7 @@ feature "procedure filters" do
before do
champ.update_attributes(value: "Mon champ rempli")
login_as gestionnaire, scope: :gestionnaire
visit procedure_path(procedure)
visit gestionnaire_procedure_path(procedure)
end
scenario "should display demandeur by default" do

View file

@ -13,34 +13,41 @@ feature 'As a User I wanna create a dossier' do
before do
login_as user, scope: :user
visit commencer_path(procedure_path: procedure_for_individual.path)
fill_in 'dossier_individual_attributes_nom', with: 'Nom'
fill_in 'dossier_individual_attributes_prenom', with: 'Prenom'
find(:css, "#dossier_autorisation_donnees[value='1']").set(true)
fill_in 'individual_nom', with: 'Nom'
fill_in 'individual_prenom', with: 'Prenom'
check "dossier_autorisation_donnees"
end
context "when birthday is asked" do
let(:ask_birthday) { true }
scenario "with a proper date input field for birthdate (type='date' supported)" do
fill_in 'dossier_individual_attributes_birthdate', with: '1987-10-14'
page.find_by_id('etape_suivante').click
expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last.id.to_s))
page.find_by_id('etape_suivante').click
fill_in 'individual_birthdate', with: '1987-10-14'
click_button('Continuer')
expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last.id))
click_button('Etape suivante')
expect(page).to have_current_path(users_dossier_description_path(procedure_for_individual.dossiers.last.id))
fill_in "champs_#{procedure_for_individual.dossiers.last.champs.first.id}", with: 'contenu du champ 1'
find(:css, '[name=submit_action]').set('nouveaux')
page.find_by_id('suivant').click
click_button('suivant')
expect(user.dossiers.first.individual.birthdate).to eq("1987-10-14")
expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_for_individual.dossiers.last.id.to_s))
end
scenario "with a basic text input field for birthdate (type='date' unsupported)" do
fill_in 'dossier_individual_attributes_birthdate', with: '14/10/1987'
page.find_by_id('etape_suivante').click
fill_in 'individual_birthdate', with: '14/10/1987'
click_button('Continuer')
expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last.id.to_s))
page.find_by_id('etape_suivante').click
click_button('Etape suivante')
fill_in "champs_#{procedure_for_individual.dossiers.last.champs.first.id}", with: 'contenu du champ 1'
find(:css, '[name=submit_action]').set('nouveaux')
page.find_by_id('suivant').click
expect(user.dossiers.first.individual.birthdate).to eq("1987-10-14")
expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_for_individual.dossiers.last.id.to_s))
end
@ -50,12 +57,15 @@ feature 'As a User I wanna create a dossier' do
let(:ask_birthday) { false }
scenario "no need for birthday" do
page.find_by_id('etape_suivante').click
click_button('Continuer')
expect(page).to have_current_path(users_dossier_carte_path(procedure_for_individual.dossiers.last.id.to_s))
page.find_by_id('etape_suivante').click
click_button('Etape suivante')
fill_in "champs_#{procedure_for_individual.dossiers.last.champs.first.id}", with: 'contenu du champ 1'
find(:css, '[name=submit_action]').set('nouveaux')
page.find_by_id('suivant').click
click_button('suivant')
expect(user.dossiers.first.individual.birthdate).to eq(nil)
expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_for_individual.dossiers.last.id.to_s))
end

View file

@ -6,16 +6,11 @@ feature 'As a User I want to sort and paginate dossiers', js: true do
before "Create dossier" do
login_as user, scope: :user
visit commencer_path(procedure_path: procedure_for_individual.path)
fill_in 'dossier_individual_attributes_nom', with: 'Nom'
fill_in 'dossier_individual_attributes_prenom', with: 'Prenom'
fill_in 'dossier_individual_attributes_birthdate', with: '14/10/1987'
find(:css, "#dossier_autorisation_donnees[value='1']").set(true)
page.find_by_id('etape_suivante').click
page.find_by_id('suivant').click
50.times do
Dossier.create(procedure_id: procedure_for_individual.id, user_id: user.id, state: "en_construction")
end
visit root_path
end
@ -25,8 +20,8 @@ feature 'As a User I want to sort and paginate dossiers', js: true do
expect(page.all(:css, '#dossiers-list tr')[1].text.split(" ").first).to eq(user.dossiers.first.id.to_s)
expect(page.all(:css, '#dossiers-list tr')[2].text.split(" ").first).to eq(user.dossiers.second.id.to_s)
visit "/users/dossiers?dossiers_smart_listing[sort][id]=desc"
expect(page.all(:css, '#dossiers-list tr')[1].text.split(" ").first).to eq((user.dossiers.first.id + 50).to_s)
expect(page.all(:css, '#dossiers-list tr')[2].text.split(" ").first).to eq((user.dossiers.first.id + 49).to_s)
expect(page.all(:css, '#dossiers-list tr')[1].text.split(" ").first).to eq((user.dossiers.first.id + 49).to_s)
expect(page.all(:css, '#dossiers-list tr')[2].text.split(" ").first).to eq((user.dossiers.first.id + 48).to_s)
visit "/users/dossiers?dossiers_smart_listing[sort][id]=asc"
expect(page.all(:css, '#dossiers-list tr')[1].text.split(" ").first).to eq(user.dossiers.first.id.to_s)
expect(page.all(:css, '#dossiers-list tr')[2].text.split(" ").first).to eq(user.dossiers.second.id.to_s)

View file

@ -13,7 +13,7 @@ describe DossierLinkHelper do
before { dossier.procedure.gestionnaires << gestionnaire }
it { expect(helper.dossier_linked_path(gestionnaire, dossier)).to eq(dossier_path(dossier.procedure, dossier)) }
it { expect(helper.dossier_linked_path(gestionnaire, dossier)).to eq(gestionnaire_dossier_path(dossier.procedure, dossier)) }
end
context "when access as expert" do
@ -21,7 +21,7 @@ describe DossierLinkHelper do
let(:gestionnaire) { create(:gestionnaire) }
let!(:avis) { create(:avis, dossier: dossier, gestionnaire: gestionnaire) }
it { expect(helper.dossier_linked_path(gestionnaire, dossier)).to eq(avis_path(avis)) }
it { expect(helper.dossier_linked_path(gestionnaire, dossier)).to eq(gestionnaire_avis_path(avis)) }
end
end
end

View file

@ -7,7 +7,7 @@ RSpec.describe AutoReceiveDossiersForProcedureJob, type: :job do
before { Timecop.freeze(date) }
after { Timecop.return }
subject { AutoReceiveDossiersForProcedureJob.new.perform(procedure_id, 'en_instruction') }
subject { AutoReceiveDossiersForProcedureJob.new.perform(procedure_id, state) }
context "with some dossiers" do
let(:nouveau_dossier1) { create(:dossier, :en_construction) }
@ -16,19 +16,46 @@ RSpec.describe AutoReceiveDossiersForProcedureJob, type: :job do
let(:dossier_brouillon) { create(:dossier, procedure: dossier_recu.procedure) }
let(:procedure_id) { dossier_brouillon.procedure_id }
it do
subject
expect(nouveau_dossier1.reload.en_instruction?).to be true
expect(nouveau_dossier1.reload.en_instruction_at).to eq(date)
context "en_construction" do
let(:state) { :en_instruction }
expect(nouveau_dossier2.reload.en_instruction?).to be true
expect(nouveau_dossier2.reload.en_instruction_at).to eq(date)
it do
subject
expect(nouveau_dossier1.reload.en_instruction?).to be true
expect(nouveau_dossier1.reload.en_instruction_at).to eq(date)
expect(dossier_recu.reload.en_instruction?).to be true
expect(dossier_recu.reload.en_instruction_at).to eq(date)
expect(nouveau_dossier2.reload.en_instruction?).to be true
expect(nouveau_dossier2.reload.en_instruction_at).to eq(date)
expect(dossier_brouillon.reload.brouillon?).to be true
expect(dossier_brouillon.reload.en_instruction_at).to eq(nil)
expect(dossier_recu.reload.en_instruction?).to be true
expect(dossier_recu.reload.en_instruction_at).to eq(date)
expect(dossier_brouillon.reload.brouillon?).to be true
expect(dossier_brouillon.reload.en_instruction_at).to eq(nil)
end
end
context "accepte" do
let(:state) { :accepte }
it do
subject
expect(nouveau_dossier1.reload.accepte?).to be true
expect(nouveau_dossier1.reload.en_instruction_at).to eq(date)
expect(nouveau_dossier1.reload.processed_at).to eq(date)
expect(nouveau_dossier2.reload.accepte?).to be true
expect(nouveau_dossier2.reload.en_instruction_at).to eq(date)
expect(nouveau_dossier2.reload.processed_at).to eq(date)
expect(dossier_recu.reload.en_instruction?).to be true
expect(dossier_recu.reload.en_instruction_at).to eq(date)
expect(dossier_recu.reload.processed_at).to eq(nil)
expect(dossier_brouillon.reload.brouillon?).to be true
expect(dossier_brouillon.reload.en_instruction_at).to eq(nil)
expect(dossier_brouillon.reload.processed_at).to eq(nil)
end
end
end
end

View file

@ -4,7 +4,7 @@ RSpec.describe WeeklyOverviewJob, type: :job do
describe 'perform' do
let!(:gestionnaire) { create(:gestionnaire) }
let(:overview) { double('overview') }
let(:mailer_double) { double('mailer', deliver_now: true) }
let(:mailer_double) { double('mailer', deliver_later: true) }
context 'if the feature is enabled' do
before { allow(Features).to receive(:weekly_overview).and_return(true) }
@ -16,8 +16,8 @@ RSpec.describe WeeklyOverviewJob, type: :job do
WeeklyOverviewJob.new.perform
end
it { expect(GestionnaireMailer).to have_received(:last_week_overview).with(gestionnaire, overview) }
it { expect(mailer_double).to have_received(:deliver_now) }
it { expect(GestionnaireMailer).to have_received(:last_week_overview).with(gestionnaire) }
it { expect(mailer_double).to have_received(:deliver_later) }
end
context 'with one gestionnaire with no overviews' do