diff --git a/Gemfile b/Gemfile
index ac6c7a849..7e1ca50c9 100644
--- a/Gemfile
+++ b/Gemfile
@@ -97,6 +97,8 @@ gem 'openstack'
gem 'browser'
+gem 'simple_form'
+
group :test do
gem 'capybara'
gem 'launchy'
@@ -117,11 +119,8 @@ end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
-
gem 'web-console'
-
gem 'rack-handlers'
-
gem 'xray-rails'
end
diff --git a/Gemfile.lock b/Gemfile.lock
index b30c53477..3cbdc6776 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -540,6 +540,9 @@ GEM
shellany (0.0.1)
shoulda-matchers (3.1.1)
activesupport (>= 4.0.0)
+ simple_form (3.4.0)
+ actionpack (> 4, < 5.1)
+ activemodel (> 4, < 5.1)
simplecov (0.12.0)
docile (~> 1.1.0)
json (>= 1.8, < 3)
@@ -688,6 +691,7 @@ DEPENDENCIES
selenium-webdriver
sentry-raven
shoulda-matchers
+ simple_form
simplecov
smart_listing
spreadsheet_architect
diff --git a/app/assets/javascripts/bootstrap_wysihtml5.js b/app/assets/javascripts/bootstrap_wysihtml5.js
index 4f1ed7bcf..b0606ce8a 100644
--- a/app/assets/javascripts/bootstrap_wysihtml5.js
+++ b/app/assets/javascripts/bootstrap_wysihtml5.js
@@ -3,6 +3,6 @@ $(document).on('page:load', wysihtml5_active);
function wysihtml5_active (){
$('.wysihtml5').each(function(i, elem) {
- $(elem).wysihtml5({ toolbar:{ "fa": true, "link": false, "color": true }, "locale": "fr-FR" });
+ $(elem).wysihtml5({ toolbar:{ "fa": true, "link": false, "color": false }, "locale": "fr-FR" });
});
-}
\ No newline at end of file
+}
diff --git a/app/assets/javascripts/description.js b/app/assets/javascripts/description.js
index 24a9e7e56..6df9f436d 100644
--- a/app/assets/javascripts/description.js
+++ b/app/assets/javascripts/description.js
@@ -18,14 +18,6 @@ function action_type_de_champs() {
toggleErrorClass(this, validatePhone(val));
});
- $("#liste_champs input").on('focus', function () {
- $("#description_" + this.id).slideDown();
- });
-
- $("#liste_champs input").on('blur', function () {
- $("#description_" + this.id).slideUp();
- });
-
address_type_init();
}
diff --git a/app/assets/stylesheets/_helpers.scss b/app/assets/stylesheets/_helpers.scss
new file mode 100644
index 000000000..6d861a826
--- /dev/null
+++ b/app/assets/stylesheets/_helpers.scss
@@ -0,0 +1,21 @@
+$default-spacer: 15px;
+
+.m-1 {
+ margin: $default-spacer;
+}
+
+.mt-1 {
+ margin-top: $default-spacer;
+}
+
+.mr-1 {
+ margin-right: $default-spacer;
+}
+
+.mb-1 {
+ margin-bottom: $default-spacer;
+}
+
+.ml-1 {
+ margin-left: $default-spacer;
+}
\ No newline at end of file
diff --git a/app/assets/stylesheets/_variables.scss b/app/assets/stylesheets/_variables.scss
new file mode 100644
index 000000000..daf479d2c
--- /dev/null
+++ b/app/assets/stylesheets/_variables.scss
@@ -0,0 +1 @@
+$font-size-base: 16px;
\ No newline at end of file
diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss
index 58f55fa66..5e30ef194 100644
--- a/app/assets/stylesheets/application.scss
+++ b/app/assets/stylesheets/application.scss
@@ -20,6 +20,7 @@
*= require franceconnect
*= require bootstrap-wysihtml5
*/
+@import "variables";
@import "bootstrap-sprockets";
@import "bootstrap";
@@ -143,10 +144,6 @@ textarea#description {
max-width: 27px;
}
-label {
- font-weight: normal;
-}
-
div.pagination {
padding-top: 20px;
display: block;
diff --git a/app/assets/stylesheets/carte.scss b/app/assets/stylesheets/carte.scss
index f1d7d4dbb..486e98b64 100644
--- a/app/assets/stylesheets/carte.scss
+++ b/app/assets/stylesheets/carte.scss
@@ -3,10 +3,6 @@
// You can use Sass (SCSS) here: http://sass-lang.com/
@import "bootstrap";
-table {
- font-size: 13px;
-}
-
#carte_page {
#map {
@extend .col-md-12;
diff --git a/app/assets/stylesheets/description.scss b/app/assets/stylesheets/description.scss
index dc24f6646..c471c10c1 100644
--- a/app/assets/stylesheets/description.scss
+++ b/app/assets/stylesheets/description.scss
@@ -7,9 +7,7 @@
.show-block {
width: 90%;
.body{
- padding-left: 35px;
- padding-right: 35px;
- padding-bottom: 35px;
+ padding: 15px;
}
}
}
@@ -134,10 +132,3 @@
width: 160px;
}
}
-
-.description_div {
- margin-top: 5px;
- margin-left: 5px;
- color: dimgrey;
- display: none;
-}
\ No newline at end of file
diff --git a/app/assets/stylesheets/dossier_show.scss b/app/assets/stylesheets/dossier_show.scss
index 3d9c6ba98..f840b193a 100644
--- a/app/assets/stylesheets/dossier_show.scss
+++ b/app/assets/stylesheets/dossier_show.scss
@@ -30,18 +30,6 @@
color: #000000;
margin-bottom: 10px;
}
- .new-action {
- background-color: #E45B51;
- text-align: center;
- cursor: pointer;
- color: #FFFFFF;
- width: 253px;
- height: 40px;
- line-height: 40px;
- font-family: Arial;
- font-size: 16px;
- font-weight: bold;
- }
.file {
padding-right: 70px;
text-align: center;
@@ -59,20 +47,7 @@
border-bottom: 1px solid #979797;
}
#new-commentaire {
- padding: 35px;
- .btn-send {
- background-color: #E45B51;
- text-align: center;
- color: #FFFFFF;
- width: 150px;
- height: 40px;
- line-height: 28px;
- font-family: Arial;
- font-size: 16px;
- font-weight: bold;
- float: right;
- border-radius: 0;
- }
+ padding: 15px;
}
}
.infos {
diff --git a/app/assets/stylesheets/left_pannel.scss b/app/assets/stylesheets/left_panel.scss
similarity index 99%
rename from app/assets/stylesheets/left_pannel.scss
rename to app/assets/stylesheets/left_panel.scss
index 7c8925c3f..0b250ab77 100644
--- a/app/assets/stylesheets/left_pannel.scss
+++ b/app/assets/stylesheets/left_panel.scss
@@ -1,4 +1,4 @@
-#left-pannel {
+#left-panel {
margin-top: 60px;
padding: 0;
background-color: #003189;
diff --git a/app/assets/stylesheets/navbar.scss b/app/assets/stylesheets/navbar.scss
index 3d8fd8ea5..dd22714b9 100644
--- a/app/assets/stylesheets/navbar.scss
+++ b/app/assets/stylesheets/navbar.scss
@@ -158,7 +158,6 @@
position: fixed;
bottom: 26px;
right: -35px;
- -webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
width: 150px;
background-color: #008cba;
@@ -207,4 +206,3 @@
font-size: 20px;
}
}
-
diff --git a/app/assets/stylesheets/print.scss b/app/assets/stylesheets/print.scss
index 9b9dc1fec..bdbc39347 100644
--- a/app/assets/stylesheets/print.scss
+++ b/app/assets/stylesheets/print.scss
@@ -1,6 +1,5 @@
@media print {
html, body {
- width: 900px;
margin: 0;
}
@@ -28,4 +27,39 @@
#backoffice_dossier_show .nav-tabs {
display: none;
}
+
+ #left-panel {
+ margin-top: 0;
+ height: auto;
+ position: relative;
+ width: 100%;
+ }
+
+ #wrap {
+ overflow: visible;
+ }
+
+ #main-container {
+ width: 100%;
+ }
+
+ #beta {
+ top: 26px;
+ bottom: initial;
+ position: absolute;
+ transform: rotate(45deg);
+ }
+
+ .copyright {
+ width: 100%;
+ left: 0;
+ }
+
+ .no-page-break-inside {
+ page-break-inside: avoid;
+ }
+
+ .display-block-on-print {
+ display: block !important;
+ }
}
diff --git a/app/assets/stylesheets/typeahead.scss b/app/assets/stylesheets/typeahead.scss
index 8cda8e19b..8d4c2a37c 100644
--- a/app/assets/stylesheets/typeahead.scss
+++ b/app/assets/stylesheets/typeahead.scss
@@ -1,3 +1,6 @@
+.twitter-typeahead {
+ width: 100%; // http://stackoverflow.com/questions/17957513/extending-the-width-of-bootstrap-typeahead-to-match-input-field
+}
.tt-menu {
padding: 8px 0;
diff --git a/app/controllers/admin/mail_templates_controller.rb b/app/controllers/admin/mail_templates_controller.rb
new file mode 100644
index 000000000..39f2b7955
--- /dev/null
+++ b/app/controllers/admin/mail_templates_controller.rb
@@ -0,0 +1,24 @@
+class Admin::MailTemplatesController < AdminController
+ before_action :retrieve_procedure
+
+ def index
+ @mail_templates = @procedure.mail_templates
+ end
+
+ def edit
+ @mail_template = @procedure.mail_templates.find(params[:id])
+ end
+
+ def update
+ mail_template = @procedure.mail_templates.find(params[:id])
+ mail_template.update_attributes(update_params)
+
+ redirect_to admin_procedure_mail_templates_path
+ end
+
+ private
+
+ def update_params
+ params.require(:mail_template).permit(:body, :object)
+ end
+end
diff --git a/app/controllers/admin/mails_controller.rb b/app/controllers/admin/mails_controller.rb
deleted file mode 100644
index 6101ac8c3..000000000
--- a/app/controllers/admin/mails_controller.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-class Admin::MailsController < AdminController
- before_action :retrieve_procedure
-
- def index
-
- end
-
- def update
- mail = current_administrateur.procedures.find(params[:procedure_id]).mail_templates.find(params[:id])
- mail.update_attributes(update_params)
-
- redirect_to admin_procedure_mails_path
- end
-
- private
-
- def update_params
- params.require(:mail_received).permit(:body, :object)
- end
-end
\ No newline at end of file
diff --git a/app/controllers/admin/pieces_justificatives_controller.rb b/app/controllers/admin/pieces_justificatives_controller.rb
index 7ed5c7ef5..c899e3486 100644
--- a/app/controllers/admin/pieces_justificatives_controller.rb
+++ b/app/controllers/admin/pieces_justificatives_controller.rb
@@ -6,8 +6,11 @@ class Admin::PiecesJustificativesController < AdminController
end
def update
- @procedure.update_attributes(update_params)
- flash.now.notice = 'Modifications sauvegardées'
+ if @procedure.update_attributes(update_params)
+ flash.now.notice = 'Modifications sauvegardées'
+ else
+ flash.now.notice = 'Une erreur est survenue'
+ end
render 'show', format: :js
end
@@ -22,7 +25,7 @@ class Admin::PiecesJustificativesController < AdminController
def update_params
params
.require(:procedure)
- .permit(types_de_piece_justificative_attributes: [:libelle, :description, :id, :order_place])
+ .permit(types_de_piece_justificative_attributes: [:libelle, :description, :id, :order_place, :lien_demarche])
end
def move_up
@@ -41,4 +44,4 @@ class Admin::PiecesJustificativesController < AdminController
render json: {}, status: 400
end
end
-end
\ No newline at end of file
+end
diff --git a/app/controllers/admin/procedures_controller.rb b/app/controllers/admin/procedures_controller.rb
index 2f7f11d1b..f67d739d7 100644
--- a/app/controllers/admin/procedures_controller.rb
+++ b/app/controllers/admin/procedures_controller.rb
@@ -3,7 +3,6 @@ class Admin::ProceduresController < AdminController
helper SmartListing::Helper
before_action :retrieve_procedure, only: [:show, :edit]
- before_action :procedure_locked?, only: [:edit]
def index
@procedures = smart_listing_create :procedures,
@@ -61,7 +60,7 @@ class Admin::ProceduresController < AdminController
end
def create
- @procedure = Procedure.new(create_procedure_params)
+ @procedure = Procedure.new(procedure_params)
@procedure.module_api_carto = ModuleAPICarto.new(create_module_api_carto_params) if @procedure.valid?
unless @procedure.save
@@ -76,12 +75,12 @@ class Admin::ProceduresController < AdminController
def update
@procedure = current_administrateur.procedures.find(params[:id])
- unless @procedure.update_attributes(create_procedure_params)
+ unless @procedure.update_attributes(procedure_params)
flash.now.alert = @procedure.errors.full_messages.join('
').html_safe
return render 'edit'
end
- flash.notice = 'Préocédure modifiée'
+ flash.notice = 'Procédure modifiée'
redirect_to edit_admin_procedure_path(id: @procedure.id)
end
@@ -192,8 +191,12 @@ class Admin::ProceduresController < AdminController
private
- def create_procedure_params
- params.require(:procedure).permit(:libelle, :description, :organisation, :direction, :lien_demarche, :lien_site_web, :lien_notice, :euro_flag, :logo, :cerfa_flag, :for_individual, :individual_with_siret, module_api_carto_attributes: [:id, :use_api_carto, :quartiers_prioritaires, :cadastre]).merge(administrateur_id: current_administrateur.id)
+ def procedure_params
+ if @procedure.try(:locked?)
+ params.require(:procedure).permit(:libelle, :description, :organisation, :direction, :lien_site_web, :lien_notice, :euro_flag, :logo)
+ else
+ params.require(:procedure).permit(:libelle, :description, :organisation, :direction, :lien_site_web, :lien_notice, :euro_flag, :logo, :lien_demarche, :cerfa_flag, :for_individual, :individual_with_siret, module_api_carto_attributes: [:id, :use_api_carto, :quartiers_prioritaires, :cadastre]).merge(administrateur_id: current_administrateur.id)
+ end
end
def create_module_api_carto_params
diff --git a/app/controllers/backoffice/dossiers_controller.rb b/app/controllers/backoffice/dossiers_controller.rb
index 43d679926..9237e091a 100644
--- a/app/controllers/backoffice/dossiers_controller.rb
+++ b/app/controllers/backoffice/dossiers_controller.rb
@@ -56,7 +56,10 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
@search_terms = params[:q]
# exact id match?
- @dossiers = Dossier.where(id: @search_terms.to_i) if @search_terms.to_i < 2147483647
+ if @search_terms.to_i != 0
+ @dossiers = current_gestionnaire.dossiers.where(id: @search_terms.to_i)
+ end
+
@dossiers = Dossier.none if @dossiers.nil?
# full text search
@@ -158,6 +161,15 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
render 'backoffice/dossiers/index', formats: :js
end
+ def archive
+ facade = create_dossier_facade params[:dossier_id]
+ unless facade.dossier.archived
+ facade.dossier.update(archived: true)
+ flash.notice = 'Dossier archivé'
+ end
+ redirect_to backoffice_dossiers_path
+ end
+
private
def create_dossier_facade dossier_id
diff --git a/app/controllers/backoffice/preference_list_dossier_controller.rb b/app/controllers/backoffice/preference_list_dossier_controller.rb
index 5ab0391ce..1e58aac67 100644
--- a/app/controllers/backoffice/preference_list_dossier_controller.rb
+++ b/app/controllers/backoffice/preference_list_dossier_controller.rb
@@ -36,7 +36,7 @@ class Backoffice::PreferenceListDossierController < Backoffice::DossiersListCont
private
def path
- Features.opensimplif ? 'opensimplif/pref_list' : 'backoffice/dossiers/pref_list'
+ 'backoffice/dossiers/pref_list'
end
def params_procedure_id
diff --git a/app/controllers/opensimplif_controller.rb b/app/controllers/opensimplif_controller.rb
deleted file mode 100644
index ff5305427..000000000
--- a/app/controllers/opensimplif_controller.rb
+++ /dev/null
@@ -1,61 +0,0 @@
-class OpensimplifController < Backoffice::Dossiers::ProcedureController
- def index
- if params[:id].nil?
- procedure = current_gestionnaire.procedures.order('libelle ASC').first
-
- if procedure.nil?
- return redirect_to simplifications_nothing_path
- else
- return redirect_to simplification_path(id: procedure.id)
- end
- end
-
- smartlisting_dossier
- end
-
- def nothing
-
- end
-
- def reload_smartlisting
- smartlisting_dossier
-
- render 'opensimplif/index', formats: :js
- end
-
- private
-
- def smartlisting_dossier dossiers_list=nil, liste='all_state'
- dossiers_list_facade liste
-
- mes_dossiers_list = current_user.dossiers
- follow_dossiers_list = dossiers_list_facade.service.suivi
- all_state_dossiers_list = dossiers_list_facade.service.all_state
-
- if param_page.nil?
- params[:dossiers_smart_listing] = {page: dossiers_list_facade.service.default_page}
- end
-
- smart_listing_create :mes_dossiers,
- mes_dossiers_list,
- partial: "backoffice/dossiers/list",
- array: true,
- default_sort: dossiers_list_facade.service.default_sort
-
- smart_listing_create :follow_dossiers,
- follow_dossiers_list,
- partial: "backoffice/dossiers/list",
- array: true,
- default_sort: dossiers_list_facade.service.default_sort
-
- smart_listing_create :all_state_dossiers,
- all_state_dossiers_list,
- partial: "backoffice/dossiers/list",
- array: true,
- default_sort: dossiers_list_facade.service.default_sort
- end
-
- def dossiers_list_facade liste='all_state'
- @facade_data_view ||= DossiersListFacades.new current_gestionnaire, liste, retrieve_procedure
- end
-end
diff --git a/app/controllers/root_controller.rb b/app/controllers/root_controller.rb
index 0bf6de2b4..61500da6b 100644
--- a/app/controllers/root_controller.rb
+++ b/app/controllers/root_controller.rb
@@ -7,12 +7,6 @@ class RootController < ApplicationController
route = Rails.application.routes.recognize_path(new_user_session_path)
end
- if Features.opensimplif
- unless !user_signed_in? && !administrateur_signed_in? && !gestionnaire_signed_in?
- return redirect_to simplifications_path
- end
- end
-
if user_signed_in? && !route[:controller].match('users').nil?
return redirect_to users_dossiers_path
@@ -43,6 +37,8 @@ class RootController < ApplicationController
return redirect_to administrations_path
end
+ @demo_environment_host = "https://tps-dev.apientreprise.fr" unless Rails.env.development?
+
render 'landing'
end
end
diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb
index 979c8887d..6fef62105 100644
--- a/app/controllers/users/sessions_controller.rb
+++ b/app/controllers/users/sessions_controller.rb
@@ -29,8 +29,6 @@ class Users::SessionsController < Sessions::SessionsController
current_user.update_attributes(loged_in_with_france_connect: '')
end
- check_opensimplif if Features.opensimplif
-
if user_signed_in?
redirect_to after_sign_in_path_for(:user)
elsif gestionnaire_signed_in?
@@ -74,18 +72,6 @@ class Users::SessionsController < Sessions::SessionsController
private
- def check_opensimplif
- return if (user_signed_in? && gestionnaire_signed_in?) || administrateur_signed_in?
-
- if gestionnaire_signed_in?
- User.create email: params[:user][:email], password: params[:user][:password]
- try_to_authenticate User
- elsif user_signed_in?
- Gestionnaire.create email: params[:user][:email], password: params[:user][:password]
- try_to_authenticate Gestionnaire
- end
- end
-
def error_procedure
flash.alert = t('errors.messages.procedure_not_found')
redirect_to url_for root_path
@@ -101,6 +87,7 @@ class Users::SessionsController < Sessions::SessionsController
if resource = klass.find_for_database_authentication(email: params[:user][:email])
if resource.valid_password?(params[:user][:password])
sign_in resource
+ resource.force_sync_credentials
set_flash_message :notice, :signed_in
end
end
diff --git a/app/decorators/champ_decorator.rb b/app/decorators/champ_decorator.rb
index 6713e5049..42c9639e4 100644
--- a/app/decorators/champ_decorator.rb
+++ b/app/decorators/champ_decorator.rb
@@ -7,4 +7,9 @@ class ChampDecorator < Draper::Decorator
end
object.value
end
-end
\ No newline at end of file
+
+ def description_with_links
+ description.gsub(URI.regexp, '\0').html_safe if description
+ end
+
+end
diff --git a/app/decorators/mail_template_decorator.rb b/app/decorators/mail_template_decorator.rb
new file mode 100644
index 000000000..4c61981d6
--- /dev/null
+++ b/app/decorators/mail_template_decorator.rb
@@ -0,0 +1,14 @@
+class MailTemplateDecorator < Draper::Decorator
+ delegate_all
+
+ def name
+ case object.type
+ when "MailReceived"
+ "E-mail d'accusé de réception"
+ when "MailValidated"
+ "E-mail de validation"
+ else
+ object.type
+ end
+ end
+end
diff --git a/app/decorators/procedure_decorator.rb b/app/decorators/procedure_decorator.rb
index f78a02d88..561e6754b 100644
--- a/app/decorators/procedure_decorator.rb
+++ b/app/decorators/procedure_decorator.rb
@@ -11,9 +11,17 @@ class ProcedureDecorator < Draper::Decorator
end
def logo_img
- return h.image_url(LOGO_NAME) if logo.blank?
- File.join(STORAGE_URL, File.basename(logo.path))
+ if logo.blank?
+ h.image_url(LOGO_NAME)
+ else
+ if Features.remote_storage
+ (RemoteDownloader.new logo.filename).url
+ else
+ (LocalDownloader.new logo.path, 'logo').url
+ end
+ end
end
+
def geographic_information
module_api_carto
end
diff --git a/app/decorators/type_de_champ_decorator.rb b/app/decorators/type_de_champ_decorator.rb
index d149996a7..ffe824855 100644
--- a/app/decorators/type_de_champ_decorator.rb
+++ b/app/decorators/type_de_champ_decorator.rb
@@ -39,4 +39,4 @@ class TypeDeChampDecorator < Draper::Decorator
@count_type_de_champ ||= procedure.types_de_champ.count
end
end
-end
\ No newline at end of file
+end
diff --git a/app/facades/dossiers_list_facades.rb b/app/facades/dossiers_list_facades.rb
index e6e11a353..52e5672ea 100644
--- a/app/facades/dossiers_list_facades.rb
+++ b/app/facades/dossiers_list_facades.rb
@@ -6,7 +6,6 @@ class DossiersListFacades
def initialize current_devise_profil, liste, procedure = nil
@current_devise_profil = current_devise_profil
@liste = liste
- @liste = 'all_state' if Features.opensimplif
@procedure = procedure
end
diff --git a/app/mailers/notification_mailer.rb b/app/mailers/notification_mailer.rb
index f42be257c..f23e501f4 100644
--- a/app/mailers/notification_mailer.rb
+++ b/app/mailers/notification_mailer.rb
@@ -4,11 +4,11 @@ class NotificationMailer < ApplicationMailer
end
def dossier_received dossier
- send_mail dossier, MailTemplate.replace_tags(dossier.procedure.mail_received.object, dossier)
+ send_mail dossier, dossier.procedure.mail_received.object_for_dossier(dossier)
end
def dossier_validated dossier
- send_mail dossier, "Votre dossier TPS N°#{dossier.id} a été validé"
+ send_mail dossier, dossier.procedure.mail_validated.object_for_dossier(dossier)
end
def dossier_submitted dossier
diff --git a/app/models/administrateur.rb b/app/models/administrateur.rb
index b2882fb62..ab69d0339 100644
--- a/app/models/administrateur.rb
+++ b/app/models/administrateur.rb
@@ -6,7 +6,8 @@ class Administrateur < ActiveRecord::Base
has_many :procedures
before_save :ensure_api_token
- after_update :sync_credentials
+
+ include CredentialsSyncableConcern
def ensure_api_token
if api_token.nil?
@@ -27,10 +28,4 @@ class Administrateur < ActiveRecord::Base
end
end
- def sync_credentials
- if email_changed? || encrypted_password_changed?
- return SyncCredentialsService.new(Administrateur, email_was, email, encrypted_password).change_credentials!
- end
- true
- end
end
diff --git a/app/models/concerns/credentials_syncable_concern.rb b/app/models/concerns/credentials_syncable_concern.rb
new file mode 100644
index 000000000..f1ee62df8
--- /dev/null
+++ b/app/models/concerns/credentials_syncable_concern.rb
@@ -0,0 +1,19 @@
+module CredentialsSyncableConcern
+ extend ActiveSupport::Concern
+
+ included do
+ after_update :sync_credentials
+ end
+
+ def sync_credentials
+ if email_changed? || encrypted_password_changed?
+ return force_sync_credentials
+ end
+ true
+ end
+
+ def force_sync_credentials
+ SyncCredentialsService.new(self.class, email_was, email, encrypted_password).change_credentials!
+ end
+
+end
diff --git a/app/models/dossier.rb b/app/models/dossier.rb
index ee3288d98..90eed3839 100644
--- a/app/models/dossier.rb
+++ b/app/models/dossier.rb
@@ -309,6 +309,10 @@ class Dossier < ActiveRecord::Base
end
end
+ def followers_gestionnaires_emails
+ follows.includes(:gestionnaire).map { |f| f.gestionnaire }.pluck(:email).join(' ')
+ end
+
def reset!
etablissement.destroy
entreprise.destroy
diff --git a/app/models/gestionnaire.rb b/app/models/gestionnaire.rb
index 6836c06c3..ada358189 100644
--- a/app/models/gestionnaire.rb
+++ b/app/models/gestionnaire.rb
@@ -14,7 +14,8 @@ class Gestionnaire < ActiveRecord::Base
after_create :build_default_preferences_list_dossier
after_create :build_default_preferences_smart_listing_page
- after_update :sync_credentials
+
+ include CredentialsSyncableConcern
def dossiers_follow
@dossiers_follow ||= dossiers.joins(:follows).where("follows.gestionnaire_id = #{id}")
@@ -119,11 +120,4 @@ class Gestionnaire < ActiveRecord::Base
couples.include?({table: table, column: column})
end
-
- def sync_credentials
- if email_changed? || encrypted_password_changed?
- return SyncCredentialsService.new(Gestionnaire, email_was, email, encrypted_password).change_credentials!
- end
- true
- end
end
diff --git a/app/models/mail_template.rb b/app/models/mail_template.rb
index d51c8dbb8..eac1020f9 100644
--- a/app/models/mail_template.rb
+++ b/app/models/mail_template.rb
@@ -1,31 +1,46 @@
class MailTemplate < ActiveRecord::Base
+ include Rails.application.routes.url_helpers
+ include ActionView::Helpers::UrlHelper
+
belongs_to :procedure
- enum tags: {
- numero_dossier: {
- description: "Permet d'afficher le numéro de dossier de l'utilisateur."
- },
- libelle_procedure: {
- description: "Permet d'afficher le libellé de la procédure."
- }
- }
+ TAGS = {
+ numero_dossier: {
+ description: "Permet d'afficher le numéro de dossier de l'utilisateur."
+ },
+ lien_dossier: {
+ description: "Permet d'afficher un lien vers le dossier de l'utilisateur."
+ },
+ libelle_procedure: {
+ description: "Permet d'afficher le libellé de la procédure."
+ }
+ }
- def self.replace_tags string, dossier
- @dossier = dossier
+ def object_for_dossier dossier
+ replace_tags(object, dossier)
+ end
- tags.inject(string) do |acc, tag|
- acc.gsub!("--#{tag.first}--", replace_tag(tag.first.to_sym)) || acc
+ def body_for_dossier dossier
+ replace_tags(body, dossier)
+ end
+
+ def replace_tags string, dossier
+ TAGS.inject(string) do |acc, tag|
+ acc.gsub!("--#{tag.first}--", replace_tag(tag.first.to_sym, dossier)) || acc
end
end
private
- def self.replace_tag tag
+ def replace_tag tag, dossier
case tag
when :numero_dossier
- @dossier.id.to_s
+ dossier.id.to_s
+ when :lien_dossier
+ # TPS::Application::URL # quickfix
+ link_to users_dossier_recapitulatif_url(dossier), users_dossier_recapitulatif_url(dossier), target: '_blank'
when :libelle_procedure
- @dossier.procedure.libelle
+ dossier.procedure.libelle
else
'--BALISE_NON_RECONNUE--'
end
diff --git a/app/models/mail_validated.rb b/app/models/mail_validated.rb
new file mode 100644
index 000000000..2691c4181
--- /dev/null
+++ b/app/models/mail_validated.rb
@@ -0,0 +1,18 @@
+class MailValidated < MailTemplate
+ before_save :default_values
+
+ def default_values
+ self.object ||= "[TPS] Votre dossier TPS N°--numero_dossier-- a été validé"
+ self.body ||= "Bonjour,
+
+ Votre dossier N°--numero_dossier-- est prêt à être déposé pour instruction.
+
+ Afin de finaliser son dépôt, merci de vous rendre sur --lien_dossier--.,
+
+ Bonne journée,
+ ---
+ Merci de ne pas répondre à ce mail. Postez directement vos questions dans votre dossier sur la plateforme.
+ ---
+ L'équipe TPS"
+ end
+end
diff --git a/app/models/procedure.rb b/app/models/procedure.rb
index 9a81ed2b6..a70b7bcdd 100644
--- a/app/models/procedure.rb
+++ b/app/models/procedure.rb
@@ -5,6 +5,7 @@ class Procedure < ActiveRecord::Base
has_many :dossiers
has_many :mail_templates
has_one :mail_received
+ has_one :mail_validated
has_one :procedure_path, dependent: :destroy
@@ -29,10 +30,11 @@ class Procedure < ActiveRecord::Base
validates :libelle, presence: true, allow_blank: false, allow_nil: false
validates :description, presence: true, allow_blank: false, allow_nil: false
- after_save :build_default_mails, if: Proc.new { id_changed? }
+ after_create :build_default_mails
def build_default_mails
- MailReceived.create(procedure: self)
+ MailReceived.create(procedure: self) unless mail_received
+ MailValidated.create(procedure: self) unless mail_validated
end
def path
@@ -109,4 +111,5 @@ class Procedure < ActiveRecord::Base
def total_dossier
self.dossiers.where.not(state: :draft).size
end
+
end
diff --git a/app/models/type_de_piece_justificative.rb b/app/models/type_de_piece_justificative.rb
index 6ab69f5a6..7bdb8ac42 100644
--- a/app/models/type_de_piece_justificative.rb
+++ b/app/models/type_de_piece_justificative.rb
@@ -4,4 +4,6 @@ class TypeDePieceJustificative < ActiveRecord::Base
belongs_to :procedure
validates :libelle, presence: true, allow_blank: false, allow_nil: false
+
+ validates :lien_demarche, format: { with: URI::regexp }, allow_blank: true, allow_nil: true
end
diff --git a/app/models/user.rb b/app/models/user.rb
index 34d245e48..7ea29d260 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -15,7 +15,8 @@ class User < ActiveRecord::Base
delegate :given_name, :family_name, :email_france_connect, :gender, :birthdate, :birthplace, :france_connect_particulier_id, to: :france_connect_information
accepts_nested_attributes_for :france_connect_information
- after_update :sync_credentials
+
+ include CredentialsSyncableConcern
def self.find_for_france_connect email, siret
user = User.find_by_email(email)
@@ -35,12 +36,4 @@ class User < ActiveRecord::Base
invites.pluck(:dossier_id).include?(dossier_id.to_i)
end
- private
-
- def sync_credentials
- if email_changed? || encrypted_password_changed?
- return SyncCredentialsService.new(User, email_was, email, encrypted_password).change_credentials!
- end
- true
- end
end
diff --git a/app/serializers/dossier_procedure_serializer.rb b/app/serializers/dossier_procedure_serializer.rb
index 278c6d4ce..c0d694d59 100644
--- a/app/serializers/dossier_procedure_serializer.rb
+++ b/app/serializers/dossier_procedure_serializer.rb
@@ -5,4 +5,6 @@ class DossierProcedureSerializer < ActiveModel::Serializer
:archived,
:mandataire_social,
:state
+
+ attribute :followers_gestionnaires_emails, key: :emails_accompagnateurs
end
diff --git a/app/serializers/type_de_piece_justificative_serializer.rb b/app/serializers/type_de_piece_justificative_serializer.rb
index 9dc1743b0..cff798508 100644
--- a/app/serializers/type_de_piece_justificative_serializer.rb
+++ b/app/serializers/type_de_piece_justificative_serializer.rb
@@ -2,5 +2,6 @@ class TypeDePieceJustificativeSerializer < ActiveModel::Serializer
attributes :id,
:libelle,
:description,
- :order_place
-end
\ No newline at end of file
+ :order_place,
+ :lien_demarche
+end
diff --git a/app/services/sync_credentials_service.rb b/app/services/sync_credentials_service.rb
index 491ec1d55..06d912b29 100644
--- a/app/services/sync_credentials_service.rb
+++ b/app/services/sync_credentials_service.rb
@@ -11,7 +11,7 @@ class SyncCredentialsService
unless @klass == User
user = User.find_by(email: @email_was)
if user
- return user.update_columns(
+ return false unless user.update_columns(
email: @email,
encrypted_password: @encrypted_password)
end
@@ -20,7 +20,7 @@ class SyncCredentialsService
unless @klass == Gestionnaire
gestionnaire = Gestionnaire.find_by(email: @email_was)
if gestionnaire
- return gestionnaire.update_columns(
+ return false unless gestionnaire.update_columns(
email: @email,
encrypted_password: @encrypted_password)
end
@@ -29,10 +29,12 @@ class SyncCredentialsService
unless @klass == Administrateur
administrateur = Administrateur.find_by(email: @email_was)
if administrateur
- return administrateur.update_columns(
+ return false unless administrateur.update_columns(
email: @email,
encrypted_password: @encrypted_password)
end
end
+
+ true
end
end
diff --git a/app/uploaders/base_uploader.rb b/app/uploaders/base_uploader.rb
index b575299d8..f7023f4f2 100644
--- a/app/uploaders/base_uploader.rb
+++ b/app/uploaders/base_uploader.rb
@@ -3,11 +3,7 @@
class BaseUploader < CarrierWave::Uploader::Base
def cache_dir
if Rails.env.production?
- if Features.opensimplif?
- '/tmp/opensimplif-cache'
- else
- '/tmp/tps-cache'
- end
+ '/tmp/tps-cache'
else
'/tmp/tps-dev-cache'
end
diff --git a/app/views/admin/accompagnateurs/_list_not_assign.html.haml b/app/views/admin/accompagnateurs/_list_not_assign.html.haml
index e5b206f97..3eb519dcd 100644
--- a/app/views/admin/accompagnateurs/_list_not_assign.html.haml
+++ b/app/views/admin/accompagnateurs/_list_not_assign.html.haml
@@ -14,7 +14,7 @@
- @accompagnateurs_not_assign.each do |accompagnateur|
%tr
- %td.col-md-11.col-sm-11.col-xs-11.col-lg-11{style:'padding-top: 11px; font-size:15px'}= accompagnateur.email
+ %td.col-xs-11{style:'padding-top: 11px; font-size:15px'}= accompagnateur.email
%td.center
%a.btn.btn-success.gestionnaire-affectation{href: "#{admin_procedure_accompagnateurs_path(procedure_id: @procedure.id, accompagnateur_id: accompagnateur.id, to: AccompagnateurService::ASSIGN)}", 'data-method' => 'put'}
.fa.fa-arrow-right
diff --git a/app/views/admin/accompagnateurs/show.html.haml b/app/views/admin/accompagnateurs/show.html.haml
index 114f3729f..d62a10c54 100644
--- a/app/views/admin/accompagnateurs/show.html.haml
+++ b/app/views/admin/accompagnateurs/show.html.haml
@@ -1,7 +1,7 @@
.row.white-back
#accompagnateur_form
.row
- .col-md-6.col-sm-6.col-xs-6.col-lg-6
+ .col-xs-6
%h3.text-info Disponibles
= smart_listing_render :accompagnateurs_not_assign
@@ -11,13 +11,13 @@
#procedure_new.section.section-label
= form_for @gestionnaire, url: {controller: 'admin/gestionnaires', action: :create} do |f|
.row
- .col-md-5.col-sm-5.col-xs-5.col-lg-5
+ .col-xs-5
= hidden_field_tag :procedure_id, params[:procedure_id]
=render partial: 'admin/gestionnaires/informations', locals: {f: f}
- .col-md-2.col-sm-2.col-xs-2.col-lg-2
+ .col-xs-2
%br
%br
= f.submit 'Valider', class: 'btn btn-info', style: 'float:left', id: 'add-gestionnaire-email'
- .col-md-6.col-sm-6.col-xs-6.col-lg-6
+ .col-xs-6
%h3.text-success Affectés
= smart_listing_render :accompagnateurs_assign
diff --git a/app/views/admin/gestionnaires/index.html.haml b/app/views/admin/gestionnaires/index.html.haml
index 23860546f..aa9836843 100644
--- a/app/views/admin/gestionnaires/index.html.haml
+++ b/app/views/admin/gestionnaires/index.html.haml
@@ -2,18 +2,18 @@
%br
.row
- .col-md-4.col-sm-4.col-xs-4.col-lg-4
+ .col-xs-4
= smart_listing_render :gestionnaires
- .col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1
+ .col-xs-1
- .col-md-6.col-sm-6.col-xs-6.col-lg-6
+ .col-xs-6
%h3 Ajouter un accompagnateur
#procedure_new.section.section-label
= form_for @gestionnaire, url: {controller: 'admin/gestionnaires', action: :create} do |f|
.row
- .col-md-5.col-sm-5.col-xs-5.col-lg-5
+ .col-xs-5
= render partial: 'informations', locals: {f: f}
- .col-md-2.col-sm-2.col-xs-2.col-lg-2
+ .col-xs-2
%br
%br
= f.submit 'Valider', class: 'btn btn-info', style: 'float:left'
diff --git a/app/views/admin/mail_templates/edit.html.haml b/app/views/admin/mail_templates/edit.html.haml
new file mode 100644
index 000000000..8b02f1b78
--- /dev/null
+++ b/app/views/admin/mail_templates/edit.html.haml
@@ -0,0 +1,28 @@
+.white-back
+ %h3
+ = @mail_template.decorate.name
+
+ = simple_form_for @mail_template.becomes(MailTemplate), url: admin_procedure_mail_template_path(@procedure, @mail_template) do |f|
+ .row
+ .col-md-6
+ = f.input :object, label: "Objet de l'email"
+ = f.input :body, label: "Corps de l'email", input_html: {class: 'wysihtml5'}
+ .text-right
+ = link_to "Annuler", admin_procedure_mail_templates_path(@procedure), class: "btn btn-default"
+ = f.button :submit, 'Mettre à jour', class: "btn-success"
+
+ .row
+ .col-md-8
+ %table.table
+ %tr
+ %th
+ Balise
+ %th
+ Description
+ - MailTemplate::TAGS.each do |balise|
+ %tr
+ %td.center
+ %b.text-success
+ = "--#{balise.first}--"
+ %td
+ =balise.second[:description]
diff --git a/app/views/admin/mail_templates/index.html.haml b/app/views/admin/mail_templates/index.html.haml
new file mode 100644
index 000000000..8f7df9420
--- /dev/null
+++ b/app/views/admin/mail_templates/index.html.haml
@@ -0,0 +1,15 @@
+.row.white-back
+ %h1 E-mails personnalisables
+
+ .row
+ .col-md-6
+ %table.table
+ %tr
+ %th{ colspan: 2 }
+ Type d'email
+ - @procedure.mail_templates.each do |mt|
+ %tr
+ %td
+ = mt.decorate.name
+ %td.text-right
+ = link_to "Personnaliser l'e-mail", edit_admin_procedure_mail_template_path(@procedure, mt)
diff --git a/app/views/admin/mails/index.html.haml b/app/views/admin/mails/index.html.haml
deleted file mode 100644
index 14c6db2eb..000000000
--- a/app/views/admin/mails/index.html.haml
+++ /dev/null
@@ -1,28 +0,0 @@
-.row.white-back
- %h3
- E-mail d'accusé de réception
-
- - unless @procedure.mail_received.blank?
- = form_for @procedure.mail_received, url: {controller: 'admin/mails', action: 'update', id: @procedure.mail_received.id} do |f|
- =f.text_field :object, {class:'form-control', style:'width: 40%'}
- %br
- =f.text_area :body, {class: 'form-control wysihtml5'}
- %br
- =f.submit 'Mettre à jour', {class:'btn btn-success', style:'float: right'}
-
-
- %table.table{style:'width: 50%'}
- %tr
- %th
- Balise
- %th
- Description
- - MailTemplate.tags.each do |balise|
- %tr
- %td.center
- %b.text-success
- \--
- = balise.first
- \--
- %td
- =balise.second[:description]
diff --git a/app/views/admin/pieces_justificatives/_fields.html.haml b/app/views/admin/pieces_justificatives/_fields.html.haml
index f44cf396a..7c7871a32 100644
--- a/app/views/admin/pieces_justificatives/_fields.html.haml
+++ b/app/views/admin/pieces_justificatives/_fields.html.haml
@@ -6,6 +6,12 @@
.form-group
%h4 Description
=ff.text_area :description, class: 'form-control description', placeholder: 'Description'
+ .form-group
+ %h4
+ Lien du formulaire vierge
+ %small
+ (optionel)
+ =ff.url_field :lien_demarche, class: 'form-control', placeholder: 'Lien du document vierge'
.form-group
= ff.hidden_field :order_place, value: ff.index
@@ -23,4 +29,3 @@
= f.submit('Ajouter la pièce', class: 'btn btn-success', id: 'add_piece_justificative')
- else
= link_to("", admin_procedure_piece_justificative_path(@procedure, ff.object.id), method: :delete, remote: true, id: "delete_type_de_piece_justificative_#{ff.object.id}", class: %w(form-control btn btn-danger fa fa-trash-o) )
-
diff --git a/app/views/admin/procedures/_informations.html.haml b/app/views/admin/procedures/_informations.html.haml
index dfbbcaf67..833f5fee3 100644
--- a/app/views/admin/procedures/_informations.html.haml
+++ b/app/views/admin/procedures/_informations.html.haml
@@ -1,5 +1,7 @@
-%br
+- if @procedure.locked?
+ .alert.alert-info
+ Cette procédure est publiée, certains éléments de la description ne sont plus modifiables
-{libelle: 'Libellé*', description: 'Description*', organisation: 'Organisation', direction: 'Direction', lien_site_web: 'Lien site internet', lien_notice: 'Lien notice'}.each do |key, value|
.form-group
@@ -12,64 +14,69 @@
= f.text_field key, class: 'form-control', placeholder: value
.row
- .col-md-6.col-sm-6.col-xs-6.col-lg-6
+ .col-md-6
%h4 Logo de la procédure
- unless @procedure.logo.blank?
= image_tag @procedure.decorate.logo_img, {style: 'height: 40px; display: inline; margin-right: 6px', id: 'preview_procedure_logo'}
- = f.file_field(:logo, accept: 'image/png, image/jpg, image/jpeg', style: 'display:inline')
+ = f.file_field :logo, accept: 'image/png, image/jpg, image/jpeg', style: 'display:inline'
%div{style:'margin-top:5px'}
%i
Fichier accepté : JPG / JPEG / PNG
- .col-md-6.col-sm-6.col-xs-6.col-lg-6
+ .col-md-6
%h4 Drapeau européen
- %label
- =f.check_box :euro_flag
- Afficher le drapeau européen
-
-%br
-
-.row
- .col-md-6.col-sm-6.col-xs-6.col-lg-6
- %h4 Cartographie
-
- = f.fields_for :module_api_carto, @procedure.module_api_carto do |ff|
+ .checkbox
%label
- =ff.check_box :use_api_carto, {id: :procedure_module_api_carto_use_api_carto}
- Utilisation de la cartographie
+ =f.check_box :euro_flag
+ Afficher le drapeau européen
- %ul#modules_api_carto
- %li
+- unless @procedure.locked?
+ .row
+ .col-md-6
+ %h4 Cartographie
+
+ = f.fields_for :module_api_carto, @procedure.module_api_carto do |ff|
+ .checkbox
%label
- = ff.check_box :quartiers_prioritaires
- Quartiers Prioritaires
- %li
+ =ff.check_box :use_api_carto, id: :procedure_module_api_carto_use_api_carto
+ Utilisation de la cartographie
+
+ %ul#modules_api_carto
+ %li
+ .checkbox
+ %label
+ = ff.check_box :quartiers_prioritaires
+ Quartiers Prioritaires
+ %li
+ .checkbox
+ %label
+ = ff.check_box :cadastre
+ Cadastre
+
+ .col-md-6
+ - if @procedure.cerfa_flag
+ %h4 Formulaire de demande ou CERFA
+ .checkbox
%label
- = ff.check_box :cadastre
- Cadastre
+ = f.check_box :cerfa_flag
+ Activer l'envoi de formulaire de demande ou CERFA
+ %br
+ = f.text_field :lien_demarche, class: 'form-control', placeholder: 'URL vers le formulaire vierge (facultatif)'
- .col-md-6.col-sm-6.col-xs-6.col-lg-6
- %h4 Formulaire de demande ou CERFA
- %label
- =f.check_box :cerfa_flag
- Activer l'envoi de formulaire de demande ou CERFA
- %br
- =f.text_field :lien_demarche, class: 'form-control', placeholder: 'URL vers le formulaire vierge (facultatif)'
+ .row
+ .col-md-6
+ %h4 Particuliers
+ .checkbox
+ %label
+ =f.check_box :for_individual
+ Cette procédure s'adresse à un public qui
+ %b
+ ne possède pas (ou pas encore) de numéro SIRET,
+ qui doivent donc s'identifier en tant que personne physique.
-%br
-.row
- .col-md-6.col-sm-6.col-xs-6.col-lg-6
- %h4 Particuliers
- %div
- %label
- =f.check_box :for_individual
- Cette procédure s'adresse à un public qui
- %b
- ne possède pas (ou pas encore) de numéro SIRET,
- qui doivent donc s'identifier en tant que personne physique.
-
- %ul#individual_with_siret{style:'margin-top: 8px'}
+ %ul#individual_with_siret
%li
- %label
- =f.check_box :individual_with_siret
- Donner la possibilité de renseigner un SIRET au cours de la construction du dossier.
+ .checkbox
+ %label
+ = f.check_box :individual_with_siret
+ Donner la possibilité de renseigner un SIRET au cours de la construction du dossier.
diff --git a/app/views/admin/procedures/_list.html.haml b/app/views/admin/procedures/_list.html.haml
index e1ae6bfb4..ba30f2e6f 100644
--- a/app/views/admin/procedures/_list.html.haml
+++ b/app/views/admin/procedures/_list.html.haml
@@ -12,7 +12,7 @@
- procedure = procedure.decorate
%tr{id: "tr_dossier_#{procedure.id}", 'data-dossier_url' => admin_procedure_path(id: procedure.id)}
%td= procedure.id
- %td.col-md-6.col-sm-6.col-xs-6.col-lg-6
+ %td.col-xs-6
= procedure.libelle
- if @active_class
%td= link_to procedure.lien, procedure.lien, class: 'procedure-lien', 'data-method' => :get
diff --git a/app/views/admin/procedures/edit.html.haml b/app/views/admin/procedures/edit.html.haml
index c1a2c7dbe..de42e8835 100644
--- a/app/views/admin/procedures/edit.html.haml
+++ b/app/views/admin/procedures/edit.html.haml
@@ -2,6 +2,5 @@
#procedure_new.section.section-label
= form_for @procedure, url: url_for({controller: 'admin/procedures', action: :update, id: @procedure.id}), multipart: true do |f|
= render partial: 'informations', locals: {f: f}
- = f.submit 'Editer', class: 'btn btn-success', style: 'float:right'
- %br
- %br
+ .text-right
+ = f.submit 'Enregistrer', class: 'btn btn-success'
diff --git a/app/views/admin/procedures/show.html.haml b/app/views/admin/procedures/show.html.haml
index f13f46bfb..e0c945cff 100644
--- a/app/views/admin/procedures/show.html.haml
+++ b/app/views/admin/procedures/show.html.haml
@@ -39,17 +39,14 @@
Annuler
- if @facade.procedure.locked?
- #procedure_locked.center
- %h5
- .label.label-info La procédure ne peut plus être modifiée car elle a été publiée
+ #procedure_locked
+ .alert.alert-info
+ Cette procédure a été publiée, certains éléments ne peuvent plus être modifiés.
%div
%h3 Lien procédure
%div{style:'margin-left:3%'}
- - if @facade.procedure.archived?
- %b
- Cette procédure a été archivée et n'est plus accessible par le public.
- - elsif @facade.procedure.published?
+ - if @facade.procedure.published?
= link_to @facade.procedure.lien, @facade.procedure.lien, target: '_blank'
- else
%b
@@ -70,18 +67,18 @@
Champs
.badge.progress-bar-info
= @facade.procedure.types_de_champ.size
- - @facade.procedure.types_de_champ.order(:order_place).each do |champ|
- = champ.libelle
- %br
+ %ul
+ - @facade.procedure.types_de_champ.order(:order_place).each do |champ|
+ %li= champ.libelle
.champs_private.col-xs-6.col-md-3
%h4.text-info
Champs privés
.badge.progress-bar-info
= @facade.procedure.types_de_champ_private.size
- - @facade.procedure.types_de_champ_private.order(:order_place).each do |champ|
- = champ.libelle
- %br
+ %ul
+ - @facade.procedure.types_de_champ_private.order(:order_place).each do |champ|
+ %li= champ.libelle
.pieces_justificatives.col-xs-6.col-md-3
%h4.text-info
@@ -96,7 +93,7 @@
=t('dynamics.admin.procedure.stats.title')
.row
- .col-md-6.col-sm-6.col-xs-6.col-lg-6{style:'margin-left:3%'}
+ .col-xs-6{style:'margin-left:3%'}
%h4 Total
%div
= @facade.dossiers_total
@@ -126,7 +123,7 @@
%p
0
- .col-md-5.col-sm-5.col-xs-5.col-lg-5
+ .col-xs-5
%h4 Non archivés
= javascript_include_tag "https://code.highcharts.com/highcharts.js", "chartkick"
- if @facade.dossiers_for_pie_highchart.blank?
diff --git a/app/views/administrations/_list.html.haml b/app/views/administrations/_list.html.haml
index c31059e24..10d515c57 100644
--- a/app/views/administrations/_list.html.haml
+++ b/app/views/administrations/_list.html.haml
@@ -1,10 +1,10 @@
- unless smart_listing.empty?
%table.table
%thead
- %th.col-md-4.col-sm-4.col-xs-4.col-lg-4= smart_listing.sortable 'Email', :email
- %th.col-md-4.col-sm-4.col-xs-4.col-lg-4= smart_listing.sortable 'Date de dernière connexion', :last_sign_in_at
- %th.col-md-2.col-sm-2.col-xs-2.col-lg-2 Procédure active
- %th.col-md-2.col-sm-2.col-xs-2.col-lg-2 Dossier en cours
+ %th.col-xs-4= smart_listing.sortable 'Email', :email
+ %th.col-xs-4= smart_listing.sortable 'Date de dernière connexion', :last_sign_in_at
+ %th.col-xs-2 Procédure active
+ %th.col-xs-2 Dossier en cours
- @admins.each do |admin|
%tr
diff --git a/app/views/backoffice/dossiers/_followers.html.haml b/app/views/backoffice/dossiers/_followers.html.haml
index 4578680fd..11c6c37b5 100644
--- a/app/views/backoffice/dossiers/_followers.html.haml
+++ b/app/views/backoffice/dossiers/_followers.html.haml
@@ -3,7 +3,7 @@
%br
.row
- .col-md-4.col-sm-4.col-xs-4.col-lg-4
+ .col-xs-4
- if @facade.followers.size > 0
%ul
- @facade.followers.each do |follower|
diff --git a/app/views/backoffice/dossiers/_list.html.haml b/app/views/backoffice/dossiers/_list.html.haml
index 27b2b6ca1..348b51baf 100644
--- a/app/views/backoffice/dossiers/_list.html.haml
+++ b/app/views/backoffice/dossiers/_list.html.haml
@@ -3,9 +3,8 @@
- if smart_listing.name.to_s == 'follow_dossiers'
%th.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1.center
%i.fa.fa-bell
- - unless Features.opensimplif
- %th.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1
- État
+ %th.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1
+ État
- @facade_data_view.preference_list_dossiers_filter.each do |preference|
- unless preference.libelle == 'Statut' || preference.libelle == 'État'
@@ -33,9 +32,8 @@
- else
.badge.progress-bar-warning
= total_notif
- - unless Features.opensimplif
- %td.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1
- = dossier.decorate.display_state
+ %td.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1
+ = dossier.decorate.display_state
- @facade_data_view.preference_list_dossiers_filter.each_with_index do |preference, index|
- unless preference.libelle == 'Statut' || preference.libelle == 'État'
%td
diff --git a/app/views/backoffice/dossiers/_pref_list.html.haml b/app/views/backoffice/dossiers/_pref_list.html.haml
index 4815ca782..15fe33893 100644
--- a/app/views/backoffice/dossiers/_pref_list.html.haml
+++ b/app/views/backoffice/dossiers/_pref_list.html.haml
@@ -27,7 +27,7 @@
- if index%2 == 0 || tables.first.to_s.include?('champs')
%tr
- %td.col-sm-5.col-md-5.col-sm-5.col-xs-5.col-lg-5{style: 'vertical-align: top', colspan: (tables.first == :champs ? 2 : 1)}
+ %td.col-xs-5{style: 'vertical-align: top', colspan: (tables.first == :champs ? 2 : 1)}
%h5= tables.first.to_s.gsub('_', ' ').capitalize
%ul
- if tables.second
diff --git a/app/views/backoffice/dossiers/_state_description.html.haml b/app/views/backoffice/dossiers/_state_description.html.haml
index 280074d9d..60ac57068 100644
--- a/app/views/backoffice/dossiers/_state_description.html.haml
+++ b/app/views/backoffice/dossiers/_state_description.html.haml
@@ -4,7 +4,7 @@
.row
.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1
.fa.fa-info-circle.text-info{style:'font-size: 2em; margin-top: 20%'}
- .col-md-11.col-sm-11.col-xs-11.col-lg-11
+ .col-xs-11
-if dossiers_list_facade.liste == 'nouveaux'
Tous les dossiers présents dans cette liste sont ceux qui
%b
diff --git a/app/views/demo/_list.html.haml b/app/views/demo/_list.html.haml
index 852751809..5340fcfb1 100644
--- a/app/views/demo/_list.html.haml
+++ b/app/views/demo/_list.html.haml
@@ -14,11 +14,11 @@
%tr
%td
= procedure.id
- %td.col-md-4.col-sm-4.col-xs-4.col-lg-4
+ %td.col-xs-4
= link_to procedure.libelle, procedure.lien
%td
= procedure.description
- %td.col-md-3.col-sm-3.col-xs-3.col-lg-3
+ %td.col-xs-3
= procedure.organisation
= smart_listing.paginate
diff --git a/app/views/dossiers/_dossier_show.html.haml b/app/views/dossiers/_dossier_show.html.haml
index a89154ab0..842c9740c 100644
--- a/app/views/dossiers/_dossier_show.html.haml
+++ b/app/views/dossiers/_dossier_show.html.haml
@@ -4,7 +4,7 @@
.default_data_block
%div.row.show-block.infos
%div.header
- %div.col-lg-8.col-md-8.col-sm-8.col-xs-8.title-no-expanse
+ %div.col-xs-8.title-no-expanse
%div.carret-right
INFORMATIONS DU DEMANDEUR
- if !@current_gestionnaire && ["draft", "updated", "replied", "initiated"].include?(@facade.dossier.state)
@@ -16,34 +16,34 @@
.default_data_block
%div.row.show-block.infos#infos_entreprise
%div.header
- %div.col-lg-12.col-md-12.col-sm-12.col-xs-12.title
+ %div.col-xs-12.title
%div.carret-right
%div.carret-down
INFORMATIONS DU DEMANDEUR
- %div.body
+ %div.body.display-block-on-print
= render partial: '/dossiers/infos_entreprise'
.default_data_block.default_visible
%div.row.show-block.infos#infos_dossier
%div.header
- %div.col-lg-10.col-md-10.col-sm-10.col-xs-10.title
+ %div.col-xs-10.title
%div.carret-right
%div.carret-down
CONSTRUCTION DU DOSSIER
= render partial: '/dossiers/edit_dossier'
- %div.body
+ %div.body.display-block-on-print
= render partial: '/dossiers/infos_dossier'
- if @facade.dossier.procedure.module_api_carto.use_api_carto
- .default_data_block.default_visible
+ .default_data_block.default_visible.no-page-break-inside
%div.row.show-block#carto
%div.header
- %div.col-lg-10.col-md-10.col-sm-10.col-xs-10.title
+ %div.col-xs-10.title
%div.carret-right
%div.carret-down
CARTOGRAPHIE
= render partial: '/dossiers/edit_carto'
- %div.body
+ %div.body.display-block-on-print
%input{id: 'json_latlngs', type: 'hidden', value: "#{@facade.dossier.json_latlngs}", name: 'json_latlngs'}
%input{id: 'quartier_prioritaires', type: 'hidden', value: "#{@facade.dossier.quartier_prioritaires.to_json}"}
%input{id: 'cadastres', type: 'hidden', value: "#{@facade.dossier.cadastres.to_json}"}
@@ -56,11 +56,11 @@
.default_data_block.default_visible
%div.row.show-block#private-fields
%div.header
- %div.col-lg-10.col-md-10.col-sm-10.col-xs-10.title
+ %div.col-xs-10.title
%div.carret-right
%div.carret-down
= "formulaire privé".upcase
- %div.col-lg-2.col-md-2.col-sm-2.col-xs-2.count
+ %div.col-xs-2.count
- private_fields_count = @champs_private.count
= (private_fields_count == 1) ? "1 champ" : "#{private_fields_count} champs"
%div.body
diff --git a/app/views/dossiers/_infos_carto.html.haml b/app/views/dossiers/_infos_carto.html.haml
index 1c706b2f5..c51812500 100644
--- a/app/views/dossiers/_infos_carto.html.haml
+++ b/app/views/dossiers/_infos_carto.html.haml
@@ -1,5 +1,5 @@
.row
- .col-md-12.col-sm-12.col-xs-12.col-lg-12
+ .col-xs-12
#map.mini{class: @facade.dossier.procedure.module_api_carto.classes}
%input{id: 'json_latlngs', type:'hidden', value: "#{@facade.dossier.json_latlngs}"}
diff --git a/app/views/dossiers/_infos_dossier.html.haml b/app/views/dossiers/_infos_dossier.html.haml
index 7158949e1..afe71a442 100644
--- a/app/views/dossiers/_infos_dossier.html.haml
+++ b/app/views/dossiers/_infos_dossier.html.haml
@@ -2,50 +2,40 @@
.col-lg-12.col-md-12.col-sm-12.col-xs-12
- if @facade.procedure.for_individual?
.row.title-row
- %div.col-md-4.col-sm-4.col-xs-4.col-lg-4.split-hr
- %div.col-md-4.col-sm-4.col-xs-4.col-lg-4.dossier-title= t('utils.depositaire').upcase
- %div.col-md-4.col-sm-4.col-xs-4.col-lg-4.split-hr
+ %div.col-xs-4.split-hr
+ %div.col-xs-4.dossier-title= t('utils.depositaire').upcase
+ %div.col-xs-4.split-hr
.row
- %div.col-md-6.col-sm-6.col-xs-6.col-lg-6.depositaire-label Civilité
+ %div.col-xs-6.depositaire-label Civilité
%div.col-md-1.col-lg-1.col-sm-1.col-xs-1.comments-off= "-"
- %div.col-md-5.col-sm-5.col-xs-5.col-lg-5.depositaire-info= @facade.individual.gender
+ %div.col-xs-5.depositaire-info= @facade.individual.gender
.row
- %div.col-md-6.col-sm-6.col-xs-6.col-lg-6.depositaire-label Nom
+ %div.col-xs-6.depositaire-label Nom
%div.col-md-1.col-lg-1.col-sm-1.col-xs-1.comments-off= "-"
- %div.col-md-5.col-sm-5.col-xs-5.col-lg-5.depositaire-info= @facade.individual.nom
+ %div.col-xs-5.depositaire-info= @facade.individual.nom
.row
- %div.col-md-6.col-sm-6.col-xs-6.col-lg-6.depositaire-label Prénom
+ %div.col-xs-6.depositaire-label Prénom
%div.col-md-1.col-lg-1.col-sm-1.col-xs-1.comments-off= "-"
- %div.col-md-5.col-sm-5.col-xs-5.col-lg-5.despositaire-info= @facade.individual.prenom
- - unless Features.opensimplif
- .row
- %div.col-md-6.col-sm-6.col-xs-6.col-lg-6.depositaire-label Date de naissance
- %div.col-md-1.col-lg-1.col-sm-1.col-xs-1.comments-off= "-"
- %div.col-md-5.col-sm-5.col-xs-5.col-lg-5.depositaire-info= @facade.individual.birthdate
+ %div.col-xs-5.despositaire-info= @facade.individual.prenom
+ .row
+ %div.col-xs-6.depositaire-label Date de naissance
+ %div.col-md-1.col-lg-1.col-sm-1.col-xs-1.comments-off= "-"
+ %div.col-xs-5.depositaire-info= @facade.individual.birthdate
.row.margin-top-20
- unless @facade.champs.nil?
- @facade.champs.each do |champ|
- if champ.type_champ == 'header_section'
.row.title-row.margin-top-40
- %div.col-md-3.col-sm-3.col-xs-3.col-lg-3.split-hr
- %div.col-md-6.col-sm-6.col-xs-6.col-lg-6.dossier-title= champ.libelle.upcase
- %div.col-md-3.col-sm-3.col-xs-3.col-lg-3.split-hr
+ %div.col-xs-3.split-hr
+ %div.col-xs-6.dossier-title= champ.libelle.upcase
+ %div.col-xs-3.split-hr
- else
.row
- %div.col-md-6.col-sm-6.col-xs-6.col-lg-6.depositaire-label= champ.libelle
- -#- if Features.opensimplif
- -# %div.col-md-1.col-lg-1.col-sm-1.col-xs-1.comments
- -# - if gestionnaire_signed_in?
- -# = link_to "", "data-href" => backoffice_dossier_commentaires_path(@facade.dossier, champs_id: champ.id), "data-toggle" => "modal", "data-target" => "#modalCommentairesDossierParChamp" do
- -# %i.fa.fa-comment-o
- -# - else
- -# = link_to "", "data-href" => users_dossier_commentaires_path(@facade.dossier, champs_id: champ.id), "data-toggle" => "modal", "data-target" => "#modalCommentairesDossierParChamp" do
- -# %i.fa.fa-commenting-o
- -#- else
+ %div.col-xs-6.depositaire-label= champ.libelle
%div.col-md-1.col-lg-1.col-sm-1.col-xs-1.comments-off
= "-"
- %div.col-md-5.col-sm-5.col-xs-5.col-lg-5.depositaire-info{ id: "champ-#{champ.id}-value" }
+ %div.col-xs-5.depositaire-info{ id: "champ-#{champ.id}-value" }
- unless champ.decorate.value.blank?
= champ.decorate.value.html_safe
@@ -60,18 +50,18 @@
- if @facade.procedure.cerfa_flag? || @facade.dossier.types_de_piece_justificative.count > 0
.col-lg-12.col-md-12.col-sm-12.col-xs-12
.row.title-row
- %div.col-md-4.col-sm-4.col-xs-4.col-lg-4.split-hr
- %div.col-md-4.col-sm-4.col-xs-4.col-lg-4.dossier-title= t('utils.pieces').upcase
- %div.col-md-4.col-sm-4.col-xs-4.col-lg-4.split-hr
+ %div.col-xs-4.split-hr
+ %div.col-xs-4.dossier-title= t('utils.pieces').upcase
+ %div.col-xs-4.split-hr
.col-lg-12.col-md-12.col-sm-12.col-xs-12#pieces_justificatives.margin-bot-40
.row
- if @facade.procedure.cerfa_flag?
- .col-md-12.col-sm-12.col-xs-12.col-lg-12#piece_justificative_0
+ .col-xs-12#piece_justificative_0
.row.piece-row
- .col-md-6.col-sm-6.col-xs-6.col-lg-6.depositaire-label= 'Formulaire'
+ .col-xs-6.depositaire-label= 'Formulaire'
.col-md-1.col-lg-1.col-sm-1.col-xs-1.comments-off= "-"
- .col-md-5.col-sm-5.col-xs-5.col-lg-5.despositaire-info
+ .col-xs-5.despositaire-info
- if @facade.dossier.cerfa_available?
%a{ href: "#{@facade.dossier.cerfa.last.content_url}", target: '_blank' } Consulter
%span{style:'margin-left:12px'}
@@ -81,14 +71,14 @@
- else
= 'Pièce non fournie'
.row
- .col-md-12.col-sm-12.col-xs-12.col-lg-12
+ .col-xs-12
- @facade.types_de_pieces_justificatives.each do |type_de_piece_justificative|
.row.piece-row
- .col-md-12.col-sm-12.col-xs-12.col-lg-12{ id: "piece_justificative_#{type_de_piece_justificative.id}" }
+ .col-xs-12{ id: "piece_justificative_#{type_de_piece_justificative.id}" }
.row
- %div.col-md-6.col-sm-6.col-xs-6.col-lg-6.depositaire-label= type_de_piece_justificative.libelle
+ %div.col-xs-6.depositaire-label= type_de_piece_justificative.libelle
%div.col-md-1.col-lg-1.col-sm-1.col-xs-1.comments-off= "-"
- %div.col-md-5.col-sm-5.col-xs-5.col-lg-5.despositaire-info
+ %div.col-xs-5.despositaire-info
- if type_de_piece_justificative.api_entreprise
%span.text-success Nous l'avons récupéré pour vous.
- elsif !(@pj = @facade.dossier.retrieve_last_piece_justificative_by_type(type_de_piece_justificative.id)).nil?
diff --git a/app/views/dossiers/_infos_entreprise.html.haml b/app/views/dossiers/_infos_entreprise.html.haml
index 81f670643..f1395b513 100644
--- a/app/views/dossiers/_infos_entreprise.html.haml
+++ b/app/views/dossiers/_infos_entreprise.html.haml
@@ -2,51 +2,51 @@
%h4
= @facade.entreprise.raison_sociale_or_name
.row.split-row
- %div.col-md-12.col-sm-12.col-xs-12.col-lg-12.split-hr
+ %div.col-xs-12.split-hr
%div.row
- .col-lg-12.col-md-12.col-sm-12.col-xs-12
+ .col-xs-12
.row
- %div.col-md-4.col-sm-4.col-xs-4.col-lg-4.entreprise-label Siret :
- %div.col-md-8.col-sm-8.col-xs-8.col-lg-8.entreprise-info= @facade.etablissement.siret
+ %div.col-xs-4.entreprise-label Siret :
+ %div.col-xs-8.entreprise-info= @facade.etablissement.siret
- if @facade.etablissement.siret != @facade.entreprise.siret_siege_social
.row
- %div.col-md-4.col-sm-4.col-xs-4.col-lg-4.entreprise-label SIRET siège social :
- %div.col-md-8.col-sm-8.col-xs-8.col-lg-8.entreprise-info= @facade.entreprise.siret_siege_social
+ %div.col-xs-4.entreprise-label SIRET siège social :
+ %div.col-xs-8.entreprise-info= @facade.entreprise.siret_siege_social
.row
- %div.col-md-4.col-sm-4.col-xs-4.col-lg-4.entreprise-label Forme juridique :
- %div.col-md-8.col-sm-8.col-xs-8.col-lg-8.entreprise-info= @facade.entreprise.forme_juridique
+ %div.col-xs-4.entreprise-label Forme juridique :
+ %div.col-xs-8.entreprise-info= @facade.entreprise.forme_juridique
.row
- %div.col-md-4.col-sm-4.col-xs-4.col-lg-4.entreprise-label Libellé naf :
- %div.col-md-8.col-sm-8.col-xs-8.col-lg-8.entreprise-info= @facade.etablissement.libelle_naf
+ %div.col-xs-4.entreprise-label Libellé naf :
+ %div.col-xs-8.entreprise-info= @facade.etablissement.libelle_naf
.row
- %div.col-md-4.col-sm-4.col-xs-4.col-lg-4.entreprise-label Code naf :
- %div.col-md-8.col-sm-8.col-xs-8.col-lg-8.entreprise-info= @facade.etablissement.naf
+ %div.col-xs-4.entreprise-label Code naf :
+ %div.col-xs-8.entreprise-info= @facade.etablissement.naf
.row
- %div.col-md-4.col-sm-4.col-xs-4.col-lg-4.entreprise-label Date de création :
- %div.col-md-8.col-sm-8.col-xs-8.col-lg-8.entreprise-info= Time.at(@facade.entreprise.date_creation).strftime "%d-%m-%Y"
+ %div.col-xs-4.entreprise-label Date de création :
+ %div.col-xs-8.entreprise-info= Time.at(@facade.entreprise.date_creation).strftime "%d-%m-%Y"
.row
- %div.col-md-4.col-sm-4.col-xs-4.col-lg-4.entreprise-label Effectif organisation :
- %div.col-md-8.col-sm-8.col-xs-8.col-lg-8.entreprise-info= @facade.entreprise.effectif
+ %div.col-xs-4.entreprise-label Effectif organisation :
+ %div.col-xs-8.entreprise-info= @facade.entreprise.effectif
.row
- %div.col-md-4.col-sm-4.col-xs-4.col-lg-4.entreprise-label Code effectif :
- %div.col-md-8.col-sm-8.col-xs-8.col-lg-8.entreprise-info= @facade.entreprise.code_effectif_entreprise
+ %div.col-xs-4.entreprise-label Code effectif :
+ %div.col-xs-8.entreprise-info= @facade.entreprise.code_effectif_entreprise
.row
- %div.col-md-4.col-sm-4.col-xs-4.col-lg-4.entreprise-label Numéro TVA intracommunautaire :
- %div.col-md-8.col-sm-8.col-xs-8.col-lg-8.entreprise-info= @facade.entreprise.numero_tva_intracommunautaire
+ %div.col-xs-4.entreprise-label Numéro TVA intracommunautaire :
+ %div.col-xs-8.entreprise-info= @facade.entreprise.numero_tva_intracommunautaire
.row
- %div.col-md-4.col-sm-4.col-xs-4.col-lg-4.entreprise-label Adresse :
- %div.col-md-8.col-sm-8.col-xs-8.col-lg-8.entreprise-info
+ %div.col-xs-4.entreprise-label Adresse :
+ %div.col-xs-8.entreprise-info
- @facade.etablissement.adresse.split("\n").each do |line|
= line
.row
- %div.col-md-4.col-sm-4.col-xs-4.col-lg-4.entreprise-label Capital social :
- %div.col-md-8.col-sm-8.col-xs-8.col-lg-8.entreprise-info= @facade.entreprise.pretty_capital_social
+ %div.col-xs-4.entreprise-label Capital social :
+ %div.col-xs-8.entreprise-info= @facade.entreprise.pretty_capital_social
.row
- %div.col-md-4.col-sm-4.col-xs-4.col-lg-4.entreprise-label Exercices :
- %div.col-md-8.col-sm-8.col-xs-8.col-lg-8.entreprise-info
+ %div.col-xs-4.entreprise-label Exercices :
+ %div.col-xs-8.entreprise-info
- @facade.etablissement.exercices.each_with_index do |exercice, index|
%strong
= "#{exercice.dateFinExercice.year} : "
@@ -54,7 +54,7 @@
%br
.row.split-row
- %div.col-md-12.col-sm-12.col-xs-12.col-lg-12.split-hr
+ %div.col-xs-12.split-hr
- unless @facade.entreprise.rna_information.nil?
= render partial: '/dossiers/infos_rna'
diff --git a/app/views/dossiers/_infos_pieces_jointes.html.haml b/app/views/dossiers/_infos_pieces_jointes.html.haml
index 3d562b8a9..5268bdadb 100644
--- a/app/views/dossiers/_infos_pieces_jointes.html.haml
+++ b/app/views/dossiers/_infos_pieces_jointes.html.haml
@@ -1,11 +1,11 @@
#pieces_justificatives
.row
- if @facade.procedure.cerfa_flag?
- .col-md-12.col-sm-12.col-xs-12.col-lg-12#piece_justificative_0
+ .col-xs-12#piece_justificative_0
.row.piece-row
- .col-md-6.col-sm-6.col-xs-6.col-lg-6.piece-label= 'Formulaire'
+ .col-xs-6.piece-label= 'Formulaire'
.col-md-1.col-lg-1.col-sm-1.col-xs-1.comments-off= "-"
- .col-md-5.col-sm-5.col-xs-5.col-lg-5
+ .col-xs-5
- if @facade.dossier.cerfa_available?
%a{ href: "#{@facade.dossier.cerfa.last.content_url}", target: '_blank' } Consulter
%span{style:'margin-left:12px'}
@@ -20,13 +20,13 @@
= 'Pièce non fournie'
.row
- .col-md-12.col-sm-12.col-xs-12.col-lg-12
+ .col-xs-12
- @facade.dossier.types_de_piece_justificative.order('order_place ASC').each do |type_de_piece_justificative|
.row.piece-row
- .col-md-12.col-sm-12.col-xs-12.col-lg-12{ id: "piece_justificative_#{type_de_piece_justificative.id}" }
+ .col-xs-12{ id: "piece_justificative_#{type_de_piece_justificative.id}" }
.row
- .col-md-6.col-sm-6.col-xs-6.col-lg-6= type_de_piece_justificative.libelle
- .col-md-6.col-sm-6.col-xs-6.col-lg-6
+ .col-xs-6= type_de_piece_justificative.libelle
+ .col-xs-6
- if type_de_piece_justificative.api_entreprise
%span.text-success Nous l'avons récupéré pour vous.
- elsif !(@pj = @facade.dossier.retrieve_last_piece_justificative_by_type(type_de_piece_justificative.id)).nil?
diff --git a/app/views/dossiers/_infos_private_fields.html.haml b/app/views/dossiers/_infos_private_fields.html.haml
index b6aac7f24..295f6be56 100644
--- a/app/views/dossiers/_infos_private_fields.html.haml
+++ b/app/views/dossiers/_infos_private_fields.html.haml
@@ -1,5 +1,5 @@
.row{style: 'margin-top: -20px'}
- .col-md-12.col-sm-12.col-xs-12.col-lg-12
+ .col-xs-12
= form_for @facade.dossier, url: {controller: 'backoffice/private_formulaires', action: :update, dossier_id: @facade.dossier.id}, remote: true do
= render partial: '/users/description/champs', locals:{private: true}
.row.center
diff --git a/app/views/dossiers/_invites.html.haml b/app/views/dossiers/_invites.html.haml
index 72307147e..345760df0 100644
--- a/app/views/dossiers/_invites.html.haml
+++ b/app/views/dossiers/_invites.html.haml
@@ -2,7 +2,7 @@
%br
.row
- .col-md-4.col-sm-4.col-xs-4.col-lg-4
+ .col-xs-4
- if @facade.invites.size > 0
%ul
- @facade.invites.each do |invite|
@@ -11,7 +11,7 @@
- else
Aucune personne invitée
- .col-md-3.col-sm-3.col-xs-3.col-lg-3
+ .col-xs-3
= form_tag invites_dossier_path(dossier_id: @facade.dossier.id), method: :post, class: 'form-inline' do
= text_field_tag :email, '', class: 'form-control', placeholder: 'Envoyer une invitation'
= submit_tag 'Ajouter', class: 'btn btn-success', id: 'send-invitation'
diff --git a/app/views/dossiers/_messagerie.html.haml b/app/views/dossiers/_messagerie.html.haml
index c38063552..58a8ac81b 100644
--- a/app/views/dossiers/_messagerie.html.haml
+++ b/app/views/dossiers/_messagerie.html.haml
@@ -11,21 +11,19 @@
.alert.alert-info
Cette messagerie permet d'échanger entre le demandeur et le service instructeur.
- .body
+ .body.display-block-on-print
- if dossier_facade.commentaires.any?
.commentaires
= render partial: 'dossiers/commentaires/commentaire', collection: dossier_facade.commentaires.object.sort
.split-hr
- #new-commentaire
+ #new-commentaire.hidden-print
= render partial: 'dossiers/commentaires/form', locals: { dossier_facade: @facade }
-
-
- .last-commentaire.clearfix
+ .last-commentaire.clearfix.hidden-print
- if last_comment = dossier_facade.commentaires.first
%div
DERNIER MESSAGE
= render partial: 'dossiers/commentaires/commentaire', object: last_comment
- #open-message.new-action
+ %button#open-message.new-action.btn.btn-danger
ENVOYER UN MESSAGE
diff --git a/app/views/dossiers/commentaires/_form.html.haml b/app/views/dossiers/commentaires/_form.html.haml
index 41163c221..e245c4964 100644
--- a/app/views/dossiers/commentaires/_form.html.haml
+++ b/app/views/dossiers/commentaires/_form.html.haml
@@ -7,5 +7,5 @@
%h4.text-primary{style: 'margin-top: 0px'} Ajouter un fichier
= file_field_tag "piece_justificative[content]", accept: PieceJustificative.accept_format, style: 'float: left; margin-left: 20px'
- .col-md-6
- %input#save-message.form-control.btn.btn-send{ type: 'submit', value: 'ENVOYER' }
+ .col-md-6.text-right
+ %input#save-message.form-control.btn.btn-danger{ type: 'submit', value: 'ENVOYER' }
diff --git a/app/views/dossiers/etapes/_etape1.html.haml b/app/views/dossiers/etapes/_etape1.html.haml
index 025e135bb..784796e4b 100644
--- a/app/views/dossiers/etapes/_etape1.html.haml
+++ b/app/views/dossiers/etapes/_etape1.html.haml
@@ -1,4 +1,4 @@
-.col-md-3.col-sm-3.col-xs-3.col-lg-3.center
+.col-xs-3.center
%h3 Ma procédure
#logos.center{class: (@facade.entreprise.nil? ? '' : 'mask')}
@@ -9,9 +9,9 @@
#logo_procedure.flag
=image_tag( @facade.procedure.decorate.logo_img )
-.etape.etapes_informations.col-md-9.col-sm-9.col-xs-9.col-lg-9
+.etape.etapes_informations.col-xs-9
.row
- .col-md-12.col-sm-12.col-xs-12.col-lg-12.padding-left-30
+ .col-xs-12.padding-left-30
%h2#titre_procedure.text-info
= @facade.procedure.libelle
diff --git a/app/views/dossiers/etapes/_etape3.html.haml b/app/views/dossiers/etapes/_etape3.html.haml
index 2190f7966..a163bbe81 100644
--- a/app/views/dossiers/etapes/_etape3.html.haml
+++ b/app/views/dossiers/etapes/_etape3.html.haml
@@ -1,6 +1,6 @@
-.etape.etapes_menu.col-md-3.col-sm-3.col-xs-3.col-lg-3
+.etape.etapes_menu.col-xs-3
%h3
Ma zone d'intervention
-.etape.etapes_informations.col-md-9.col-sm-9.col-xs-9.col-lg-9
+.etape.etapes_informations.col-xs-9
.row
diff --git a/app/views/dossiers/etapes/_etape4.html.haml b/app/views/dossiers/etapes/_etape4.html.haml
index 04556443b..68a4c0fc4 100644
--- a/app/views/dossiers/etapes/_etape4.html.haml
+++ b/app/views/dossiers/etapes/_etape4.html.haml
@@ -1,6 +1,6 @@
-.etape.etapes_menu.col-md-3.col-sm-3.col-xs-3.col-lg-3
+.etape.etapes_menu.col-xs-3
%h3
Mon dossier
-.etape.etapes_informations.col-md-9.col-sm-9.col-xs-9.col-lg-9
+.etape.etapes_informations.col-xs-9
.row
diff --git a/app/views/dossiers/etapes/etape_2/_entreprise.html.haml b/app/views/dossiers/etapes/etape_2/_entreprise.html.haml
index bac50fe87..6f0d121f8 100644
--- a/app/views/dossiers/etapes/etape_2/_entreprise.html.haml
+++ b/app/views/dossiers/etapes/etape_2/_entreprise.html.haml
@@ -1,4 +1,4 @@
-.etape.etapes_menu.col-md-3.col-sm-3.col-xs-3.col-lg-3
+.etape.etapes_menu.col-xs-3
%h3
Mes informations
%br
@@ -12,7 +12,7 @@
= f.submit 'Changer de SIRET', class: %w(btn btn-xs btn-primary)
-.etape.etapes_informations.col-md-9.col-sm-9.col-xs-9.col-lg-9
+.etape.etapes_informations.col-xs-9
.row
- if @facade.entreprise.nil?
#new_siret{style:'margin-left: 20%; margin-top: 5%'}
diff --git a/app/views/dossiers/etapes/etape_2/_individual.html.haml b/app/views/dossiers/etapes/etape_2/_individual.html.haml
index 2c7423a64..ae1d3a56e 100644
--- a/app/views/dossiers/etapes/etape_2/_individual.html.haml
+++ b/app/views/dossiers/etapes/etape_2/_individual.html.haml
@@ -1,14 +1,14 @@
-.col-md-3.col-sm-3.col-xs-3.col-lg-3.center
+.col-xs-3.center
%h3 Mes informations
%p
Les informations de bases
%br
vous concernant.
-.etape.etapes_informations.col-md-9.col-sm-9.col-xs-9.col-lg-9
+.etape.etapes_informations.col-xs-9
= form_for @facade.dossier, url: { controller: '/users/dossiers', action: :update } do |f|
.row
- .col-md-12.col-sm-12.col-xs-12.col-lg-12.padding-left-30
+ .col-xs-12.padding-left-30
= f.hidden_field :id
= f.fields_for :individual, @facade.individual do |ff|
@@ -40,7 +40,7 @@
Vos informations personnelles ne seront jamais utilisées dans un but lucratif ou commercial. Elles ne pourront être communiquées à de tiers personnes sans votre accord préalable. Elles pourront en revanche être communiquées aux administrations compétentes afin d'instruire votre dossier, conformément à la déclaration CNIL effectué par le service TPS.
=link_to 'en savoir plus', cgu_path, target: '_blank'
.row
- .col-md-5.col-sm-5.col-xs-5.col-lg-5.col-xs-5
- .col-md-2.col-sm-2.col-xs-2.col-lg-2.col-xs-2
+ .col-xs-5.col-xs-5
+ .col-xs-2.col-xs-2
= f.submit 'Etape suivante', class: "action", id: 'etape_suivante'
- .col-md-5.col-sm-5.col-xs-5.col-lg-5.col-xs-5
+ .col-xs-5.col-xs-5
diff --git a/app/views/layouts/_support_navigator_banner.html.haml b/app/views/layouts/_support_navigator_banner.html.haml
index 26a53c962..16c371807 100644
--- a/app/views/layouts/_support_navigator_banner.html.haml
+++ b/app/views/layouts/_support_navigator_banner.html.haml
@@ -1,6 +1,6 @@
- unless BrowserService.recommended_browser?
#support_navigator_banner.row
- .col-md-12.col-sm-12.col-xs-12.col-lg-12
+ .col-xs-12
= BROWSER.value.name
= BROWSER.value.version
\-
diff --git a/app/views/layouts/_switch_devise_profile_module.html.haml b/app/views/layouts/_switch_devise_profile_module.html.haml
index 57a11fdd7..c8f3e6705 100644
--- a/app/views/layouts/_switch_devise_profile_module.html.haml
+++ b/app/views/layouts/_switch_devise_profile_module.html.haml
@@ -1,4 +1,4 @@
-- if SwitchDeviseProfileService.new(warden).multiple_devise_profile_connect? && !Features.opensimplif
+- if SwitchDeviseProfileService.new(warden).multiple_devise_profile_connect?
#switch_menu.dropdown.dropup
%button.btn.btn-default.dropdown-toggle{ type: :button, 'data-toggle' => 'dropdown', 'aria-haspopup' => true, 'aria-expanded' => false}
%i.fa.fa-toggle-on
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 7b4214397..c4e7e86ce 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -6,6 +6,7 @@
%meta{'http-equiv' => "X-UA-Compatible", :content => "IE=edge"}
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
+ = stylesheet_link_tag 'print', media: 'print', 'data-turbolinks-track' => true
= javascript_include_tag 'application', 'data-turbolinks-track' => true
= csrf_meta_tags
@@ -32,7 +33,7 @@
= render partial: "layouts/navbar"
%div.row.no-margin
- if RenderPartialService.left_panel_exist? @left_pannel_url
- %div.col-lg-2.col-md-2.col-sm-2.col-xs-2#left-pannel
+ %div.col-xs-2#left-panel
- if gestionnaire_signed_in?
#search-block
= render partial: 'layouts/left_panels/search_area'
diff --git a/app/views/layouts/left_panels/_left_panel_admin_mailscontroller_index.html.haml b/app/views/layouts/left_panels/_left_panel_admin_mailtemplatescontroller_edit.html.haml
similarity index 100%
rename from app/views/layouts/left_panels/_left_panel_admin_mailscontroller_index.html.haml
rename to app/views/layouts/left_panels/_left_panel_admin_mailtemplatescontroller_edit.html.haml
diff --git a/app/views/layouts/left_panels/_left_panel_admin_mailtemplatescontroller_index.html.haml b/app/views/layouts/left_panels/_left_panel_admin_mailtemplatescontroller_index.html.haml
new file mode 100644
index 000000000..1bdf2e3b1
--- /dev/null
+++ b/app/views/layouts/left_panels/_left_panel_admin_mailtemplatescontroller_index.html.haml
@@ -0,0 +1 @@
+= render partial: 'layouts/left_panels/left_panel_admin_procedurescontroller_navbar', locals: {active: 'E-mails'}
diff --git a/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_navbar.html.haml b/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_navbar.html.haml
index 01774dbe0..a78879adc 100644
--- a/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_navbar.html.haml
+++ b/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_navbar.html.haml
@@ -19,10 +19,9 @@
%div.procedure_list_element{class: ('active' if active == 'Accompagnateurs')}
=t('dynamics.admin.procedure.onglets.accompagnateurs')
- - unless @procedure.locked?
- %a{:href => "#{url_for edit_admin_procedure_path(@procedure)}", id: 'onglet-description'}
- %div.procedure_list_element{class: ('active' if active == 'Description')}
- Description
+ %a{:href => "#{url_for edit_admin_procedure_path(@procedure)}", id: 'onglet-description'}
+ %div.procedure_list_element{class: ('active' if active == 'Description')}
+ Description
- unless @procedure.locked?
%a{:href => "#{url_for admin_procedure_types_de_champ_path(@procedure)}", id: 'onglet-champs'}
@@ -39,7 +38,7 @@
%div.procedure_list_element{class: ('active' if active == 'Champs privés')}
Champs privés
- %a{:href => "#{url_for admin_procedure_mails_path(@procedure)}", id: 'onglet-inemailsfos'}
+ %a{:href => "#{url_for admin_procedure_mail_templates_path(@procedure)}", id: 'onglet-inemailsfos'}
%div.procedure_list_element{class: ('active' if active == 'E-mails')}
E-mails
diff --git a/app/views/layouts/left_panels/_left_panel_backoffice_dossierscontroller_index.html.haml b/app/views/layouts/left_panels/_left_panel_backoffice_dossierscontroller_index.html.haml
index 84864759c..6f8b17d10 100644
--- a/app/views/layouts/left_panels/_left_panel_backoffice_dossierscontroller_index.html.haml
+++ b/app/views/layouts/left_panels/_left_panel_backoffice_dossierscontroller_index.html.haml
@@ -2,10 +2,9 @@
%div.dossiers-en-cours
.count= @facade_data_view.total_dossier_follow
.text= "SUIVIS"
- - unless Features.opensimplif
- %div.nouveaux-dossiers
- .count= @facade_data_view.total_new_dossier
- .text= "NOUVEAUX"
+ %div.nouveaux-dossiers
+ .count= @facade_data_view.total_new_dossier
+ .text= "NOUVEAUX"
%div.nouvelles-notifications
.count= @facade_data_view.dossiers_with_unread_notifications.count
.text= "MODIFIÉS"
@@ -23,13 +22,11 @@
#procedure_list
- @facade_data_view.gestionnaire_procedures_name_and_id_list.each do |procedure|
- - url_path = Features.opensimplif ? simplification_path(procedure[:id]) : backoffice_dossiers_procedure_path(procedure[:id])
-
- = link_to url_path, {title: procedure[:libelle]} do
+ = link_to backoffice_dossiers_procedure_path(procedure[:id]), {title: procedure[:libelle]} do
%div.procedure_list_element{ class: ('active' if procedure[:id] == @facade_data_view.procedure.id rescue '') }
= truncate(procedure[:libelle], length: 50)
- total_new = @facade_data_view.new_dossier_number procedure[:id]
- - if total_new > 0 && !Features.opensimplif
+ - if total_new > 0
.badge.progress-bar-success{title:'Nouveaux dossiers'}
= total_new
-if procedure[:unread_notifications] > 0
diff --git a/app/views/layouts/left_panels/_left_panel_backoffice_dossierscontroller_show.html.haml b/app/views/layouts/left_panels/_left_panel_backoffice_dossierscontroller_show.html.haml
index 67f164445..512ceb8f0 100644
--- a/app/views/layouts/left_panels/_left_panel_backoffice_dossierscontroller_show.html.haml
+++ b/app/views/layouts/left_panels/_left_panel_backoffice_dossierscontroller_show.html.haml
@@ -2,38 +2,41 @@
%div.infos
#dossier_id= t('dynamics.dossiers.numéro') + @facade.dossier.id.to_s
-- unless Features.opensimplif
- %div#action-block
- - if gestionnaire_signed_in?
- - if !@facade.dossier.read_only?
- = form_tag(url_for({controller: 'backoffice/dossiers', action: :valid, dossier_id: @facade.dossier.id}), class: 'form-inline', method: 'POST') do
- %button.action{'data-toggle' => :tooltip, title: 'En cliquant ici, vous figez le dossier et autorisez le dépôt du dossier pour instruction.'}
- = 'Déclarer complet'.upcase
- - elsif @facade.dossier.submitted?
- = form_tag(url_for({controller: 'backoffice/dossiers', action: :receive, dossier_id: @facade.dossier.id}), class: 'form-inline', method: 'POST') do
- %button.action
- = 'Accuser réception'.upcase
- - elsif @facade.dossier.received?
- = form_tag(url_for({controller: 'backoffice/dossiers', action: :close, dossier_id: @facade.dossier.id}), class: 'form-inline action_button', method: 'POST', style: 'display:inline', 'data-toggle' => :tooltip, title: 'Accepter') do
- %button.action.close-dossier
- %i.fa.fa-check
- = form_tag(url_for({controller: 'backoffice/dossiers', action: :without_continuation, dossier_id: @facade.dossier.id}), class: 'form-inline action_button', method: 'POST', style: 'display:inline', 'data-toggle' => :tooltip, title: 'Classer sans suite') do
- %button.action.forget-dossier
- %i.fa.fa-circle-o
- = form_tag(url_for({controller: 'backoffice/dossiers', action: :refuse, dossier_id: @facade.dossier.id}), class: 'form-inline action_button', method: 'POST', style: 'display:inline', 'data-toggle' => :tooltip, title: 'Refuser') do
- %button.action.refuse-dossier
- %i.fa.fa-times
+%div#action-block
+ - if gestionnaire_signed_in?
+ - if !@facade.dossier.read_only?
+ = form_tag(url_for({controller: 'backoffice/dossiers', action: :valid, dossier_id: @facade.dossier.id}), class: 'form-inline', method: 'POST') do
+ %button.action{'data-toggle' => :tooltip, title: 'En cliquant ici, vous figez le dossier et autorisez le dépôt du dossier pour instruction.'}
+ = 'Déclarer complet'.upcase
+ - elsif @facade.dossier.submitted?
+ = form_tag(url_for({controller: 'backoffice/dossiers', action: :receive, dossier_id: @facade.dossier.id}), class: 'form-inline', method: 'POST') do
+ %button.action
+ = 'Accuser réception'.upcase
+ - elsif @facade.dossier.received?
+ = form_tag(url_for({controller: 'backoffice/dossiers', action: :close, dossier_id: @facade.dossier.id}), class: 'form-inline action_button', method: 'POST', style: 'display:inline', 'data-toggle' => :tooltip, title: 'Accepter') do
+ %button.action.close-dossier
+ %i.fa.fa-check
+ = form_tag(url_for({controller: 'backoffice/dossiers', action: :without_continuation, dossier_id: @facade.dossier.id}), class: 'form-inline action_button', method: 'POST', style: 'display:inline', 'data-toggle' => :tooltip, title: 'Classer sans suite') do
+ %button.action.forget-dossier
+ %i.fa.fa-circle-o
+ = form_tag(url_for({controller: 'backoffice/dossiers', action: :refuse, dossier_id: @facade.dossier.id}), class: 'form-inline action_button', method: 'POST', style: 'display:inline', 'data-toggle' => :tooltip, title: 'Refuser') do
+ %button.action.refuse-dossier
+ %i.fa.fa-times
+
+ - unless @facade.dossier.archived?
+ = link_to 'Archiver', backoffice_dossier_archive_path(@facade.dossier), method: :post, class: 'btn btn-default btn-block'
+
+
%div#menu-block
%div#infos-block
- - unless Features.opensimplif
- %div.split-hr-left
- %div.dossier-state= @facade.dossier.display_state
+ %div.split-hr-left
+ %div.dossier-state= @facade.dossier.display_state
%div.split-hr-left
%div.notifications
- if @facade.dossier.notifications.empty?
- = "Aucune notification pour le moment."
+ Aucune notification pour le moment.
- else
%i.fa.fa-bell-o
- @facade.last_notifications.each do |notification|
diff --git a/app/views/layouts/mailer.html.haml b/app/views/layouts/mailer.html.haml
index 28739ee90..5ef091a74 100644
--- a/app/views/layouts/mailer.html.haml
+++ b/app/views/layouts/mailer.html.haml
@@ -1,3 +1,3 @@
-%hmtl
+%html
%body
- = yield
\ No newline at end of file
+ = yield
diff --git a/app/views/notification_mailer/dossier_received.html.erb b/app/views/notification_mailer/dossier_received.html.erb
index 2b39f1abe..6c2c537d2 100644
--- a/app/views/notification_mailer/dossier_received.html.erb
+++ b/app/views/notification_mailer/dossier_received.html.erb
@@ -1 +1 @@
-<%= MailTemplate.replace_tags(@dossier.procedure.mail_received.body, @dossier).html_safe %>
\ No newline at end of file
+<%= @dossier.procedure.mail_received.body_for_dossier(@dossier).html_safe %>
diff --git a/app/views/notification_mailer/dossier_validated.html.erb b/app/views/notification_mailer/dossier_validated.html.erb
new file mode 100644
index 000000000..6f3ad09b3
--- /dev/null
+++ b/app/views/notification_mailer/dossier_validated.html.erb
@@ -0,0 +1 @@
+<%= @dossier.procedure.mail_validated.body_for_dossier(@dossier).html_safe %>
diff --git a/app/views/notification_mailer/dossier_validated.text.erb b/app/views/notification_mailer/dossier_validated.text.erb
deleted file mode 100644
index a5b19304b..000000000
--- a/app/views/notification_mailer/dossier_validated.text.erb
+++ /dev/null
@@ -1,14 +0,0 @@
-Bonjour <%= @user.email %>
-
-Votre dossier N°<%=@dossier.id%> est prêt à être déposé pour instruction.
-
-Afin de finaliser son dépôt, merci de vous rendre sur <%=users_dossier_recapitulatif_url(dossier_id: @dossier.id)%>
-
-Bonne journée,
-
----
-Merci de ne pas répondre à ce mail. Postez directement vos questions dans votre dossier sur la plateforme.
----
-
----
-L'équide TPS - tps@apientreprise.fr
\ No newline at end of file
diff --git a/app/views/opensimplif/_pref_list.js.erb b/app/views/opensimplif/_pref_list.js.erb
deleted file mode 100644
index c3c7cc107..000000000
--- a/app/views/opensimplif/_pref_list.js.erb
+++ /dev/null
@@ -1,14 +0,0 @@
-$.ajax({
- method: 'get',
- url: '/simplifications/reload_smartlisting?id=<%= @procedure_id %>',
- async: true
-});
-
-$.ajax({
- methd: 'get',
- url: '/backoffice/preference_list_dossier/reload_pref_list?procedure_id=<%= @procedure_id %>',
- async: true
-}).done(function (data) {
- $("#pref_list_menu").html(data);
- pref_list_dossier_actions();
-});
diff --git a/app/views/opensimplif/index.html.haml b/app/views/opensimplif/index.html.haml
deleted file mode 100644
index a54739f3d..000000000
--- a/app/views/opensimplif/index.html.haml
+++ /dev/null
@@ -1,43 +0,0 @@
-#backoffice_index
- #pref_list_menu
- = render partial: 'backoffice/dossiers/pref_list'
-
- .default_data_block.default_visible
- %div.row.show-block#new_dossiers
- %div.header
- %div.col-lg-10.col-md-10.col-sm-10.col-xs-10.title
- %div.carret-right
- %div.carret-down
- Mes simplifications
- %div.col-lg-2.col-md-2.col-sm-2.col-xs-2.count
- =current_user.dossiers.count
- SIMPLIFICATIONS
- %div.body
- = smart_listing_render :mes_dossiers
-
- .default_data_block.default_visible
- %div.row.show-block#new_dossiers
- %div.header
- %div.col-lg-10.col-md-10.col-sm-10.col-xs-10.title
- %div.carret-right
- %div.carret-down
- Les simplifications que je suivis
- %div.col-lg-2.col-md-2.col-sm-2.col-xs-2.count
- =@facade_data_view.suivi_total
- simplifications
- %div.body
- = smart_listing_render :follow_dossiers
-
-
- .default_data_block
- %div.row.show-block#new_dossiers
- %div.header
- %div.col-lg-10.col-md-10.col-sm-10.col-xs-10.title
- %div.carret-right
- %div.carret-down
- Les autres
- %div.col-lg-2.col-md-2.col-sm-2.col-xs-2.count
- =@facade_data_view.all_state_total
- simplifications
- %div.body
- = smart_listing_render :all_state_dossiers
diff --git a/app/views/opensimplif/index.js.erb b/app/views/opensimplif/index.js.erb
deleted file mode 100644
index 41790287e..000000000
--- a/app/views/opensimplif/index.js.erb
+++ /dev/null
@@ -1,6 +0,0 @@
-<%= smart_listing_update :mes_dossiers, {force: true} %>
-<%= smart_listing_update :follow_dossiers, {force: true} %>
-<%= smart_listing_update :all_state_dossiers, {force: true} %>
-
-filters_init();
-link_init();
\ No newline at end of file
diff --git a/app/views/opensimplif/nothing.html.haml b/app/views/opensimplif/nothing.html.haml
deleted file mode 100644
index 92bf1d421..000000000
--- a/app/views/opensimplif/nothing.html.haml
+++ /dev/null
@@ -1,6 +0,0 @@
-.center
- %h3.text-danger
- Vous n'avez aucun droit de lecture sur cette plateforme.
-
- %h4
- Merci de prendre contact avec votre reponsable simplification afin de remedier à ce problème.
\ No newline at end of file
diff --git a/app/views/root/landing.html.haml b/app/views/root/landing.html.haml
index 7c8a9ee5a..c4ad61372 100644
--- a/app/views/root/landing.html.haml
+++ b/app/views/root/landing.html.haml
@@ -44,18 +44,19 @@
.col-md-4.col-lg-4
%h3.text-primary Acteurs publics
%h4 Créez des démarches en ligne simplifiées et sécurisées.
- =link_to 'Démonstration', 'https://tps-dev.apientreprise.fr/administrateurs/sign_in/demo', {class: 'btn btn-lg btn-primary'}
+ =link_to 'Démonstration', "#{@demo_environment_host}/administrateurs/sign_in/demo", {class: 'btn btn-lg btn-primary'}
.col-md-4.col-lg-4
%h3.text-warning Agents et services
%h4 Accompagnez et co-traitez les projets avec les usagers.
- =link_to 'Démonstration', 'https://tps-dev.apientreprise.fr/gestionnaires/sign_in/demo', {class: 'btn btn-lg btn-warning'}
+ =link_to 'Démonstration', "#{@demo_environment_host}/gestionnaires/sign_in/demo", {class: 'btn btn-lg btn-warning'}
.col-md-4.col-lg-4
%h3.text-success Usagers
%h4 Profitez de démarches simplifiées et d’échanges continus avec les services traitants.
- =link_to 'Démonstration', 'https://tps-dev.apientreprise.fr/users/sign_in/demo', {class: 'btn btn-lg btn-success'}
-
+ =link_to 'Démonstration', "#{@demo_environment_host}/users/sign_in/demo", {class: 'btn btn-lg btn-success'}
+ %h1
+ = @demo_environment_host
.split-hr-left
.center
diff --git a/app/views/users/description/_pieces_justificatives.html.haml b/app/views/users/description/_pieces_justificatives.html.haml
index e63b2968e..5dce35c68 100644
--- a/app/views/users/description/_pieces_justificatives.html.haml
+++ b/app/views/users/description/_pieces_justificatives.html.haml
@@ -1,15 +1,17 @@
--unless dossier.procedure.lien_demarche.blank?
- %p
- Récupérer le formulaire de demande ou CERFA vierge pour mon dossier :
- = link_to "Télécharger", dossier.procedure.lien_demarche, target: '_blank', id: 'lien_cerfa'
%table.table
- if dossier.procedure.cerfa_flag
%tr
- %th.col-lg-6
+ %th
Formulaire de demande ou CERFA (complété et numérisé)
+ %td
+ -unless dossier.procedure.lien_demarche.blank?
+ %em
+ Récupérer le formulaire de demande ou CERFA vierge pour mon dossier :
+ = link_to "Télécharger", "#{dossier.procedure.lien_demarche}", target: :blank, id: :lien_cerfa
+ -# %a{ id: 'lien_cerfa', href: "#{dossier.procedure.lien_demarche}", target: '_blank'} Télécharger
- %td.col-lg-5
+ %td
-if dossier.cerfa_available?
%span.btn.btn-sm.btn-file.btn-success
Modifier
@@ -19,9 +21,16 @@
- dossier.types_de_piece_justificative.order('order_place ASC').each do |type_de_piece_justificative|
%tr
- %th.col-lg-6.piece-libelle
+ %th.piece-libelle
= type_de_piece_justificative.libelle
- %td.col-lg-5
+
+ %td
+ - unless type_de_piece_justificative.lien_demarche.blank?
+ %em
+ Récupérer le formulaire vierge pour mon dossier :
+ = link_to "Télécharger", type_de_piece_justificative.lien_demarche, target: :blank
+
+ %td
-if type_de_piece_justificative.api_entreprise
%span.text-success{ id: "piece_justificative_#{type_de_piece_justificative.id}" } Nous l'avons récupéré pour vous.
-else
diff --git a/app/views/users/description/_show.html.haml b/app/views/users/description/_show.html.haml
index 7e130baaa..f216b3d7a 100644
--- a/app/views/users/description/_show.html.haml
+++ b/app/views/users/description/_show.html.haml
@@ -6,7 +6,7 @@
.row
.col-md-1.col-lg-1.col-sm-1.col-xs-1
.fa.fa-info-circle.text-info{style:'font-size: 2em; margin-top: 20%'}
- .col-md-10.col-sm-10.col-xs-10.col-lg-10{style:'padding-right: 0px'}
+ .col-xs-10{style:'padding-right: 0px'}
%b
=link_to 'Accéder au guide', @dossier.procedure.lien_notice, {target: '_blank'}
pour remplir pour votre dossier
@@ -15,7 +15,7 @@
= @dossier.procedure.libelle
-#TODO use form_for
- = form_tag(url_for({controller: 'users/description', action: :create, dossier_id: @dossier.id}), class: 'form-inline', method: 'POST', multipart: true) do
+ = form_tag(url_for({controller: 'users/description', action: :create, dossier_id: @dossier.id}), class: 'form', method: 'POST', multipart: true) do
-unless @champs.nil?
#liste_champs
=render partial: 'users/description/champs', locals:{private: false}
@@ -24,21 +24,21 @@
%br
%h3 Documents administratifs
+
//TODO a refactorer
.row
.col-lg-8
= render partial: 'users/description/pieces_justificatives', locals: { dossier: @dossier }
- - unless Features.opensimplif
- #state_description.row{style:'width: 50%; margin-left:20px'}
- .panel.panel-info
- .panel-body.center
- .row
- .col-md-1.col-lg-1.col-sm-1.col-xs-1
- .fa.fa-info-circle.text-info{style:'font-size: 2em; margin-top: 20%'}
- .col-md-11.col-sm-11.col-xs-11.col-lg-11
- Les documents administratifs ne sont pas indispensables afin d'initier votre dossier.
- Vous pourrez dans tous les cas les compléter plus tard si vous ne les possédez pas de suite.
+ #state_description.row{style:'width: 50%; margin-left:20px'}
+ .panel.panel-info
+ .panel-body.center
+ .row
+ .col-md-1.col-lg-1.col-sm-1.col-xs-1
+ .fa.fa-info-circle.text-info{style:'font-size: 2em; margin-top: 20%'}
+ .col-xs-11
+ Les documents administratifs ne sont pas indispensables afin d'initier votre dossier.
+ Vous pourrez dans tous les cas les compléter plus tard si vous ne les possédez pas de suite.
-route = Rails.application.routes.recognize_path(request.referrer)
diff --git a/app/views/users/description/champs/_checkbox.html.haml b/app/views/users/description/champs/_checkbox.html.haml
index 8f2727f9d..bae7b55ad 100644
--- a/app/views/users/description/champs/_checkbox.html.haml
+++ b/app/views/users/description/champs/_checkbox.html.haml
@@ -1,6 +1,2 @@
-%h4{style:'margin-left:15px;'}
- = champ.libelle
- - if champ.mandatory?
- = '*'
- %input{type: 'hidden', name:"champs['#{champ.id}']", id: "champs_#{champ.id}", value: ''}
- %input{type: 'checkbox', style:'margin-left: 15px;', name:"champs['#{champ.id}']", id: "champs_#{champ.id}", checked: ('checked' if champ.value == 'on')}
+%input{type: 'hidden', name:"champs['#{champ.id}']", id: "champs_#{champ.id}", value: ''}
+%input{type: 'checkbox', style:'margin-left: 15px;', name:"champs['#{champ.id}']", id: "champs_#{champ.id}", checked: ('checked' if champ.value == 'on')}
diff --git a/app/views/users/description/champs/_civilite.html.haml b/app/views/users/description/champs/_civilite.html.haml
index 1a9ad45f3..c6fcf6525 100644
--- a/app/views/users/description/champs/_civilite.html.haml
+++ b/app/views/users/description/champs/_civilite.html.haml
@@ -1,7 +1,8 @@
-%label.radio-inline
- = radio_button_tag "champs['#{champ.id}']", "M.", champ.value == 'Mme' ? false : true
- Monsieur
+%div
+ %label.radio-inline
+ = radio_button_tag "champs['#{champ.id}']", "M.", champ.value == 'Mme' ? false : true
+ Monsieur
-%label.radio-inline
- = radio_button_tag "champs['#{champ.id}']", "Mme", champ.value == 'Mme'
- Madame
\ No newline at end of file
+ %label.radio-inline
+ = radio_button_tag "champs['#{champ.id}']", "Mme", champ.value == 'Mme'
+ Madame
\ No newline at end of file
diff --git a/app/views/users/description/champs/_engagement.html.haml b/app/views/users/description/champs/_engagement.html.haml
index 9381266cf..bae7b55ad 100644
--- a/app/views/users/description/champs/_engagement.html.haml
+++ b/app/views/users/description/champs/_engagement.html.haml
@@ -1,8 +1,2 @@
-%h4{style:'margin-left:15px;'}
- = champ.libelle
- - if champ.mandatory?
- = '*'
- %input{type: 'hidden', name:"champs['#{champ.id}']", id: "champs_#{champ.id}", value: ''}
- %input{type: 'checkbox', style:'margin-left: 15px;', name:"champs['#{champ.id}']", id: "champs_#{champ.id}", checked: ('checked' if champ.value == 'on')}
-%div{style:'margin-left: 5%; margin-right: 5%; text-align: justify; text-justify: inter-word;'}
- = champ.description.gsub(/\r\n/, '
').html_safe
\ No newline at end of file
+%input{type: 'hidden', name:"champs['#{champ.id}']", id: "champs_#{champ.id}", value: ''}
+%input{type: 'checkbox', style:'margin-left: 15px;', name:"champs['#{champ.id}']", id: "champs_#{champ.id}", checked: ('checked' if champ.value == 'on')}
diff --git a/app/views/users/description/champs/_render_list_champs.html.haml b/app/views/users/description/champs/_render_list_champs.html.haml
index e15eceef6..261ef88e1 100644
--- a/app/views/users/description/champs/_render_list_champs.html.haml
+++ b/app/views/users/description/champs/_render_list_champs.html.haml
@@ -1,54 +1,55 @@
--champs.each do |champ|
+- champs.decorate.each do |champ|
- if champ.order_place > order_place
- if champ.type_champ == 'header_section'
- break
- - unless champ.type_champ == 'checkbox' || champ.type_champ == 'engagement'
- %h4
- = champ.libelle
- - if champ.mandatory?
- = '*'
-
- -if champ.type_champ == 'textarea'
- =render partial: 'users/description/champs/textarea', locals: {champ: champ}
-
- -elsif champ.type_champ == 'checkbox'
- = render partial: 'users/description/champs/checkbox', locals: {champ: champ}
-
- -elsif champ.type_champ == 'civilite'
- =render partial: 'users/description/champs/civilite', locals: {champ: champ}
-
- - elsif champ.type_champ == 'datetime'
- =render partial: 'users/description/champs/datetime', locals: {champ: champ}
-
- - elsif champ.type_champ == 'yes_no'
- =render partial: 'users/description/champs/yes_no', locals: {champ: champ}
-
- - elsif champ.type_champ == 'drop_down_list'
- =render partial: 'users/description/champs/drop_down_list', locals: {champ: champ}
-
- - elsif champ.type_champ == 'pays'
- =render partial: 'users/description/champs/pays', locals: {champ: champ}
-
- - elsif champ.type_champ == 'regions'
- =render partial: 'users/description/champs/regions', locals: {champ: champ}
-
- - elsif champ.type_champ == 'engagement'
- =render partial: 'users/description/champs/engagement', locals: {champ: champ}
-
- - elsif champ.type_champ == 'departements'
- =render partial: 'users/description/champs/departements', locals: {champ: champ}
-
- -else
- %input.form-control{name:"champs['#{champ.id}']",
- placeholder: champ.libelle,
- id: "champs_#{champ.id}",
- value: champ.value,
- type: champ.type_champ,
- 'data-provide' => champ.data_provide,
- 'data-date-format' => champ.data_date_format}
-
- - unless champ.description.empty? || champ.type_champ == 'engagement'
.row
- .col-lg-8.col-md-8.col-sm-8.col-xs-8{class: 'description_div', id:"description_champs_#{champ.id}"}
- = champ.description
+ %div{ class: if champ.type_champ == 'textarea' || champ.type_champ == 'engagement' then 'col-md-12' else 'col-md-6' end }
+ .form-group
+ %label{ for: "champs_#{ champ.id }"}
+ = champ.libelle
+ - if champ.mandatory?
+ *
+
+ - if champ.type_champ == 'textarea'
+ = render partial: 'users/description/champs/textarea', locals: { champ: champ }
+
+ - elsif champ.type_champ == 'checkbox'
+ = render partial: 'users/description/champs/checkbox', locals: { champ: champ }
+
+ - elsif champ.type_champ == 'civilite'
+ = render partial: 'users/description/champs/civilite', locals: { champ: champ }
+
+ - elsif champ.type_champ == 'datetime'
+ = render partial: 'users/description/champs/datetime', locals: { champ: champ }
+
+ - elsif champ.type_champ == 'yes_no'
+ = render partial: 'users/description/champs/yes_no', locals: { champ: champ }
+
+ - elsif champ.type_champ == 'drop_down_list'
+ = render partial: 'users/description/champs/drop_down_list', locals: { champ: champ }
+
+ - elsif champ.type_champ == 'pays'
+ = render partial: 'users/description/champs/pays', locals: { champ: champ }
+
+ - elsif champ.type_champ == 'regions'
+ = render partial: 'users/description/champs/regions', locals: { champ: champ }
+
+ - elsif champ.type_champ == 'engagement'
+ = render partial: 'users/description/champs/engagement', locals: { champ: champ }
+
+ - elsif champ.type_champ == 'departements'
+ = render partial: 'users/description/champs/departements', locals: { champ: champ }
+
+ - else
+ %input.form-control{name:"champs['#{ champ.id }']",
+ placeholder: champ.libelle,
+ id: "champs_#{ champ.id }",
+ value: champ.value,
+ type: champ.type_champ,
+ 'data-provide' => champ.data_provide,
+ 'data-date-format' => champ.data_date_format}
+
+ - unless champ.description.empty?
+ %div{ id:"description_champs_#{ champ.id }", class: ('help-block' unless champ.type_champ == 'engagement') }
+ = champ.description_with_links
diff --git a/app/views/users/description/champs/_textarea.html.haml b/app/views/users/description/champs/_textarea.html.haml
index 4c062a300..9ea66d68e 100644
--- a/app/views/users/description/champs/_textarea.html.haml
+++ b/app/views/users/description/champs/_textarea.html.haml
@@ -2,4 +2,4 @@
placeholder: champ.description,
id: "champs_#{champ.id}",
row: '6'}
- =champ.value
\ No newline at end of file
+ = champ.value
diff --git a/app/views/users/description/champs/_yes_no.html.haml b/app/views/users/description/champs/_yes_no.html.haml
index 9224f98f5..58cfac7e4 100644
--- a/app/views/users/description/champs/_yes_no.html.haml
+++ b/app/views/users/description/champs/_yes_no.html.haml
@@ -1,7 +1,8 @@
-%label.radio-inline
- = radio_button_tag "champs['#{champ.id}']", "true", champ.value == 'true'
- Oui
+%div
+ %label.radio-inline
+ = radio_button_tag "champs['#{champ.id}']", "true", champ.value == 'true'
+ Oui
-%label.radio-inline
- = radio_button_tag "champs['#{champ.id}']", "false", champ.value == 'false'
- Non
\ No newline at end of file
+ %label.radio-inline
+ = radio_button_tag "champs['#{champ.id}']", "false", champ.value == 'false'
+ Non
\ No newline at end of file
diff --git a/app/views/users/dossiers/_list.html.haml b/app/views/users/dossiers/_list.html.haml
index e3c7b05aa..9707d9e68 100644
--- a/app/views/users/dossiers/_list.html.haml
+++ b/app/views/users/dossiers/_list.html.haml
@@ -2,11 +2,11 @@
%table#dossiers_list.table
%thead
%th#sort-id.col-md-1.col-lg-1.col-sm-1.col-xs-1= smart_listing.sortable 'Numéro', 'id'
- %th#sort-libelle.col-md-5.col-sm-5.col-xs-5.col-lg-5= smart_listing.sortable 'Procédure', 'procedure.libelle'
- %th#sort-state.col-md-2.col-sm-2.col-xs-2.col-lg-2= smart_listing.sortable 'État', 'state'
- %th#sort-updated.col-md-2.col-sm-2.col-xs-2.col-lg-2= smart_listing.sortable 'Date de mise à jour', 'updated_at'
+ %th#sort-libelle.col-xs-5= smart_listing.sortable 'Procédure', 'procedure.libelle'
+ %th#sort-state.col-xs-2= smart_listing.sortable 'État', 'state'
+ %th#sort-updated.col-xs-2= smart_listing.sortable 'Date de mise à jour', 'updated_at'
- if @liste == "brouillon"
- %th.col-md-2.col-sm-2.col-xs-2.col-lg-2= 'Action'
+ %th.col-xs-2= 'Action'
- @dossiers.each do |dossier|
- if dossier.kind_of? Invite
- invite = dossier
diff --git a/app/views/users/dossiers/_state_description.html.haml b/app/views/users/dossiers/_state_description.html.haml
index 5cf936cef..6d66eb71b 100644
--- a/app/views/users/dossiers/_state_description.html.haml
+++ b/app/views/users/dossiers/_state_description.html.haml
@@ -4,7 +4,7 @@
.row
.col-md-1.col-lg-1.col-sm-1.col-xs-1
.fa.fa-info-circle.text-info{style:'font-size: 2em; margin-top: 20%'}
- .col-md-11.col-sm-11.col-xs-11.col-lg-11
+ .col-xs-11
-if dossiers_list_facade.liste == 'brouillon'
Les dossiers présents dans cette liste
%b
diff --git a/app/views/users/dossiers/index.html.haml b/app/views/users/dossiers/index.html.haml
index 509f46629..fce9b71a8 100644
--- a/app/views/users/dossiers/index.html.haml
+++ b/app/views/users/dossiers/index.html.haml
@@ -12,5 +12,4 @@
%div.body
= smart_listing_render :dossiers
- - unless Features.opensimplif
- = render partial: 'state_description', locals: {dossiers_list_facade: @dossiers_list_facade}
+ = render partial: 'state_description', locals: {dossiers_list_facade: @dossiers_list_facade}
diff --git a/bin/bundle b/bin/bundle
deleted file mode 100755
index 66e9889e8..000000000
--- a/bin/bundle
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
-load Gem.bin_path('bundler', 'bundle')
diff --git a/bin/setup b/bin/setup
deleted file mode 100755
index acdb2c138..000000000
--- a/bin/setup
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env ruby
-require 'pathname'
-
-# path to your application root.
-APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
-
-Dir.chdir APP_ROOT do
- # This script is a starting point to setup your application.
- # Add necessary setup steps to this file:
-
- puts "== Installing dependencies =="
- system "gem install bundler --conservative"
- system "bundle check || bundle install"
-
- # puts "\n== Copying sample files =="
- # unless File.exist?("config/database.yml")
- # system "cp config/database.yml.sample config/database.yml"
- # end
-
- puts "\n== Preparing database =="
- system "bin/rake db:setup"
-
- puts "\n== Removing old logs and tempfiles =="
- system "rm -f log/*"
- system "rm -rf tmp/cache"
-
- puts "\n== Restarting application server =="
- system "touch tmp/restart.txt"
-end
diff --git a/config/application.rb b/config/application.rb
index 2652a0b7c..8edea6693 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -25,9 +25,6 @@ module TPS
config.assets.paths << Rails.root.join('app', 'assets', 'javascript')
config.assets.precompile += %w( application_split2.css )
- # Do not swallow errors in after_commit/after_rollback callbacks.
- config.active_record.raise_in_transactional_callbacks = true
-
if Rails.env.production?
URL = "https://tps.apientreprise.fr/"
elsif Rails.env.staging?
diff --git a/config/deploy.rb b/config/deploy.rb
index e11f920ce..8403f2974 100644
--- a/config/deploy.rb
+++ b/config/deploy.rb
@@ -11,7 +11,7 @@ require 'mina/rbenv' # for rbenv support. (http://rbenv.org)
# branch - Branch name to deploy. (needed by mina/git)
ENV['to'] ||= "staging"
-raise "Bad to=#{+ENV['to']}" unless ["staging", "production", "opensimplif", "tps_v2"].include?(ENV['to'])
+raise "Bad to=#{+ENV['to']}" unless ["staging", "production", "tps_v2"].include?(ENV['to'])
raise "missing domain, run with 'rake deploy domain=37.187.154.237'" if ENV['domain'].nil?
@@ -42,15 +42,6 @@ elsif ENV["to"] == "production"
set :deploy_to, '/var/www/tps'
set :user, 'tps' # Username in the server to SSH to.
appname = 'tps'
-elsif ENV["to"] == "opensimplif"
- if ENV['branch'].nil?
- set :branch, 'master'
- else
- set :branch, ENV['branch']
- end
- set :deploy_to, '/var/www/opensimplif'
- set :user, 'opensimplif' # Username in the server to SSH to.
- appname = 'opensimplif'
elsif ENV["to"] == "tps_v2"
if ENV['branch'].nil?
set :branch, 'staging_v2'
@@ -64,9 +55,7 @@ end
set :rails_env, ENV["to"]
-if ENV["to"] == "opensimplif"
- set :rails_env, "production"
-elsif ENV["to"] == "tps_v2"
+if ENV["to"] == "tps_v2"
set :rails_env, "staging"
end
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 96dc809bb..acb324db7 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -42,7 +42,6 @@ Rails.application.configure do
# Action Mailer settings
config.action_mailer.delivery_method = :smtp
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
-
# Config for mailcatcher https://mailcatcher.me/
config.action_mailer.smtp_settings = {
:address => "localhost",
@@ -50,6 +49,11 @@ Rails.application.configure do
:locale => 'fr'
}
+ Rails.application.routes.default_url_options = {
+ host: 'localhost:3000',
+ protocol: :http
+ }
+
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 8640a6aae..79e0eed48 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -76,4 +76,8 @@ Rails.application.configure do
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
+
+ Rails.application.routes.default_url_options = {
+ protocol: :https
+ }
end
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 2d98c2462..902e927e1 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -39,6 +39,10 @@ Rails.application.configure do
config.action_mailer.delivery_method = :test
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
+ Rails.application.routes.default_url_options = {
+ host: 'localhost:3000',
+ protocol: :http
+ }
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb
index 01ef3e663..76333b2be 100644
--- a/config/initializers/assets.rb
+++ b/config/initializers/assets.rb
@@ -8,4 +8,4 @@ Rails.application.config.assets.version = '1.0'
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
-# Rails.application.config.assets.precompile += %w( search.js )
+Rails.application.config.assets.precompile += %w(print.css)
diff --git a/config/initializers/features.yml b/config/initializers/features.yml
index d243bd5f6..efd3e5324 100644
--- a/config/initializers/features.yml
+++ b/config/initializers/features.yml
@@ -1,2 +1 @@
-remote_storage: false
-opensimplif: false
+remote_storage: false
\ No newline at end of file
diff --git a/config/initializers/logos.rb b/config/initializers/logos.rb
index ad429846b..17446e837 100644
--- a/config/initializers/logos.rb
+++ b/config/initializers/logos.rb
@@ -1,2 +1 @@
-LOGO_NAME = 'logos/logo-tps.png' unless Features.opensimplif
-LOGO_NAME = 'logos/logo-opensimplif.jpg' if Features.opensimplif
+LOGO_NAME = 'logos/logo-tps.png'
diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb
new file mode 100644
index 000000000..f306c195a
--- /dev/null
+++ b/config/initializers/simple_form.rb
@@ -0,0 +1,169 @@
+# Use this setup block to configure all options available in SimpleForm.
+SimpleForm.setup do |config|
+ # Wrappers are used by the form builder to generate a
+ # complete input. You can remove any component from the
+ # wrapper, change the order or even add your own to the
+ # stack. The options given below are used to wrap the
+ # whole input.
+ config.wrappers :default, class: :input,
+ hint_class: :field_with_hint, error_class: :field_with_errors do |b|
+ ## Extensions enabled by default
+ # Any of these extensions can be disabled for a
+ # given input by passing: `f.input EXTENSION_NAME => false`.
+ # You can make any of these extensions optional by
+ # renaming `b.use` to `b.optional`.
+
+ # Determines whether to use HTML5 (:email, :url, ...)
+ # and required attributes
+ b.use :html5
+
+ # Calculates placeholders automatically from I18n
+ # You can also pass a string as f.input placeholder: "Placeholder"
+ b.use :placeholder
+
+ ## Optional extensions
+ # They are disabled unless you pass `f.input EXTENSION_NAME => true`
+ # to the input. If so, they will retrieve the values from the model
+ # if any exists. If you want to enable any of those
+ # extensions by default, you can change `b.optional` to `b.use`.
+
+ # Calculates maxlength from length validations for string inputs
+ # and/or database column lengths
+ b.optional :maxlength
+
+ # Calculate minlength from length validations for string inputs
+ b.optional :minlength
+
+ # Calculates pattern from format validations for string inputs
+ b.optional :pattern
+
+ # Calculates min and max from length validations for numeric inputs
+ b.optional :min_max
+
+ # Calculates readonly automatically from readonly attributes
+ b.optional :readonly
+
+ ## Inputs
+ b.use :label_input
+ b.use :hint, wrap_with: { tag: :span, class: :hint }
+ b.use :error, wrap_with: { tag: :span, class: :error }
+
+ ## full_messages_for
+ # If you want to display the full error message for the attribute, you can
+ # use the component :full_error, like:
+ #
+ # b.use :full_error, wrap_with: { tag: :span, class: :error }
+ end
+
+ # The default wrapper to be used by the FormBuilder.
+ config.default_wrapper = :default
+
+ # Define the way to render check boxes / radio buttons with labels.
+ # Defaults to :nested for bootstrap config.
+ # inline: input + label
+ # nested: label > input
+ config.boolean_style = :nested
+
+ # Default class for buttons
+ config.button_class = 'btn'
+
+ # Method used to tidy up errors. Specify any Rails Array method.
+ # :first lists the first message for each field.
+ # Use :to_sentence to list all errors for each field.
+ # config.error_method = :first
+
+ # Default tag used for error notification helper.
+ config.error_notification_tag = :div
+
+ # CSS class to add for error notification helper.
+ config.error_notification_class = 'error_notification'
+
+ # ID to add for error notification helper.
+ # config.error_notification_id = nil
+
+ # Series of attempts to detect a default label method for collection.
+ # config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
+
+ # Series of attempts to detect a default value method for collection.
+ # config.collection_value_methods = [ :id, :to_s ]
+
+ # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
+ # config.collection_wrapper_tag = nil
+
+ # You can define the class to use on all collection wrappers. Defaulting to none.
+ # config.collection_wrapper_class = nil
+
+ # You can wrap each item in a collection of radio/check boxes with a tag,
+ # defaulting to :span.
+ # config.item_wrapper_tag = :span
+
+ # You can define a class to use in all item wrappers. Defaulting to none.
+ # config.item_wrapper_class = nil
+
+ # How the label text should be generated altogether with the required text.
+ # config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" }
+
+ # You can define the class to use on all labels. Default is nil.
+ # config.label_class = nil
+
+ # You can define the default class to be used on forms. Can be overriden
+ # with `html: { :class }`. Defaulting to none.
+ # config.default_form_class = nil
+
+ # You can define which elements should obtain additional classes
+ # config.generate_additional_classes_for = [:wrapper, :label, :input]
+
+ # Whether attributes are required by default (or not). Default is true.
+ # config.required_by_default = true
+
+ # Tell browsers whether to use the native HTML5 validations (novalidate form option).
+ # These validations are enabled in SimpleForm's internal config but disabled by default
+ # in this configuration, which is recommended due to some quirks from different browsers.
+ # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
+ # change this configuration to true.
+ config.browser_validations = false
+
+ # Collection of methods to detect if a file type was given.
+ # config.file_methods = [ :mounted_as, :file?, :public_filename ]
+
+ # Custom mappings for input types. This should be a hash containing a regexp
+ # to match as key, and the input type that will be used when the field name
+ # matches the regexp as value.
+ # config.input_mappings = { /count/ => :integer }
+
+ # Custom wrappers for input types. This should be a hash containing an input
+ # type as key and the wrapper that will be used for all inputs with specified type.
+ # config.wrapper_mappings = { string: :prepend }
+
+ # Namespaces where SimpleForm should look for custom input classes that
+ # override default inputs.
+ # config.custom_inputs_namespaces << "CustomInputs"
+
+ # Default priority for time_zone inputs.
+ # config.time_zone_priority = nil
+
+ # Default priority for country inputs.
+ # config.country_priority = nil
+
+ # When false, do not use translations for labels.
+ # config.translate_labels = true
+
+ # Automatically discover new inputs in Rails' autoload path.
+ # config.inputs_discovery = true
+
+ # Cache SimpleForm inputs discovery
+ # config.cache_discovery = !Rails.env.development?
+
+ # Default class for inputs
+ # config.input_class = nil
+
+ # Define the default class of the input wrapper of the boolean input.
+ config.boolean_label_class = 'checkbox'
+
+ # Defines if the default input wrapper class should be included in radio
+ # collection wrappers.
+ # config.include_default_input_wrapper_class = true
+
+ # Defines which i18n scope will be used in Simple Form.
+ # config.i18n_scope = 'simple_form'
+end
diff --git a/config/initializers/simple_form_bootstrap.rb b/config/initializers/simple_form_bootstrap.rb
new file mode 100644
index 000000000..c7705e8e7
--- /dev/null
+++ b/config/initializers/simple_form_bootstrap.rb
@@ -0,0 +1,154 @@
+# Use this setup block to configure all options available in SimpleForm.
+SimpleForm.setup do |config|
+ config.error_notification_class = 'alert alert-danger'
+ config.button_class = 'btn btn-default'
+ config.boolean_label_class = nil
+
+ config.wrappers :vertical_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
+ b.use :html5
+ b.use :placeholder
+ b.optional :maxlength
+ b.optional :minlength
+ b.optional :pattern
+ b.optional :min_max
+ b.optional :readonly
+ b.use :label, class: 'control-label'
+
+ b.use :input, class: 'form-control'
+ b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
+ b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
+ end
+
+ config.wrappers :vertical_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
+ b.use :html5
+ b.use :placeholder
+ b.optional :maxlength
+ b.optional :minlength
+ b.optional :readonly
+ b.use :label, class: 'control-label'
+
+ b.use :input
+ b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
+ b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
+ end
+
+ config.wrappers :vertical_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
+ b.use :html5
+ b.optional :readonly
+
+ b.wrapper tag: 'div', class: 'checkbox' do |ba|
+ ba.use :label_input
+ end
+
+ b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
+ b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
+ end
+
+ config.wrappers :vertical_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
+ b.use :html5
+ b.optional :readonly
+ b.use :label, class: 'control-label'
+ b.use :input
+ b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
+ b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
+ end
+
+ config.wrappers :horizontal_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
+ b.use :html5
+ b.use :placeholder
+ b.optional :maxlength
+ b.optional :minlength
+ b.optional :pattern
+ b.optional :min_max
+ b.optional :readonly
+ b.use :label, class: 'col-sm-3 control-label'
+
+ b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
+ ba.use :input, class: 'form-control'
+ ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
+ ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
+ end
+ end
+
+ config.wrappers :horizontal_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
+ b.use :html5
+ b.use :placeholder
+ b.optional :maxlength
+ b.optional :minlength
+ b.optional :readonly
+ b.use :label, class: 'col-sm-3 control-label'
+
+ b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
+ ba.use :input
+ ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
+ ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
+ end
+ end
+
+ config.wrappers :horizontal_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
+ b.use :html5
+ b.optional :readonly
+
+ b.wrapper tag: 'div', class: 'col-sm-offset-3 col-sm-9' do |wr|
+ wr.wrapper tag: 'div', class: 'checkbox' do |ba|
+ ba.use :label_input
+ end
+
+ wr.use :error, wrap_with: { tag: 'span', class: 'help-block' }
+ wr.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
+ end
+ end
+
+ config.wrappers :horizontal_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
+ b.use :html5
+ b.optional :readonly
+
+ b.use :label, class: 'col-sm-3 control-label'
+
+ b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
+ ba.use :input
+ ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
+ ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
+ end
+ end
+
+ config.wrappers :inline_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
+ b.use :html5
+ b.use :placeholder
+ b.optional :maxlength
+ b.optional :minlength
+ b.optional :pattern
+ b.optional :min_max
+ b.optional :readonly
+ b.use :label, class: 'sr-only'
+
+ b.use :input, class: 'form-control'
+ b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
+ b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
+ end
+
+ config.wrappers :multi_select, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
+ b.use :html5
+ b.optional :readonly
+ b.use :label, class: 'control-label'
+ b.wrapper tag: 'div', class: 'form-inline' do |ba|
+ ba.use :input, class: 'form-control'
+ ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
+ ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
+ end
+ end
+ # Wrappers for forms and inputs using the Bootstrap toolkit.
+ # Check the Bootstrap docs (http://getbootstrap.com)
+ # to learn about the different styles for forms and inputs,
+ # buttons and other elements.
+ config.default_wrapper = :vertical_form
+ config.wrapper_mappings = {
+ check_boxes: :vertical_radio_and_checkboxes,
+ radio_buttons: :vertical_radio_and_checkboxes,
+ file: :vertical_file_input,
+ boolean: :vertical_boolean,
+ datetime: :multi_select,
+ date: :multi_select,
+ time: :multi_select
+ }
+end
diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml
new file mode 100644
index 000000000..237438334
--- /dev/null
+++ b/config/locales/simple_form.en.yml
@@ -0,0 +1,31 @@
+en:
+ simple_form:
+ "yes": 'Yes'
+ "no": 'No'
+ required:
+ text: 'required'
+ mark: '*'
+ # You can uncomment the line below if you need to overwrite the whole required html.
+ # When using html, text and mark won't be used.
+ # html: '*'
+ error_notification:
+ default_message: "Please review the problems below:"
+ # Examples
+ # labels:
+ # defaults:
+ # password: 'Password'
+ # user:
+ # new:
+ # email: 'E-mail to sign in.'
+ # edit:
+ # email: 'E-mail.'
+ # hints:
+ # defaults:
+ # username: 'User name to sign in.'
+ # password: 'No special characters, please.'
+ # include_blanks:
+ # defaults:
+ # age: 'Rather not say'
+ # prompts:
+ # defaults:
+ # age: 'Select your age'
diff --git a/config/locales/simple_form.fr.yml b/config/locales/simple_form.fr.yml
new file mode 100644
index 000000000..73dbc13fc
--- /dev/null
+++ b/config/locales/simple_form.fr.yml
@@ -0,0 +1,31 @@
+fr:
+ simple_form:
+ "yes": 'Oui'
+ "no": 'Non'
+ required:
+ text: 'obligatoire'
+ mark: '*'
+ # You can uncomment the line below if you need to overwrite the whole required html.
+ # When using html, text and mark won't be used.
+ # html: '*'
+ error_notification:
+ default_message: "Erreur, veuillez vérifier vos réponses:"
+ # Examples
+ # labels:
+ # defaults:
+ # password: 'Password'
+ # user:
+ # new:
+ # email: 'E-mail to sign in.'
+ # edit:
+ # email: 'E-mail.'
+ # hints:
+ # defaults:
+ # username: 'User name to sign in.'
+ # password: 'No special characters, please.'
+ # include_blanks:
+ # defaults:
+ # age: 'Rather not say'
+ # prompts:
+ # defaults:
+ # age: 'Select your age'
diff --git a/config/routes.rb b/config/routes.rb
index abe924522..4925ef475 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,5 +1,4 @@
Rails.application.routes.draw do
- default_url_options protocol: :https
get "/ping" => "ping#index", :constraints => {:ip => /127.0.0.1/}
@@ -43,13 +42,6 @@ Rails.application.routes.draw do
get 'admin' => 'admin#index'
get 'backoffice' => 'backoffice#index'
- if Features.opensimplif
- get 'simplifications' => 'opensimplif#index'
- get 'simplifications/reload_smartlisting' => 'opensimplif#reload_smartlisting'
- get 'simplifications/nothing' => 'opensimplif#nothing'
- get 'simplifications/:id' => 'opensimplif#index', as: :simplification
- end
-
resources :administrations
namespace :france_connect do
@@ -130,7 +122,7 @@ Rails.application.routes.draw do
post '/:index/move_down' => 'pieces_justificatives#move_down', as: :move_down
end
- resources 'mails'
+ resources :mail_templates, only: [:index, :edit, :update]
put 'archive' => 'procedures#archive', as: :archive
put 'publish' => 'procedures#publish', as: :publish
@@ -172,6 +164,7 @@ Rails.application.routes.draw do
post 'refuse' => 'dossiers#refuse'
post 'without_continuation' => 'dossiers#without_continuation'
post 'close' => 'dossiers#close'
+ post 'archive' => 'dossiers#archive'
put 'follow' => 'dossiers#follow'
resources :commentaires, only: [:index]
diff --git a/db/migrate/20170118144306_add_lien_to_type_de_piece_justificative.rb b/db/migrate/20170118144306_add_lien_to_type_de_piece_justificative.rb
new file mode 100644
index 000000000..93d970638
--- /dev/null
+++ b/db/migrate/20170118144306_add_lien_to_type_de_piece_justificative.rb
@@ -0,0 +1,5 @@
+class AddLienToTypeDePieceJustificative < ActiveRecord::Migration[5.0]
+ def change
+ add_column :types_de_piece_justificative, :lien_demarche, :string, default: nil
+ end
+end
diff --git a/db/migrate/20170125152856_init_mail_validated_for_all_procedure.rb b/db/migrate/20170125152856_init_mail_validated_for_all_procedure.rb
new file mode 100644
index 000000000..74c261fa2
--- /dev/null
+++ b/db/migrate/20170125152856_init_mail_validated_for_all_procedure.rb
@@ -0,0 +1,9 @@
+class InitMailValidatedForAllProcedure < ActiveRecord::Migration[5.0]
+ def change
+ Procedure.all.each do |p|
+ unless p.mail_validated
+ p.mail_templates << MailValidated.create
+ end
+ end
+ end
+end
diff --git a/db/migrate/20170215102943_remove_duplicate_email_received.rb b/db/migrate/20170215102943_remove_duplicate_email_received.rb
new file mode 100644
index 000000000..ec37aaf93
--- /dev/null
+++ b/db/migrate/20170215102943_remove_duplicate_email_received.rb
@@ -0,0 +1,11 @@
+class RemoveDuplicateEmailReceived < ActiveRecord::Migration[5.0]
+ def change
+ all_mails = MailReceived.all
+ groupped = all_mails.group_by { |m| m.procedure_id }
+ filtered = groupped.reject { |k, v| v.length < 2 }
+ filtered.each do |k, duplicate_mails|
+ duplicate_mails.pop
+ duplicate_mails.each(&:destroy)
+ end
+ end
+end
diff --git a/db/migrate/20170215142944_add_timestamps_to_mail_template.rb b/db/migrate/20170215142944_add_timestamps_to_mail_template.rb
new file mode 100644
index 000000000..bbdb2fd2b
--- /dev/null
+++ b/db/migrate/20170215142944_add_timestamps_to_mail_template.rb
@@ -0,0 +1,6 @@
+class AddTimestampsToMailTemplate < ActiveRecord::Migration[5.0]
+ def change
+ add_column :mail_templates, :created_at, :datetime
+ add_column :mail_templates, :updated_at, :datetime
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index e9491dca0..3af9d7709 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20161227103823) do
+ActiveRecord::Schema.define(version: 20170215142944) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -234,10 +234,12 @@ ActiveRecord::Schema.define(version: 20161227103823) do
end
create_table "mail_templates", force: :cascade do |t|
- t.string "object"
- t.text "body"
- t.string "type"
- t.integer "procedure_id"
+ t.string "object"
+ t.text "body"
+ t.string "type"
+ t.integer "procedure_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
end
create_table "module_api_cartos", force: :cascade do |t|
@@ -361,6 +363,7 @@ ActiveRecord::Schema.define(version: 20161227103823) do
t.datetime "updated_at", null: false
t.integer "procedure_id"
t.integer "order_place"
+ t.string "lien_demarche"
end
create_table "users", force: :cascade do |t|
diff --git a/lib/tasks/opensimplif_import.rake b/lib/tasks/opensimplif_import.rake
deleted file mode 100644
index 7131153ed..000000000
--- a/lib/tasks/opensimplif_import.rake
+++ /dev/null
@@ -1,118 +0,0 @@
-require 'csv'
-require 'json'
-
-namespace :opensimplif_import do
- task :import_all => :environment do
- puts 'start opensimplif'
-
- Rake::Task['opensimplif_import:import_proposition'].invoke
- Rake::Task['opensimplif_import:import_piste'].invoke
- Rake::Task['opensimplif_import:import_mesure'].invoke
-
- puts 'end import opensimplif'
- end
-
- task :import_proposition do
- file_path = "lib/tasks/161102_OS_Inputs_test_propositions.csv"
- procedure_id = 35
-
- matching = [
- {id: 44, key: 'Intitulé de la proposition'},
- {id: 43, key: 'Champ concerné'},
- {id: 45, key: 'Champ ministériel chef de file'},
- {id: 59, key: 'Date de la proposition'},
- {id: 60, key: 'Moment de vie'},
- {id: 61, key: 'Source'},
- {id: 48, key: 'Description de la proposition'}
- ]
-
- puts 'start propositions'
- import file_path, procedure_id, matching
- puts 'done propositions'
- end
-
- task :import_piste do
- file_path = "lib/tasks/161102_OS_Inputs_test_pistes.csv"
- procedure_id = 36
-
- matching = [
- {id: 81, key: 'Intitulé de la piste *'},
- {id: 82, key: 'Usager concerné *'},
- {id: 83, key: 'Champ ministériel chef de file *'},
- {id: 84, key: 'Champ ministériel contributeur'},
- {id: 85, key: 'Date de saisine'},
- {id: 66, key: 'Moment de vie'},
- {id: 80, key: 'Source de la piste'},
- {id: 70, key: 'Description de la piste '},
- {id: 68, key: 'Objectifs / bénéfices attendus'},
- {id: 65, key: 'Description détaillée des démarches impactées par la piste'},
- {id: 69, key: 'Levier de mise en oeuvre'},
- {id: 67, key: 'Précision sur le levier de meo'},
- {id: 64, key: 'Calendrier de mise en oeuvre'}
- ]
-
- puts 'start piste'
- import file_path, procedure_id, matching
- puts 'done pistes'
- end
-
- task :import_mesure do
- file_path = "lib/tasks/161102_OS_Inputs_test_mesures.csv"
- procedure_id = 37
-
- matching = [
- {id: 107, key: 'Intitulé projet / mesure'},
- {id: 104, key: 'Champ concerné'},
- {id: 105, key: 'Champ ministériel chef de file'},
- {id: 112, key: 'Direction chef de file'},
- {id: 106, key: 'Champ ministériel contributeur'},
- {id: 113, key: 'Direction contributrice'},
- {id: 92, key: 'Moment de vie'},
- {id: 109, key: 'Date d\'annonce'},
- {id: 114, key: 'N° de la mesure'},
- {id: 115, key: 'Responsable ministère'},
- {id: 116, key: 'Responsable SGMAP'},
- {id: 89, key: 'Actions réalisées'},
- {id: 95, key: 'Etapes nécessaires à l\'atteinte de la cible et alertes'},
- {id: 102, key: 'Alertes'},
- {id: 101, key: 'Échéance initiale'},
- {id: 96, key: 'Échéance prévisionnelle / réelle'},
- {id: 94, key: 'Appréciation avancement'},
- {id: 91, key: 'Etat d\'avancement LOLF'},
- {id: 111, key: '§ de com'}
- ]
-
- puts 'start mesures'
- import file_path, procedure_id, matching
- puts 'done mesures'
- end
-
- def self.import file_path, procedure_id, matching
- user = User.find_or_create_by(email: 'import@opensimplif.modernisation.fr')
-
- unless user.valid?
- user.password = 'TPSpassword2016'
- user.save
- end
-
- file ||= CSV.open(file_path, :col_sep => ";", :headers => true).map { |x| x.to_h }.to_json
- file = JSON.parse(file)
-
- procedure = Procedure.find(procedure_id)
-
- user.dossiers.where(procedure_id: procedure.id).destroy_all
-
- file.each do |proposition|
- dossier = Dossier.create procedure: procedure, user: user, state: :initiated
-
- dossier.champs.each do |champ|
- matching.each do |match|
- if match[:id] == champ.type_de_champ.id
- champ.update_column :value, proposition[match[:key]]
- break
- end
- end
- end
- end
- end
-end
diff --git a/lib/templates/haml/scaffold/_form.html.haml b/lib/templates/haml/scaffold/_form.html.haml
new file mode 100644
index 000000000..ac3aa7bc1
--- /dev/null
+++ b/lib/templates/haml/scaffold/_form.html.haml
@@ -0,0 +1,10 @@
+= simple_form_for(@<%= singular_table_name %>) do |f|
+ = f.error_notification
+
+ .form-inputs
+ <%- attributes.each do |attribute| -%>
+ = f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %>
+ <%- end -%>
+
+ .form-actions
+ = f.button :submit
diff --git a/spec/controllers/admin/mail_templates_controller_spec.rb b/spec/controllers/admin/mail_templates_controller_spec.rb
new file mode 100644
index 000000000..e80ba6c5b
--- /dev/null
+++ b/spec/controllers/admin/mail_templates_controller_spec.rb
@@ -0,0 +1,51 @@
+require 'spec_helper'
+
+describe Admin::MailTemplatesController, type: :controller do
+ let(:mail_template) { create :mail_template, :dossier_received }
+ let(:procedure) { create :procedure, mail_templates: [mail_template]}
+
+ before do
+ sign_in procedure.administrateur
+ end
+
+ describe 'GET index' do
+ render_views
+
+ subject { get :index, params: {procedure_id: procedure.id} }
+
+ it { expect(subject.status).to eq 200 }
+ it { expect(subject.body).to include("E-mails personnalisables") }
+ it { expect(subject.body).to include(*procedure.mail_templates.map{ |mt| mt.decorate.name }) }
+ end
+
+ describe 'PATCH update' do
+ let(:object) { 'plop modif' }
+ let(:body) { 'plip modif' }
+
+ context 'when is mail_template id' do
+ subject { patch :update,
+ params: {procedure_id: mail_template.procedure.id,
+ id: mail_template.id,
+ mail_template: {
+ object: object,
+ body: body
+ }} }
+
+ it { expect(subject).to redirect_to admin_procedure_mail_templates_path(mail_template.procedure) }
+
+ it {
+ expect {
+ subject
+ mail_template.reload
+ }.to change(mail_template, :object).from("[TPS] Accusé de réception pour votre dossier n°--numero_dossier--").to(object)
+ }
+
+ it {
+ expect {
+ subject
+ mail_template.reload
+ }.to change(mail_template, :body).from("Votre administration vous confirme la bonne réception de votre dossier n°--numero_dossier--").to(body)
+ }
+ end
+ end
+end
diff --git a/spec/controllers/admin/mails_controller_spec.rb b/spec/controllers/admin/mails_controller_spec.rb
deleted file mode 100644
index a51045d9e..000000000
--- a/spec/controllers/admin/mails_controller_spec.rb
+++ /dev/null
@@ -1,42 +0,0 @@
-require 'spec_helper'
-
-describe Admin::MailsController, type: :controller do
- let(:procedure) { create :procedure }
-
- before do
- sign_in procedure.administrateur
- end
-
- describe 'GET index' do
- subject { get :index, params: {procedure_id: procedure.id} }
-
- it { expect(subject.status).to eq 200 }
- end
-
- describe 'PATCH update' do
- let(:object) { 'plop modif' }
- let(:body) { 'plip modif' }
-
- context 'when is mail_received id' do
- subject { patch :update,
- params: {procedure_id: procedure.id,
- id: procedure.mail_received.id,
- mail_received: {
- object: object,
- body: body
- }} }
-
- it { expect(subject).to redirect_to admin_procedure_mails_path }
-
- describe 'values in database for mail received' do
- before do
- subject
- procedure.reload
- end
-
- it { expect(procedure.mail_received.object).to eq object }
- it { expect(procedure.mail_received.body).to eq body }
- end
- end
- end
-end
\ No newline at end of file
diff --git a/spec/controllers/admin/procedures_controller_spec.rb b/spec/controllers/admin/procedures_controller_spec.rb
index 7d3379723..0efacba6e 100644
--- a/spec/controllers/admin/procedures_controller_spec.rb
+++ b/spec/controllers/admin/procedures_controller_spec.rb
@@ -13,6 +13,7 @@ describe Admin::ProceduresController, type: :controller do
let(:use_api_carto) { '0' }
let(:quartiers_prioritaires) { '0' }
let(:cadastre) { '0' }
+ let(:cerfa_flag) { true }
let(:procedure_params) {
{
@@ -21,6 +22,7 @@ describe Admin::ProceduresController, type: :controller do
organisation: organisation,
direction: direction,
lien_demarche: lien_demarche,
+ cerfa_flag: cerfa_flag,
module_api_carto_attributes: {
use_api_carto: use_api_carto,
quartiers_prioritaires: quartiers_prioritaires,
@@ -105,24 +107,24 @@ describe Admin::ProceduresController, type: :controller do
sign_out admin
end
- it { expect(subject).to redirect_to new_user_session_path }
+ it { is_expected.to redirect_to new_user_session_path }
end
context 'when user is connected' do
context 'when procedure exist' do
let(:procedure_id) { procedure.id }
- it { expect(subject).to have_http_status(:success) }
+ it { is_expected.to have_http_status(:success) }
end
context 'when procedure is published' do
let(:published) { true }
- it { is_expected.to redirect_to admin_procedure_path id: procedure_id }
+ it { is_expected.to have_http_status(:success) }
end
context "when procedure doesn't exist" do
let(:procedure_id) { bad_procedure_id }
- it { expect(subject).to have_http_status(404) }
+ it { is_expected.to have_http_status(404) }
end
end
end
@@ -164,7 +166,7 @@ describe Admin::ProceduresController, type: :controller do
it { expect(subject.quartiers_prioritaires).to be_truthy }
end
- it { expect(subject).to redirect_to(admin_procedure_types_de_champ_path(procedure_id: Procedure.last.id)) }
+ it { is_expected.to redirect_to(admin_procedure_types_de_champ_path(procedure_id: Procedure.last.id)) }
it { expect(flash[:notice]).to be_present }
end
@@ -204,7 +206,7 @@ describe Admin::ProceduresController, type: :controller do
subject { put :update, params: {id: procedure.id} }
- it { expect(subject).to redirect_to new_user_session_path }
+ it { is_expected.to redirect_to new_user_session_path }
end
context 'when administrateur is connected' do
@@ -213,7 +215,7 @@ describe Admin::ProceduresController, type: :controller do
procedure.reload
end
- context 'when all attributs are informated' do
+ context 'when all attributs are present' do
let(:libelle) { 'Blable' }
let(:description) { 'blabla' }
let(:organisation) { 'plop' }
@@ -240,7 +242,7 @@ describe Admin::ProceduresController, type: :controller do
it { expect(subject.cadastre).to be_truthy }
end
- it { expect(subject).to redirect_to(edit_admin_procedure_path id: procedure.id) }
+ it { is_expected.to redirect_to(edit_admin_procedure_path id: procedure.id) }
it { expect(flash[:notice]).to be_present }
end
@@ -260,6 +262,26 @@ describe Admin::ProceduresController, type: :controller do
it { expect(subject.cadastre).to be_falsey }
end
end
+
+ context 'when procedure is published' do
+ let!(:procedure) { create(:procedure, :with_type_de_champ, :with_two_type_de_piece_justificative, :published, administrateur: admin) }
+
+ describe 'only some properties can be updated' do
+ subject { procedure }
+
+ it { expect(subject.libelle).to eq procedure_params[:libelle] }
+ it { expect(subject.description).to eq procedure_params[:description] }
+ it { expect(subject.organisation).to eq procedure_params[:organisation] }
+ it { expect(subject.direction).to eq procedure_params[:direction] }
+
+ it { expect(subject.cerfa_flag).not_to eq procedure_params[:cerfa_flag] }
+ it { expect(subject.lien_demarche).not_to eq procedure_params[:lien_demarche] }
+ it { expect(subject.for_individual).not_to eq procedure_params[:for_individual] }
+ it { expect(subject.individual_with_siret).not_to eq procedure_params[:individual_with_siret] }
+ it { expect(subject.use_api_carto).not_to eq procedure_params[:module_api_carto_attributes][:use_api_carto] }
+
+ end
+ end
end
end
diff --git a/spec/controllers/backoffice/dossiers_controller_spec.rb b/spec/controllers/backoffice/dossiers_controller_spec.rb
index 1835b572c..89153cfaf 100644
--- a/spec/controllers/backoffice/dossiers_controller_spec.rb
+++ b/spec/controllers/backoffice/dossiers_controller_spec.rb
@@ -5,16 +5,25 @@ describe Backoffice::DossiersController, type: :controller do
@request.env['HTTP_REFERER'] = TPS::Application::URL
end
let(:procedure) { create :procedure }
+ let(:procedure2) { create :procedure }
let(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: :initiated) }
+ let(:dossier2) { create(:dossier, :with_entreprise, procedure: procedure2, state: :initiated) }
let(:dossier_archived) { create(:dossier, :with_entreprise, archived: true) }
let(:dossier_id) { dossier.id }
+ let(:dossier2_id) { dossier2.id }
let(:bad_dossier_id) { Dossier.count + 10 }
+
let(:gestionnaire) { create(:gestionnaire, administrateurs: [create(:administrateur)]) }
+ let!(:gestionnaire2) { create(:gestionnaire, administrateurs: [create(:administrateur)]) }
before do
create :assign_to, procedure: procedure, gestionnaire: gestionnaire
+ create :assign_to, procedure: procedure2, gestionnaire: gestionnaire2
+
+ procedure.dossiers << dossier
+ procedure2.dossiers << dossier2
end
describe 'GET #index' do
@@ -166,15 +175,42 @@ describe Backoffice::DossiersController, type: :controller do
end
describe 'POST #search' do
- before do
- sign_in gestionnaire
- end
+ describe 'by id' do
+ context 'when I am logged as a gestionnaire' do
+ before do
+ sign_in gestionnaire
+ end
- it 'returns http success' do
- post :search, params: {search_terms: 'test'}
- expect(response).to have_http_status(200)
- end
+ context 'when I own the dossier' do
+ before :each do
+ post :search, params: { q: dossier_id }
+ end
+ it 'returns http success' do
+ expect(response).to have_http_status(200)
+ end
+
+ it 'returns the expected dossier' do
+ expect(assigns(:dossiers).count).to eq(1)
+ expect(assigns(:dossiers).first.id).to eq(dossier_id)
+ end
+ end
+
+ context 'when I do not own the dossier' do
+ before :each do
+ post :search, params: { q: dossier2_id }
+ end
+
+ it 'returns http success' do
+ expect(response).to have_http_status(200)
+ end
+
+ it 'returns nothing' do
+ expect(assigns(:dossiers).count).to eq(0)
+ end
+ end
+ end
+ end
end
describe 'POST #valid' do
@@ -345,4 +381,23 @@ describe Backoffice::DossiersController, type: :controller do
end
end
end
+
+
+ describe 'POST #archive' do
+ before do
+ dossier.update(archived: false)
+ sign_in gestionnaire
+ end
+
+ subject { post :archive, params: {dossier_id: dossier_id} }
+
+ it 'change state to archived' do
+ subject
+
+ dossier.reload
+ expect(dossier.archived).to eq(true)
+ end
+
+ it { is_expected.to redirect_to backoffice_dossiers_path }
+ end
end
diff --git a/spec/controllers/root_controller_spec.rb b/spec/controllers/root_controller_spec.rb
index 60ad3e58d..94e83fe2f 100644
--- a/spec/controllers/root_controller_spec.rb
+++ b/spec/controllers/root_controller_spec.rb
@@ -56,18 +56,31 @@ describe RootController, type: :controller do
end
it { expect(response.body).to have_css('#landing') }
+
end
- context 'when opensimplif features is true' do
- let(:gestionnaire) { create(:gestionnaire) }
+ context 'environment is not development' do
+ render_views
before do
- sign_in gestionnaire
-
- allow_any_instance_of(Features).to receive(:opensimplif).and_return(true)
+ Rails.env.stub(:development? => false)
+ subject
end
- it { expect(subject).to redirect_to(simplifications_path) }
+ it { expect(response.body).to have_link('Démonstration', href: "https://tps-dev.apientreprise.fr#{ users_sign_in_demo_path }") }
+
+ end
+
+ context 'environment is development' do
+ render_views
+
+ before do
+ Rails.env.stub(:development? => true)
+ subject
+ end
+
+ it { expect(response.body).to have_link('Démonstration', href: users_sign_in_demo_path) }
+
end
context "unified login" do
@@ -81,4 +94,5 @@ describe RootController, type: :controller do
expect(response.body).to have_css("a[href='#{new_user_session_path}']")
end
end
+
end
diff --git a/spec/controllers/users/sessions_controller_spec.rb b/spec/controllers/users/sessions_controller_spec.rb
index ebfb037b7..f3e0072b8 100644
--- a/spec/controllers/users/sessions_controller_spec.rb
+++ b/spec/controllers/users/sessions_controller_spec.rb
@@ -100,6 +100,24 @@ describe Users::SessionsController, type: :controller do
expect(subject.current_gestionnaire).to be(nil)
expect(subject.current_administrateur).to be(nil)
end
+
+ context 'with different passwords' do
+ let!(:gestionnaire) { create(:gestionnaire, email: email, password: 'another_password') }
+ let!(:administrateur) { create(:administrateur, email: email, password: 'another_password') }
+
+ before do
+ user
+ end
+
+ it 'should sync passwords on login' do
+ post :create, params: { user: { email: email, password: password } }
+ gestionnaire.reload
+ administrateur.reload
+ expect(user.valid_password?(password)).to be(true)
+ expect(gestionnaire.valid_password?(password)).to be(true)
+ expect(administrateur.valid_password?(password)).to be(true)
+ end
+ end
end
end
diff --git a/spec/decorators/mail_template_decorator_spec.rb b/spec/decorators/mail_template_decorator_spec.rb
new file mode 100644
index 000000000..4cfce8226
--- /dev/null
+++ b/spec/decorators/mail_template_decorator_spec.rb
@@ -0,0 +1,21 @@
+require 'spec_helper'
+
+describe MailTemplateDecorator do
+ let(:mail_template) {create :mail_template}
+ let(:decorator) { mail_template.decorate }
+
+ context '#name' do
+ subject { decorator.name }
+
+ context 'when mail_template is a MailValidated' do
+ it { is_expected.to eq "E-mail de validation" }
+ end
+
+ context 'when mail_template is a MailReceived' do
+ let(:mail_template) {create :mail_template, :dossier_received}
+ it { is_expected.to eq "E-mail d'accusé de réception" }
+ end
+
+ end
+
+end
diff --git a/spec/facades/invite_dossier_facades_spec.rb b/spec/facades/invite_dossier_facades_spec.rb
deleted file mode 100644
index 63093b2e9..000000000
--- a/spec/facades/invite_dossier_facades_spec.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-require 'spec_helper'
-
-describe InviteDossierFacades do
-
- let(:dossier) { create :dossier }
- let(:email) { 'email@octo.com' }
-
- subject { described_class.new dossier.id, email }
-
- before do
- create :invite, email: email, dossier: dossier
- end
-
- it { expect(subject.dossier).to eq dossier }
-end
\ No newline at end of file
diff --git a/spec/factories/mail_templates.rb b/spec/factories/mail_templates.rb
new file mode 100644
index 000000000..aac0d3615
--- /dev/null
+++ b/spec/factories/mail_templates.rb
@@ -0,0 +1,21 @@
+FactoryGirl.define do
+ factory :mail_template do
+ object "Object, voila voila"
+ body "Blabla ceci est mon body"
+ type 'MailValidated'
+
+ trait :dossier_submitted do
+ type 'MailSubmitted'
+ end
+
+ trait :dossier_refused do
+ type 'MailRefused'
+ end
+
+ trait :dossier_received do
+ object "[TPS] Accusé de réception pour votre dossier n°--numero_dossier--"
+ body "Votre administration vous confirme la bonne réception de votre dossier n°--numero_dossier--"
+ type 'MailReceived'
+ end
+ end
+end
diff --git a/spec/factories/procedure.rb b/spec/factories/procedure.rb
index 740faf5bc..d3b7cc066 100644
--- a/spec/factories/procedure.rb
+++ b/spec/factories/procedure.rb
@@ -7,7 +7,9 @@ FactoryGirl.define do
organisation "Orga SGMAP"
direction "direction SGMAP"
published false
+ cerfa_flag false
administrateur { create(:administrateur) }
+ mail_templates { [create(:mail_template, :dossier_received)]}
after(:build) do |procedure, _evaluator|
if procedure.module_api_carto.nil?
diff --git a/spec/features/admin/procedure_creation_spec.rb b/spec/features/admin/procedure_creation_spec.rb
index a8d06e8af..8081ca485 100644
--- a/spec/features/admin/procedure_creation_spec.rb
+++ b/spec/features/admin/procedure_creation_spec.rb
@@ -46,7 +46,6 @@ feature 'As an administrateur I wanna create a new procedure', js: true do
end
context 'Editing a new procedure' do
-
before 'Create procedure' do
page.find_by_id('new-procedure').click
fill_in 'procedure_libelle', with: 'libelle de la procedure'
diff --git a/spec/features/admin/procedure_locked_spec.rb b/spec/features/admin/procedure_locked_spec.rb
index bfd9fc2d6..12961e56c 100644
--- a/spec/features/admin/procedure_locked_spec.rb
+++ b/spec/features/admin/procedure_locked_spec.rb
@@ -13,7 +13,7 @@ feature 'procedure locked' do
context 'when procedure is not published' do
scenario 'info label is not present' do
- expect(page).not_to have_content('La procédure ne peut plus être modifiée car elle a été publiée')
+ expect(page).not_to have_content('Cette procédure a été publiée, certains éléments ne peuvent plus être modifiés')
end
end
end
diff --git a/spec/features/backoffice/flux_de_commentaires_spec.rb b/spec/features/backoffice/flux_de_commentaires_spec.rb
index 833225cbb..cb01618cd 100644
--- a/spec/features/backoffice/flux_de_commentaires_spec.rb
+++ b/spec/features/backoffice/flux_de_commentaires_spec.rb
@@ -22,33 +22,4 @@ feature 'backoffice: flux de commentaires' do
comments = find(".commentaires")
expect(comments).to have_selector(".content", count: 1)
end
-
- scenario "affichage des commentaires du champs", js: true do
- pending 'later: open simplif'
- find("#liste_champs th", text: champ1.libelle).click_link("COM")
- expect(page).to have_css("#modalCommentairesDossierParChamp.in")
-
- modal = find("#modalCommentairesDossierParChamp")
- expect(modal).to have_css(".description", count: 2)
- end
-
- scenario "crée un commentaire sur un champ", js: true do
- pending 'later: open simplif'
- # ouverture modale
- find("#liste_champs th", text: champ1.libelle).click_link("COM")
-
- # ajout du commentaire
- form = find("#modalCommentairesDossierParChamp").find("#commentaire_new")
- form.fill_in("texte_commentaire", with: "le corps du commentaire sur le champ #{champ1.libelle}")
- form.click_on("Poster")
-
- # le commentaire ne s'ajoute pas aux commentaires généraux
- comments = find("#commentaires_flux")
- expect(comments).to have_selector(".description", count: 1)
-
- # ajout du commentaire aux commentaires du champs
- find("#liste_champs th", text: champ1.libelle).click_link("COM")
- modal = find("#modalCommentairesDossierParChamp")
- expect(modal).to have_css(".description", count: 3)
- end
end
diff --git a/spec/features/backoffice/index_show_procedure_spec.rb b/spec/features/backoffice/index_show_procedure_spec.rb
index b59fdbe46..4056bfb01 100644
--- a/spec/features/backoffice/index_show_procedure_spec.rb
+++ b/spec/features/backoffice/index_show_procedure_spec.rb
@@ -1,7 +1,6 @@
require 'spec_helper'
-feature 'As an Accompagnateur I can navigate and use each functionnality around procedures and their dossiers', js: true do
-
+feature 'As an Accompagnateur I can navigate and use each functionnality around procedures and their dossiers' do
let(:user) { create(:user) }
let(:gestionnaire) { create(:gestionnaire) }
let(:procedure_1) { create(:procedure, :with_type_de_champ, libelle: 'procedure 1') }
@@ -23,46 +22,46 @@ feature 'As an Accompagnateur I can navigate and use each functionnality around
context 'On index' do
scenario 'Switching between procedures' do
- page.all('#procedure_list a').first.trigger('click')
+ page.all('#procedure_list a').first.click
expect(page).to have_current_path(backoffice_dossiers_procedure_path(id: procedure_1.id.to_s), only_path: true)
expect(page.find('#all_dossiers .count').text).to eq('30 dossiers')
- page.all('#procedure_list a').last.trigger('click')
+ page.all('#procedure_list a').last.click
expect(page).to have_current_path(backoffice_dossiers_procedure_path(id: procedure_2.id.to_s), only_path: true)
expect(page.find('#all_dossiers .count').text).to eq('22 dossiers')
end
- scenario 'Searching with search bar' do
+ scenario 'Searching with search bar', js: true do
page.find_by_id('search_area').trigger('click')
- fill_in 'q', with: '15'
- page.find_by_id('search_button').trigger('click')
- page.find_by_id('tr_dossier_15').trigger('click')
- expect(page).to have_current_path("/backoffice/dossiers/15")
+ fill_in 'q', with: (procedure_1.dossiers.first.id + 14)
+ page.find_by_id('search_button').click
+ page.find_by_id("tr_dossier_#{(procedure_1.dossiers.first.id + 14)}").click
+ expect(page).to have_current_path("/backoffice/dossiers/#{(procedure_1.dossiers.first.id + 14)}")
end
scenario 'Following dossier' do
- page.all('#procedure_list a').first.trigger('click')
+ page.all('#procedure_list a').first.click
expect(page.all('#follow_dossiers .smart-listing')[0]['data-item-count']).to eq ("0")
- page.find_by_id('all_dossiers').trigger('click')
+ page.find_by_id('all_dossiers').click
expect(page.all('#dossiers_list a').first.text).to eq('Suivre')
- page.all('#dossiers_list a').first.trigger('click')
+ page.all('#dossiers_list a').first.click
expect(page.all('#follow_dossiers .smart-listing')[0]['data-item-count']).to eq ("1")
end
- scenario 'Using sort and pagination' do
- visit "/backoffice/dossiers/procedure/1?all_state_dossiers_smart_listing[sort][id]=asc"
+ scenario 'Using sort and pagination', js: true do
+ visit "/backoffice/dossiers/procedure/#{procedure_1.id}?all_state_dossiers_smart_listing[sort][id]=asc"
wait_for_ajax
- expect(page.all("#all_state_dossiers .dossier-row")[0]['id']).to eq('tr_dossier_1')
- visit "/backoffice/dossiers/procedure/1?all_state_dossiers_smart_listing[sort][id]=desc"
+ expect(page.all("#all_state_dossiers .dossier-row")[0]['id']).to eq("tr_dossier_#{procedure_1.dossiers.first.id}")
+ visit "/backoffice/dossiers/procedure/#{procedure_1.id}?all_state_dossiers_smart_listing[sort][id]=desc"
wait_for_ajax
- expect(page.all(".dossier-row")[0]['id']).to eq('tr_dossier_30')
+ expect(page.all(".dossier-row")[0]['id']).to eq("tr_dossier_#{procedure_1.dossiers.last.id}")
page.find('#all_state_dossiers .next_page a').trigger('click')
wait_for_ajax
page.find('#all_state_dossiers .next_page a').trigger('click')
wait_for_ajax
- expect(page.all(".dossier-row")[0]['id']).to eq('tr_dossier_10')
+ expect(page.all(".dossier-row")[0]['id']).to eq("tr_dossier_#{procedure_1.dossiers.first.id + 9}")
page.find('#all_state_dossiers .prev a').trigger('click')
wait_for_ajax
- expect(page.all(".dossier-row")[0]['id']).to eq('tr_dossier_20')
+ expect(page.all(".dossier-row")[0]['id']).to eq("tr_dossier_#{procedure_1.dossiers.first.id + 19}")
end
scenario 'Using filter' do
@@ -76,23 +75,25 @@ feature 'As an Accompagnateur I can navigate and use each functionnality around
end
context 'On show' do
-
scenario 'Following dossier' do
expect(page.all('#follow_dossiers .count').first.text).to eq('0 dossiers')
- visit "/backoffice/dossiers/procedure/1?all_state_dossiers_smart_listing[sort][id]=asc"
- page.find_by_id("suivre_dossier_1").trigger('click')
- visit "backoffice/dossiers/4"
- page.find_by_id("suivre_dossier_4").trigger('click')
- visit "/backoffice/dossiers/procedure/1"
+
+ visit "/backoffice/dossiers/procedure/#{procedure_1.id}?all_state_dossiers_smart_listing[sort][id]=asc"
+ page.find_by_id("suivre_dossier_#{procedure_1.dossiers.first.id}").click
+
+ visit "/backoffice/dossiers/#{procedure_1.dossiers.second.id}"
+ page.find_by_id("suivre_dossier_#{procedure_1.dossiers.second.id}").click
+
+ visit "/backoffice/dossiers/procedure/#{procedure_1.id}"
expect(page.all('#follow_dossiers .count').first.text).to eq('2 dossiers')
end
- scenario 'Adding message' do
- page.find_by_id('tr_dossier_4').trigger('click')
- expect(page).to have_current_path(backoffice_dossier_path(4), only_path: true)
- page.find_by_id('open-message').trigger('click')
+ scenario 'Adding message', js: true do
+ page.find_by_id("tr_dossier_#{procedure_1.dossiers.first.id}").trigger('click')
+ expect(page).to have_current_path(backoffice_dossier_path(procedure_1.dossiers.first.id), only_path: true)
+ page.find_by_id('open-message').click
page.execute_script("$('#texte_commentaire').data('wysihtml5').editor.setValue('Contenu du nouveau message')")
- page.find_by_id('save-message').trigger('click')
+ page.find_by_id('save-message').click
expect(page.find('.last-commentaire .content').text).to eq('Contenu du nouveau message')
end
end
diff --git a/spec/features/backoffice/invitation_spec.rb b/spec/features/backoffice/invitation_spec.rb
deleted file mode 100644
index ffeb61158..000000000
--- a/spec/features/backoffice/invitation_spec.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-require 'spec_helper'
-
-feature 'As an Accompagnateur I can send invitations from dossiers', js: true do
-
- let(:user) { create(:user) }
- let(:gestionnaire) { create(:gestionnaire) }
- let(:procedure_1) { create(:procedure, :with_type_de_champ, libelle: 'procedure 1') }
-
- before 'Assign procedures to Accompagnateur and generating dossiers for each' do
- create :assign_to, gestionnaire: gestionnaire, procedure: procedure_1
- Dossier.create(procedure_id: procedure_1.id.to_s, user: user, state: 'initiated')
- login_as gestionnaire, scope: :gestionnaire
- visit backoffice_dossier_path(1)
- end
-
- context 'On dossier show' do
-
- scenario 'Sending invitation' do
- page.find('#invitations').click
- page.find('#invitation-email').set('toto@email.com')
- page.find('#send-invitation .btn-success').trigger('click')
- end
-
- end
-end
diff --git a/spec/features/backoffice/lateral_page_pref_list_dossier_backoffice_spec.rb b/spec/features/backoffice/lateral_page_pref_list_dossier_backoffice_spec.rb
index fe4ce332d..4de962762 100644
--- a/spec/features/backoffice/lateral_page_pref_list_dossier_backoffice_spec.rb
+++ b/spec/features/backoffice/lateral_page_pref_list_dossier_backoffice_spec.rb
@@ -69,6 +69,7 @@ feature 'usage of pref list dossier lateral panel', js: true do
end
scenario 'lateral panel is masked' do
+ wait_for_ajax
expect(page).to have_css('#pref_list_menu', visible: false)
end
end
diff --git a/spec/features/backoffice/lateral_page_pref_list_dossier_by_procedure_backoffice_spec.rb b/spec/features/backoffice/lateral_page_pref_list_dossier_by_procedure_backoffice_spec.rb
index 404c20ea2..34c9dac39 100644
--- a/spec/features/backoffice/lateral_page_pref_list_dossier_by_procedure_backoffice_spec.rb
+++ b/spec/features/backoffice/lateral_page_pref_list_dossier_by_procedure_backoffice_spec.rb
@@ -35,6 +35,7 @@ feature 'usage of pref list dossier lateral panel by procedure', js: true do
end
scenario 'lateral panel is appeared' do
+ wait_for_ajax
expect(page).to have_css('#pref_list_menu')
end
@@ -69,6 +70,7 @@ feature 'usage of pref list dossier lateral panel by procedure', js: true do
end
scenario 'lateral panel is masked' do
+ wait_for_ajax
expect(page).to have_css('#pref_list_menu', visible: false)
end
end
diff --git a/spec/features/backoffice/navigate_to_dossier_spec.rb b/spec/features/backoffice/navigate_to_dossier_spec.rb
index b73a1217d..b7f30467c 100644
--- a/spec/features/backoffice/navigate_to_dossier_spec.rb
+++ b/spec/features/backoffice/navigate_to_dossier_spec.rb
@@ -14,7 +14,7 @@ feature 'on backoffice page', js: true do
create :follow, gestionnaire: gestionnaire, dossier: dossier
create :assign_to, gestionnaire: gestionnaire, procedure: procedure_individual
create :follow, gestionnaire: gestionnaire, dossier: dossier_individual
- visit backoffice_path
+ visit users_path
end
context 'when gestionnaire is logged in' do
diff --git a/spec/features/description_page/upload_piece_justificative_spec.rb b/spec/features/description_page/upload_piece_justificative_spec.rb
index 22bd5e50b..1ee2c1360 100644
--- a/spec/features/description_page/upload_piece_justificative_spec.rb
+++ b/spec/features/description_page/upload_piece_justificative_spec.rb
@@ -14,7 +14,6 @@ feature 'user is on description page' do
page.find_by_id('user_password').set dossier.user.password
page.click_on 'Se connecter'
end
-
end
it { expect(page).to have_css('#description_page') }
diff --git a/spec/features/users/complete_demande_spec.rb b/spec/features/users/complete_demande_spec.rb
index 55f2f3d4d..dc6145cce 100644
--- a/spec/features/users/complete_demande_spec.rb
+++ b/spec/features/users/complete_demande_spec.rb
@@ -61,7 +61,7 @@ feature 'user path for dossier creation' do
context 'when validating info entreprise recap page' do
before do
page.check('dossier_autorisation_donnees')
- page.click_on 'Etape suivante'
+ page.find_by_id('etape_suivante').trigger('click')
end
scenario 'user is on description page' do
expect(page).to have_css('#description_page')
@@ -69,7 +69,7 @@ feature 'user path for dossier creation' do
context 'user fill and validate description page' do
before do
page.find_by_id("champs_#{Dossier.last.champs.first.id}").set 'Mon super projet'
- page.click_on 'Soumettre mon dossier'
+ page.find_by_id('suivant').trigger('click')
end
scenario 'user is on recap page' do
expect(page).to have_css('#users_recapitulatif_dossier_show')
diff --git a/spec/features/users/dossier_creation_spec.rb b/spec/features/users/dossier_creation_spec.rb
index 3d19d4118..d1a970275 100644
--- a/spec/features/users/dossier_creation_spec.rb
+++ b/spec/features/users/dossier_creation_spec.rb
@@ -1,7 +1,6 @@
require 'spec_helper'
-feature 'As a User I wanna create a dossier', js: true do
-
+feature 'As a User I wanna create a dossier' do
let(:user) { create(:user) }
let(:siret) { '40307130100044' }
let(:siren) { siret[0...9] }
@@ -17,18 +16,18 @@ feature 'As a User I wanna create a dossier', js: true do
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').trigger('click')
- expect(page).to have_current_path(users_dossier_carte_path(Dossier.first.id.to_s), only_path: true)
- page.find_by_id('etape_suivante').trigger('click')
- fill_in 'champs_1', with: 'contenu du champ 1'
- page.find_by_id('suivant').trigger('click')
- expect(page).to have_current_path(users_dossier_recapitulatif_path(Dossier.first.id.to_s), only_path: true)
+ 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), only_path: true)
+ page.find_by_id('etape_suivante').click
+ fill_in "champs_#{procedure_for_individual.dossiers.last.champs.first.id}", with: 'contenu du champ 1'
+ page.find_by_id('suivant').click
+ expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_for_individual.dossiers.last.id.to_s), only_path: true)
end
- scenario 'Identification through siret', vcr: {cassette_name: 'search_ban_paris'} do
+ scenario 'Identification through siret', vcr: {cassette_name: 'search_ban_paris'}, js: true do
login_as user, scope: :user
visit commencer_path(procedure_path: procedure_with_siret.path)
- expect(page).to have_current_path(users_dossier_path(Dossier.first.id.to_s), only_path: true)
+ expect(page).to have_current_path(users_dossier_path(procedure_with_siret.dossiers.last.id.to_s), only_path: true)
fill_in 'dossier_siret', with: siret
stub_request(:get, "https://api-dev.apientreprise.fr/v2/etablissements/#{siret}?token=#{SIADETOKEN}")
.to_return(status: 200, body: File.read('spec/support/files/etablissement.json'))
@@ -43,11 +42,11 @@ feature 'As a User I wanna create a dossier', js: true do
expect(page).to have_css('#recap_info_entreprise')
find(:css, "#dossier_autorisation_donnees[value='1']").set(true)
page.find_by_id('etape_suivante').trigger('click')
- expect(page).to have_current_path(users_dossier_carte_path(Dossier.first.id.to_s), only_path: true)
+ expect(page).to have_current_path(users_dossier_carte_path(procedure_with_siret.dossiers.last.id.to_s), only_path: true)
page.find_by_id('etape_suivante').trigger('click')
- fill_in 'champs_1', with: 'contenu du champ 1'
+ fill_in "champs_#{procedure_with_siret.dossiers.last.champs.first.id}", with: 'contenu du champ 1'
page.find_by_id('suivant').trigger('click')
- expect(page).to have_current_path(users_dossier_recapitulatif_path(Dossier.first.id.to_s), only_path: true)
+ expect(page).to have_current_path(users_dossier_recapitulatif_path(procedure_with_siret.dossiers.last.id.to_s), only_path: true)
end
end
end
diff --git a/spec/features/users/dossier_edition_spec.rb b/spec/features/users/dossier_edition_spec.rb
index 85cbc97b6..0029c7c83 100644
--- a/spec/features/users/dossier_edition_spec.rb
+++ b/spec/features/users/dossier_edition_spec.rb
@@ -40,7 +40,7 @@ feature 'As a User I want to edit a dossier I own' do
fill_in "champs_#{dossier.champs.first.id.to_s}", with: 'Contenu du champ 1'
page.find_by_id('modification_terminee').click
expect(page).to have_current_path(users_dossier_recapitulatif_path(dossier.id.to_s), only_path: true)
- expect(page.find('#champ-1-value').text).to eq('Contenu du champ 1')
+ expect(page.find("#champ-#{dossier.champs.first.id}-value").text).to eq('Contenu du champ 1')
end
end
end
diff --git a/spec/features/users/dossier_index_spec.rb b/spec/features/users/dossier_index_spec.rb
index a2b649693..e15c0fd19 100644
--- a/spec/features/users/dossier_index_spec.rb
+++ b/spec/features/users/dossier_index_spec.rb
@@ -15,7 +15,7 @@ feature 'As a User I want to sort and paginate dossiers', js: true do
page.find_by_id('etape_suivante').trigger('click')
page.find_by_id('suivant').trigger('click')
50.times do
- Dossier.create(procedure_id: 1, user_id: 1, state: "initiated")
+ Dossier.create(procedure_id: procedure_for_individual.id, user_id: user.id, state: "initiated")
end
visit root_path
end
@@ -24,30 +24,30 @@ feature 'As a User I want to sort and paginate dossiers', js: true do
scenario 'Using sort' do
visit "/users/dossiers?dossiers_smart_listing[sort][id]=asc"
- expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq('1')
- expect(page.all(:css, '#dossiers_list tr')[2].text.split(" ").first).to eq('2')
+ 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('51')
- expect(page.all(:css, '#dossiers_list tr')[2].text.split(" ").first).to eq('50')
+ 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)
visit "/users/dossiers?dossiers_smart_listing[sort][id]=asc"
- expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq('1')
- expect(page.all(:css, '#dossiers_list tr')[2].text.split(" ").first).to eq('2')
+ 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)
end
scenario 'Using pagination' do
visit "/users/dossiers?dossiers_smart_listing[sort][id]=asc"
- expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq('1')
+ expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq(user.dossiers.first.id.to_s)
page.find('.next_page a').trigger('click')
wait_for_ajax
- expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq('11')
+ expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq((user.dossiers.first.id + 10).to_s)
page.find('.next_page a').trigger('click')
wait_for_ajax
- expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq('21')
+ expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq((user.dossiers.first.id + 20).to_s)
page.find('.prev a').trigger('click')
wait_for_ajax
page.find('.prev a').trigger('click')
wait_for_ajax
- expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq('1')
+ expect(page.all(:css, '#dossiers_list tr')[1].text.split(" ").first).to eq((user.dossiers.first.id).to_s)
end
end
diff --git a/spec/features/users/flux_de_commentaires_spec.rb b/spec/features/users/flux_de_commentaires_spec.rb
index 0c087f429..4ce44cd3e 100644
--- a/spec/features/users/flux_de_commentaires_spec.rb
+++ b/spec/features/users/flux_de_commentaires_spec.rb
@@ -22,34 +22,4 @@ feature 'users: flux de commentaires' do
comments = find(".commentaires")
expect(comments).to have_selector(".content", count: 1)
end
-
- scenario "affichage des commentaires du champs", js: true do
- pending 'later: open simplif'
- th = find("#liste_champs th", text: champ1.libelle)
- th.click_link("COM")
- expect(page).to have_css("#modalCommentairesDossierParChamp.in")
-
- modal = find("#modalCommentairesDossierParChamp")
- expect(modal).to have_css(".description", count: 2)
- end
-
- scenario "crée un commentaire sur un champ", js: true do
- pending 'later: open simplif'
- # ouverture modale
- find("#liste_champs th", text: champ1.libelle).click_link("COM")
-
- # ajout du commentaire
- form = find("#modalCommentairesDossierParChamp").find("#commentaire_new")
- form.fill_in("texte_commentaire", with: "le corps du commentaire sur le champ #{champ1.libelle}")
- form.click_on("Poster")
-
- # le commentaire ne s'ajoute pas aux commentaires généraux
- comments = find("#commentaires_flux")
- expect(comments).to have_selector(".description", count: 1)
-
- # ajout du commentaire aux commentaires du champs
- find("#liste_champs th", text: champ1.libelle).click_link("COM")
- modal = find("#modalCommentairesDossierParChamp")
- expect(modal).to have_css(".description", count: 3)
- end
end
diff --git a/spec/features/users/invitation_spec.rb b/spec/features/users/invitation_spec.rb
deleted file mode 100644
index 0ae2f9bb5..000000000
--- a/spec/features/users/invitation_spec.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-require 'spec_helper'
-
-feature 'As a User I can send invitations from dossiers', js: true do
-
- let(:user) { create(:user) }
- let(:procedure_1) { create(:procedure, :with_type_de_champ, libelle: 'procedure 1') }
-
- before 'Assign procedures to Accompagnateur and generating dossiers for each' do
- Dossier.create(procedure_id: procedure_1.id.to_s, user: user, state: 'initiated')
- login_as user, scope: :user
- visit users_dossier_recapitulatif_path(1)
- end
-
- context 'On dossier show' do
-
- scenario 'Sending invitation' do
- page.find('#invitations').click
- fill_in 'invitation-email', with: 'toto@email.com'
- page.find('#send-invitation .btn-success').trigger('click')
- end
-
- end
-end
diff --git a/spec/features/users/onglets_link_spec.rb b/spec/features/users/onglets_link_spec.rb
index 3da3fd4b3..013699c6d 100644
--- a/spec/features/users/onglets_link_spec.rb
+++ b/spec/features/users/onglets_link_spec.rb
@@ -77,15 +77,4 @@ feature 'on click on tabs button' do
end
end
end
-
- context "OpenSimplif" do
- before do
- allow(Features).to receive(:opensimplif).and_return(true)
- visit users_dossiers_url
- end
-
- scenario "it hides the tabs" do
- expect(page).to_not have_css('#onglets')
- end
- end
end
diff --git a/spec/features/users/start_demande_spec.rb b/spec/features/users/start_demande_spec.rb
index a1448e139..e3b8014b0 100644
--- a/spec/features/users/start_demande_spec.rb
+++ b/spec/features/users/start_demande_spec.rb
@@ -6,7 +6,7 @@ feature 'user arrive on siret page' do
let(:siret) { '42149333900020' }
let(:siren) { siret[0...9] }
- context 'when user is not logged in', js: true do
+ context 'when user is not logged in' do
before do
visit new_users_dossiers_path(procedure_id: procedure.id)
end
@@ -24,7 +24,7 @@ feature 'user arrive on siret page' do
scenario 'he is redirected to siret page to enter a siret' do
expect(page).to have_css('#new_siret')
end
- context 'when enter a siret' do
+ context 'when enter a siret', js: true do
before do
stub_request(:get, "https://api-dev.apientreprise.fr/v2/etablissements/#{siret}?token=#{SIADETOKEN}")
.to_return(status: 200, body: File.read('spec/support/files/etablissement.json'))
@@ -39,6 +39,7 @@ feature 'user arrive on siret page' do
page.click_on 'Valider'
end
scenario 'he is redirected to recap info entreprise page' do
+ wait_for_ajax
expect(page).to have_css('#recap_info_entreprise')
end
end
diff --git a/spec/mailers/notification_mailer_spec.rb b/spec/mailers/notification_mailer_spec.rb
index 730ce70de..4acc90c57 100644
--- a/spec/mailers/notification_mailer_spec.rb
+++ b/spec/mailers/notification_mailer_spec.rb
@@ -18,9 +18,11 @@ RSpec.describe NotificationMailer, type: :mailer do
subject(:subject) { described_class.dossier_validated(dossier) }
+ before { dossier.reload }
+
it { expect(subject.body).to match("Votre dossier N°#{dossier.id} est prêt à être déposé pour instruction.") }
- it { expect(subject.body).to include("Afin de finaliser son dépôt, merci de vous rendre sur #{users_dossier_recapitulatif_url(dossier_id: dossier.id)}") }
- it { expect(subject.subject).to eq("Votre dossier TPS N°#{dossier.id} a été validé") }
+ it { expect(subject.body).to include("Afin de finaliser son dépôt, merci de vous rendre sur", users_dossier_recapitulatif_url(dossier_id: dossier.id)) }
+ it { expect(subject.subject).to eq("[TPS] Votre dossier TPS N°#{dossier.id} a été validé") }
end
describe ".dossier_submitted" do
@@ -29,6 +31,8 @@ RSpec.describe NotificationMailer, type: :mailer do
subject(:subject) { described_class.dossier_submitted(dossier) }
+ before { dossier.reload }
+
it { expect(subject.body).to match("Nous vous confirmons que votre dossier N°#{dossier.id} a été déposé") }
it { expect(subject.body).to match("auprès de #{dossier.procedure.organisation} avec succès") }
it { expect(subject.body).to match("ce jour à #{dossier.updated_at}.") }
@@ -41,6 +45,8 @@ RSpec.describe NotificationMailer, type: :mailer do
subject(:subject) { described_class.dossier_received(dossier) }
+ before { dossier.reload }
+
it { expect(subject.subject).to eq("[TPS] Accusé de réception pour votre dossier n°#{dossier.id}") }
it { expect(subject.body).to match("Votre administration vous confirme la bonne réception de votre dossier n°#{dossier.id}") }
end
diff --git a/spec/mailers/previews/notification_mailer_preview.rb b/spec/mailers/previews/notification_mailer_preview.rb
new file mode 100644
index 000000000..f1af33905
--- /dev/null
+++ b/spec/mailers/previews/notification_mailer_preview.rb
@@ -0,0 +1,11 @@
+class NotificationMailerPreview < ActionMailer::Preview
+
+ def dossier_received
+ NotificationMailer.dossier_received(Dossier.last)
+ end
+
+ def dossier_validated
+ NotificationMailer.dossier_validated(Dossier.last)
+ end
+
+end
diff --git a/spec/migrations/remove_duplicate_email_received_spec.rb b/spec/migrations/remove_duplicate_email_received_spec.rb
new file mode 100644
index 000000000..9fd83c40a
--- /dev/null
+++ b/spec/migrations/remove_duplicate_email_received_spec.rb
@@ -0,0 +1,25 @@
+load 'spec/spec_helper.rb'
+load 'db/migrate/20170215102943_remove_duplicate_email_received.rb'
+
+describe RemoveDuplicateEmailReceived do
+ context 'with one procedure and one associated mail_received' do
+ let!(:procedure) { create(:procedure) }
+
+ it 'keeps the procedure mails' do
+ RemoveDuplicateEmailReceived.new.change
+ expect(MailReceived.count).to eq(1)
+ end
+
+ context 'and another mail_received' do
+ before :each do
+ MailReceived.create!(procedure: procedure)
+ end
+
+ it 'destroys the unecessary maiL_received' do
+ RemoveDuplicateEmailReceived.new.change
+ expect(MailReceived.count).to eq(1)
+ expect(procedure.mail_received).not_to be_nil
+ end
+ end
+ end
+end
diff --git a/spec/models/dossier_spec.rb b/spec/models/dossier_spec.rb
index ddbf350ce..c37efc03f 100644
--- a/spec/models/dossier_spec.rb
+++ b/spec/models/dossier_spec.rb
@@ -681,27 +681,32 @@ describe Dossier do
end
end
- describe '#export_headers' do
+ context 'when dossier is followed' do
let(:procedure) { create(:procedure, :with_type_de_champ) }
- let(:dossier) { create(:dossier, :with_entreprise, user: user, procedure: procedure) }
- subject { dossier.export_headers }
+ let(:gestionnaire) { create(:gestionnaire) }
+ let(:follow) { create(:follow, gestionnaire: gestionnaire) }
+ let(:dossier) { create(:dossier, :with_entreprise, user: user, procedure: procedure, follows: [follow]) }
- it { expect(subject).to include(:description) }
- it { expect(subject.count).to eq(DossierProcedureSerializer.new(dossier).attributes.count + dossier.procedure.types_de_champ.count + dossier.export_entreprise_data.count) }
- end
+ describe '#export_headers' do
- describe '#data_with_champs' do
- let(:procedure) { create(:procedure, :with_type_de_champ) }
- let(:dossier) { create(:dossier, :with_entreprise, user: user, procedure: procedure) }
- subject { dossier.data_with_champs }
+ subject { dossier.export_headers }
- it { expect(subject[0]).to be_a_kind_of(Integer) }
- it { expect(subject[1]).to be_a_kind_of(Time) }
- it { expect(subject[2]).to be_a_kind_of(Time) }
- it { expect(subject[3]).to be_in([true, false]) }
- it { expect(subject[4]).to be_in([true, false]) }
- it { expect(subject[5]).to eq("draft") }
- it { expect(subject.count).to eq(DossierProcedureSerializer.new(dossier).attributes.count + dossier.procedure.types_de_champ.count + dossier.export_entreprise_data.count) }
+ it { expect(subject).to include(:description) }
+ it { expect(subject.count).to eq(DossierProcedureSerializer.new(dossier).attributes.count + dossier.procedure.types_de_champ.count + dossier.export_entreprise_data.count) }
+ end
+
+ describe '#data_with_champs' do
+ subject { dossier.data_with_champs }
+
+ it { expect(subject[0]).to be_a_kind_of(Integer) }
+ it { expect(subject[1]).to be_a_kind_of(Time) }
+ it { expect(subject[2]).to be_a_kind_of(Time) }
+ it { expect(subject[3]).to be_in([true, false]) }
+ it { expect(subject[4]).to be_in([true, false]) }
+ it { expect(subject[5]).to eq("draft") }
+ it { expect(subject[6]).to eq(dossier.followers_gestionnaires_emails) }
+ it { expect(subject.count).to eq(DossierProcedureSerializer.new(dossier).attributes.count + dossier.procedure.types_de_champ.count + dossier.export_entreprise_data.count) }
+ end
end
describe '#Dossier.to_csv' do
@@ -746,6 +751,7 @@ describe Dossier do
it { expect(subject[:entreprise_prenom]).to be_nil }
end
+
describe '#Dossier.to_xlsx' do
let!(:procedure) { create(:procedure) }
let!(:dossier) { create(:dossier, :with_entreprise, user: user, procedure: procedure) }
@@ -930,4 +936,39 @@ describe Dossier do
it { is_expected.to be_falsey }
end
end
+
+ describe '#followers_gestionnaires_emails' do
+
+ context 'when there is no follower' do
+ let(:dossier) { create(:dossier, follows: []) }
+
+ subject { dossier.followers_gestionnaires_emails }
+
+ it { is_expected.to eq "" }
+ end
+
+ let(:gestionnaire) { create(:gestionnaire) }
+ let(:follow) { create(:follow, gestionnaire: gestionnaire) }
+
+ context 'when there is 1 follower' do
+ let(:dossier) { create(:dossier, follows: [follow]) }
+
+ subject { dossier.followers_gestionnaires_emails }
+
+ it { is_expected.to eq gestionnaire.email }
+ end
+
+ let(:gestionnaire2) { create :gestionnaire}
+ let(:follow2) { create(:follow, gestionnaire: gestionnaire2) }
+
+ context 'when there is 2 followers' do
+ let(:dossier) { create(:dossier, follows: [follow, follow2]) }
+
+ subject { dossier.followers_gestionnaires_emails }
+
+ it { is_expected.to eq "#{gestionnaire.email} #{gestionnaire2.email}" }
+ end
+
+
+ end
end
diff --git a/spec/models/mail_template_spec.rb b/spec/models/mail_template_spec.rb
index dbbe349ef..856c104fb 100644
--- a/spec/models/mail_template_spec.rb
+++ b/spec/models/mail_template_spec.rb
@@ -7,30 +7,39 @@ describe MailTemplate do
it { is_expected.to belong_to(:procedure) }
describe '.tags' do
- subject { MailTemplate.tags }
+ subject { MailTemplate::TAGS }
- it { expect(subject.size).to eq 2 }
+ it { expect(subject.size).to eq 3 }
describe 'numero_dossier' do
- subject { super()['numero_dossier'] }
+ subject { super()[:numero_dossier] }
describe 'attr and description value' do
- it { expect(subject['description']).to eq "Permet d'afficher le numéro de dossier de l'utilisateur." }
+ it { expect(subject[:description]).to eq "Permet d'afficher le numéro de dossier de l'utilisateur." }
end
end
- describe 'numero_dossier' do
- subject { super()['libelle_procedure'] }
+ describe 'libelle_procedure' do
+ subject { super()[:libelle_procedure] }
describe 'attr and description value' do
- it { expect(subject['description']).to eq "Permet d'afficher le libellé de la procédure." }
+ it { expect(subject[:description]).to eq "Permet d'afficher le libellé de la procédure." }
+ end
+ end
+
+ describe 'lien_dossier' do
+ subject { super()[:lien_dossier] }
+
+ describe 'attr and description value' do
+
+ it { expect(subject[:description]).to eq "Permet d'afficher un lien vers le dossier de l'utilisateur." }
end
end
end
- describe '.replace_tags' do
+ xdescribe '.replace_tags' do
let(:dossier) { create :dossier }
let(:procedure) { dossier.procedure }
let(:mail_received) { procedure.mail_received }
@@ -40,7 +49,7 @@ describe MailTemplate do
procedure.mail_received.update_column(:object, '[TPS] Dossier n°--numero_dossier--')
end
- subject { MailTemplate.replace_tags procedure.mail_received.object, dossier }
+ subject { procedure.mail_received.object_for_dossier dossier }
it { expect(subject).to eq "[TPS] Dossier n°#{dossier.id}" }
end
@@ -50,17 +59,30 @@ describe MailTemplate do
procedure.mail_received.update_column(:object, '[TPS] Dossier pour la procédure --libelle_procedure--')
end
- subject { MailTemplate.replace_tags procedure.mail_received.object, dossier }
+ subject { procedure.mail_received.object_for_dossier dossier }
it { expect(subject).to eq "[TPS] Dossier pour la procédure #{procedure.libelle}" }
end
+ describe 'for tag --lien_dossier--' do
+ include Rails.application.routes.url_helpers
+ include ActionView::Helpers::UrlHelper
+
+ before do
+ procedure.mail_received.update_column(:body, 'Consultez votre dossier ici --lien_dossier--')
+ end
+
+ subject { procedure.mail_received.body_for_dossier dossier }
+
+ it { is_expected.to eq "Consultez votre dossier ici #{link_to users_dossier_recapitulatif_url(dossier), users_dossier_recapitulatif_url(dossier), target: '_blank'}" }
+ end
+
describe 'multiple tags' do
before do
procedure.mail_received.update_column(:object, '[TPS] Dossier n°--numero_dossier-- pour la procédure --libelle_procedure-- et encore le numéro : --numero_dossier--')
end
- subject { MailTemplate.replace_tags procedure.mail_received.object, dossier }
+ subject { procedure.mail_received.object_for_dossier dossier }
it { expect(subject).to eq "[TPS] Dossier n°#{dossier.id} pour la procédure #{procedure.libelle} et encore le numéro : #{dossier.id}" }
end
diff --git a/spec/models/procedure_spec.rb b/spec/models/procedure_spec.rb
index 6b7434208..5219587ba 100644
--- a/spec/models/procedure_spec.rb
+++ b/spec/models/procedure_spec.rb
@@ -6,7 +6,6 @@ describe Procedure do
it { is_expected.to have_many(:types_de_champ) }
it { is_expected.to have_many(:dossiers) }
it { is_expected.to have_many(:mail_templates) }
- it { is_expected.to have_one(:mail_received) }
it { is_expected.to have_one(:module_api_carto) }
it { is_expected.to belong_to(:administrateur) }
it { is_expected.to have_many(:preference_list_dossiers) }
@@ -36,7 +35,7 @@ describe Procedure do
end
describe '#build_default_mails' do
- subject { build :procedure }
+ subject { build :procedure, mail_templates: [] }
it 'call the fonction build_default_mails' do
expect(subject).to receive(:build_default_mails)
@@ -47,10 +46,13 @@ describe Procedure do
before do
subject.save
+ subject.reload
end
- it { expect(subject.mail_templates.size).to eq 1 }
+ it { expect(subject.mail_templates.size).to eq 2 }
+
it { expect(subject.mail_received).not_to be_nil }
+ it { expect(subject.mail_validated).not_to be_nil }
end
end
diff --git a/spec/models/type_de_piece_justificative_spec.rb b/spec/models/type_de_piece_justificative_spec.rb
index a2b47c14e..584c7a555 100644
--- a/spec/models/type_de_piece_justificative_spec.rb
+++ b/spec/models/type_de_piece_justificative_spec.rb
@@ -10,6 +10,7 @@ describe TypeDePieceJustificative do
it { is_expected.to have_db_column(:created_at) }
it { is_expected.to have_db_column(:updated_at) }
it { is_expected.to have_db_column(:order_place) }
+ it { is_expected.to have_db_column(:lien_demarche) }
end
describe 'associations' do
@@ -29,5 +30,12 @@ describe TypeDePieceJustificative do
# it { is_expected.not_to allow_value('').for(:order_place) }
it { is_expected.to allow_value(1).for(:order_place) }
end
+
+ context 'lien_demarche' do
+ it { is_expected.to allow_value(nil).for(:lien_demarche) }
+ it { is_expected.to allow_value('').for(:lien_demarche) }
+ it { is_expected.not_to allow_value('not-a-link').for(:lien_demarche) }
+ it { is_expected.to allow_value('http://link').for(:lien_demarche) }
+ end
end
end
diff --git a/spec/services/dossiers_list_gestionnaire_service_spec.rb b/spec/services/dossiers_list_gestionnaire_service_spec.rb
index 1594aa286..e568ae0da 100644
--- a/spec/services/dossiers_list_gestionnaire_service_spec.rb
+++ b/spec/services/dossiers_list_gestionnaire_service_spec.rb
@@ -269,13 +269,13 @@ describe DossiersListGestionnaireService do
describe '#change_page!' do
let(:procedure) { nil }
- let(:liste) { 'a_traiter' }
+ let(:liste) { 'all_state' }
let(:page) { 2 }
let(:new_page) { 1 }
before do
- preference_smart_listing_page.update page: page, liste: 'a_traiter', procedure: nil
+ preference_smart_listing_page.update page: page, liste: liste, procedure: nil
subject
preference_smart_listing_page.reload
end
@@ -297,7 +297,7 @@ describe DossiersListGestionnaireService do
end
context 'when liste change' do
- let(:liste) { 'en_attente' }
+ let(:liste) { 'all_state' }
it { expect(preference_smart_listing_page.liste).to eq liste }
it { expect(preference_smart_listing_page.procedure).to eq procedure }
@@ -308,7 +308,7 @@ describe DossiersListGestionnaireService do
it { expect(preference_smart_listing_page.liste).to eq liste }
it { expect(preference_smart_listing_page.procedure).to eq procedure }
- it { expect(preference_smart_listing_page.page).to eq 1 }
+ it { expect(preference_smart_listing_page.page).to eq page }
end
end
@@ -329,7 +329,7 @@ describe DossiersListGestionnaireService do
end
context 'when procedure and liste change' do
- let(:liste) { 'en_attente' }
+ let(:liste) { 'all_state' }
let(:procedure) { dossier.procedure }
it { expect(preference_smart_listing_page.liste).to eq liste }
diff --git a/spec/uploaders/base_uploader_spec.rb b/spec/uploaders/base_uploader_spec.rb
index 5adf98b35..0aa66297d 100644
--- a/spec/uploaders/base_uploader_spec.rb
+++ b/spec/uploaders/base_uploader_spec.rb
@@ -17,14 +17,6 @@ describe BaseUploader do
end
it { is_expected.to eq '/tmp/tps-cache' }
-
- context 'when is opensimplif' do
- before do
- allow(Features).to receive(:opensimplif?).and_return(true)
- end
-
- it { is_expected.to eq '/tmp/opensimplif-cache' }
- end
end
end
end
\ No newline at end of file
diff --git a/spec/views/admin/procedures/show.html.haml_spec.rb b/spec/views/admin/procedures/show.html.haml_spec.rb
index 445685f4e..a6de0fb07 100644
--- a/spec/views/admin/procedures/show.html.haml_spec.rb
+++ b/spec/views/admin/procedures/show.html.haml_spec.rb
@@ -73,9 +73,10 @@ describe 'admin/procedures/show.html.haml', type: :view do
it { expect(rendered).to have_css('a#reenable') }
end
- describe 'procedure link is not present' do
- it { expect(rendered).to have_content('Cette procédure a été archivée et n\'est plus accessible par le public.') }
+ describe 'procedure link is present' do
+ it { expect(rendered).to have_content(commencer_url(procedure_path: procedure.path)) }
end
+
end
end
\ No newline at end of file
diff --git a/spec/views/layouts/left_panels/_left_panel_users_dossierscontroller_index_spec.rb b/spec/views/layouts/left_panels/_left_panel_users_dossierscontroller_index_spec.rb
index 51958638c..1270bed0b 100644
--- a/spec/views/layouts/left_panels/_left_panel_users_dossierscontroller_index_spec.rb
+++ b/spec/views/layouts/left_panels/_left_panel_users_dossierscontroller_index_spec.rb
@@ -8,6 +8,8 @@ describe 'layouts/left_panels/_left_panel_users_dossierscontroller_index.html.ha
before do
sign_in user
+ create :dossier, user: user
+
assign :dossiers_list_facade, (DossiersListFacades.new user, param_list)
render