Merge develop into staging

This commit is contained in:
Xavier J 2017-02-07 18:28:22 +01:00
commit 812b8f7f27
23 changed files with 208 additions and 57 deletions

4
.byebug_history Normal file
View file

@ -0,0 +1,4 @@
exit
xit
xtei
cniuecniu

View file

@ -1,4 +1,4 @@
#left-pannel { #left-panel {
margin-top: 60px; margin-top: 60px;
padding: 0; padding: 0;
background-color: #003189; background-color: #003189;

View file

@ -158,7 +158,6 @@
position: fixed; position: fixed;
bottom: 26px; bottom: 26px;
right: -35px; right: -35px;
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg); transform: rotate(-45deg);
width: 150px; width: 150px;
background-color: #008cba; background-color: #008cba;
@ -207,4 +206,3 @@
font-size: 20px; font-size: 20px;
} }
} }

View file

@ -1,6 +1,5 @@
@media print { @media print {
html, body { html, body {
width: 900px;
margin: 0; margin: 0;
} }
@ -28,4 +27,39 @@
#backoffice_dossier_show .nav-tabs { #backoffice_dossier_show .nav-tabs {
display: none; 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;
}
} }

View file

@ -6,8 +6,11 @@ class Admin::PiecesJustificativesController < AdminController
end end
def update def update
@procedure.update_attributes(update_params) if @procedure.update_attributes(update_params)
flash.now.notice = 'Modifications sauvegardées' flash.now.notice = 'Modifications sauvegardées'
else
flash.now.notice = 'Une erreur est survenue'
end
render 'show', format: :js render 'show', format: :js
end end
@ -22,7 +25,7 @@ class Admin::PiecesJustificativesController < AdminController
def update_params def update_params
params params
.require(:procedure) .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 end
def move_up def move_up

View file

@ -43,6 +43,8 @@ class RootController < ApplicationController
return redirect_to administrations_path return redirect_to administrations_path
end end
@demo_environment_host = "https://tps-dev.apientreprise.fr" unless Rails.env.development?
render 'landing' render 'landing'
end end
end end

View file

@ -309,6 +309,10 @@ class Dossier < ActiveRecord::Base
end end
end end
def followers_gestionnaires_emails
follows.includes(:gestionnaire).map { |f| f.gestionnaire }.pluck(:email).join(' ')
end
def reset! def reset!
etablissement.destroy etablissement.destroy
entreprise.destroy entreprise.destroy

View file

@ -4,4 +4,6 @@ class TypeDePieceJustificative < ActiveRecord::Base
belongs_to :procedure belongs_to :procedure
validates :libelle, presence: true, allow_blank: false, allow_nil: false validates :libelle, presence: true, allow_blank: false, allow_nil: false
validates :lien_demarche, format: { with: URI::regexp }, allow_blank: true, allow_nil: true
end end

View file

@ -5,4 +5,6 @@ class DossierProcedureSerializer < ActiveModel::Serializer
:archived, :archived,
:mandataire_social, :mandataire_social,
:state :state
attribute :followers_gestionnaires_emails, key: :emails_accompagnateurs
end end

View file

@ -2,5 +2,6 @@ class TypeDePieceJustificativeSerializer < ActiveModel::Serializer
attributes :id, attributes :id,
:libelle, :libelle,
:description, :description,
:order_place :order_place,
:lien_demarche
end end

View file

@ -6,6 +6,12 @@
.form-group .form-group
%h4 Description %h4 Description
=ff.text_area :description, class: 'form-control description', placeholder: '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 .form-group
= ff.hidden_field :order_place, value: ff.index = 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') = f.submit('Ajouter la pièce', class: 'btn btn-success', id: 'add_piece_justificative')
- else - 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) ) = 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) )

View file

@ -4,7 +4,7 @@
.default_data_block .default_data_block
%div.row.show-block.infos %div.row.show-block.infos
%div.header %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 %div.carret-right
INFORMATIONS DU DEMANDEUR INFORMATIONS DU DEMANDEUR
- if !@current_gestionnaire && ["draft", "updated", "replied", "initiated"].include?(@facade.dossier.state) - if !@current_gestionnaire && ["draft", "updated", "replied", "initiated"].include?(@facade.dossier.state)
@ -16,34 +16,34 @@
.default_data_block .default_data_block
%div.row.show-block.infos#infos_entreprise %div.row.show-block.infos#infos_entreprise
%div.header %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-right
%div.carret-down %div.carret-down
INFORMATIONS DU DEMANDEUR INFORMATIONS DU DEMANDEUR
%div.body %div.body.display-block-on-print
= render partial: '/dossiers/infos_entreprise' = render partial: '/dossiers/infos_entreprise'
.default_data_block.default_visible .default_data_block.default_visible
%div.row.show-block.infos#infos_dossier %div.row.show-block.infos#infos_dossier
%div.header %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-right
%div.carret-down %div.carret-down
CONSTRUCTION DU DOSSIER CONSTRUCTION DU DOSSIER
= render partial: '/dossiers/edit_dossier' = render partial: '/dossiers/edit_dossier'
%div.body %div.body.display-block-on-print
= render partial: '/dossiers/infos_dossier' = render partial: '/dossiers/infos_dossier'
- if @facade.dossier.procedure.module_api_carto.use_api_carto - 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.row.show-block#carto
%div.header %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-right
%div.carret-down %div.carret-down
CARTOGRAPHIE CARTOGRAPHIE
= render partial: '/dossiers/edit_carto' = 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: '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: 'quartier_prioritaires', type: 'hidden', value: "#{@facade.dossier.quartier_prioritaires.to_json}"}
%input{id: 'cadastres', type: 'hidden', value: "#{@facade.dossier.cadastres.to_json}"} %input{id: 'cadastres', type: 'hidden', value: "#{@facade.dossier.cadastres.to_json}"}
@ -56,11 +56,11 @@
.default_data_block.default_visible .default_data_block.default_visible
%div.row.show-block#private-fields %div.row.show-block#private-fields
%div.header %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-right
%div.carret-down %div.carret-down
= "formulaire privé".upcase = "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 = @champs_private.count
= (private_fields_count == 1) ? "1 champ" : "#{private_fields_count} champs" = (private_fields_count == 1) ? "1 champ" : "#{private_fields_count} champs"
%div.body %div.body

View file

@ -11,17 +11,20 @@
.alert.alert-info .alert.alert-info
Cette messagerie permet d'échanger entre le demandeur et le service instructeur. Cette messagerie permet d'échanger entre le demandeur et le service instructeur.
.body .body.display-block-on-print
- if dossier_facade.commentaires.any? - if dossier_facade.commentaires.any?
.commentaires .commentaires
= render partial: 'dossiers/commentaires/commentaire', collection: dossier_facade.commentaires.object.sort = render partial: 'dossiers/commentaires/commentaire', collection: dossier_facade.commentaires.object.sort
.split-hr .split-hr
#new-commentaire #new-commentaire.hidden-print
= render partial: 'dossiers/commentaires/form', locals: { dossier_facade: @facade } = render partial: 'dossiers/commentaires/form', locals: { dossier_facade: @facade }
.last-commentaire.clearfix .last-commentaire.clearfix
.col-md-6
%input#save-message.form-control.btn.btn-send{ type: 'submit', value: 'ENVOYER' }
.last-commentaire.clearfix.hidden-print
- if last_comment = dossier_facade.commentaires.first - if last_comment = dossier_facade.commentaires.first
%div %div
DERNIER MESSAGE DERNIER MESSAGE

View file

@ -6,6 +6,7 @@
%meta{'http-equiv' => "X-UA-Compatible", :content => "IE=edge"} %meta{'http-equiv' => "X-UA-Compatible", :content => "IE=edge"}
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true = 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 = javascript_include_tag 'application', 'data-turbolinks-track' => true
= csrf_meta_tags = csrf_meta_tags
@ -32,7 +33,7 @@
= render partial: "layouts/navbar" = render partial: "layouts/navbar"
%div.row.no-margin %div.row.no-margin
- if RenderPartialService.left_panel_exist? @left_pannel_url - 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? - if gestionnaire_signed_in?
#search-block #search-block
= render partial: 'layouts/left_panels/search_area' = render partial: 'layouts/left_panels/search_area'

View file

@ -44,18 +44,19 @@
.col-md-4.col-lg-4 .col-md-4.col-lg-4
%h3.text-primary Acteurs publics %h3.text-primary Acteurs publics
%h4 Créez des démarches en ligne simplifiées et sécurisées. %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 .col-md-4.col-lg-4
%h3.text-warning Agents et services %h3.text-warning Agents et services
%h4 Accompagnez et co-traitez les projets avec les usagers. %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 .col-md-4.col-lg-4
%h3.text-success Usagers %h3.text-success Usagers
%h4 Profitez de démarches simplifiées et déchanges continus avec les services traitants. %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 .split-hr-left
.center .center

View file

@ -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 %table.table
- if dossier.procedure.cerfa_flag - if dossier.procedure.cerfa_flag
%tr %tr
%th.col-lg-6 %th
Formulaire de demande ou CERFA (complété et numérisé) 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? -if dossier.cerfa_available?
%span.btn.btn-sm.btn-file.btn-success %span.btn.btn-sm.btn-file.btn-success
Modifier Modifier
@ -19,9 +21,16 @@
- dossier.types_de_piece_justificative.order('order_place ASC').each do |type_de_piece_justificative| - dossier.types_de_piece_justificative.order('order_place ASC').each do |type_de_piece_justificative|
%tr %tr
%th.col-lg-6.piece-libelle %th.piece-libelle
= type_de_piece_justificative.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 -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. %span.text-success{ id: "piece_justificative_#{type_de_piece_justificative.id}" } Nous l'avons récupéré pour vous.
-else -else

View file

@ -24,6 +24,7 @@
%br %br
%h3 Documents administratifs %h3 Documents administratifs
//TODO a refactorer //TODO a refactorer
.row .row
.col-lg-8 .col-lg-8

View file

@ -8,4 +8,4 @@ Rails.application.config.assets.version = '1.0'
# Precompile additional assets. # Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. # 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)

View file

@ -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

View file

@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20161227103823) do ActiveRecord::Schema.define(version: 20170125152856) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@ -361,6 +361,7 @@ ActiveRecord::Schema.define(version: 20161227103823) do
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.integer "procedure_id" t.integer "procedure_id"
t.integer "order_place" t.integer "order_place"
t.string "lien_demarche"
end end
create_table "users", force: :cascade do |t| create_table "users", force: :cascade do |t|

View file

@ -56,6 +56,31 @@ describe RootController, type: :controller do
end end
it { expect(response.body).to have_css('#landing') } it { expect(response.body).to have_css('#landing') }
end
context 'environment is not development' do
render_views
before do
Rails.env.stub(:development? => false)
subject
end
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 end
context 'when opensimplif features is true' do context 'when opensimplif features is true' do
@ -81,4 +106,5 @@ describe RootController, type: :controller do
expect(response.body).to have_css("a[href='#{new_user_session_path}']") expect(response.body).to have_css("a[href='#{new_user_session_path}']")
end end
end end
end end

View file

@ -681,9 +681,14 @@ describe Dossier do
end end
end end
describe '#export_headers' do context 'when dossier is followed' do
let(:procedure) { create(:procedure, :with_type_de_champ) } let(:procedure) { create(:procedure, :with_type_de_champ) }
let(:dossier) { create(:dossier, :with_entreprise, user: user, procedure: procedure) } let(:gestionnaire) { create(:gestionnaire) }
let(:follow) { create(:follow, gestionnaire: gestionnaire) }
let(:dossier) { create(:dossier, :with_entreprise, user: user, procedure: procedure, follows: [follow]) }
describe '#export_headers' do
subject { dossier.export_headers } subject { dossier.export_headers }
it { expect(subject).to include(:description) } it { expect(subject).to include(:description) }
@ -691,8 +696,6 @@ describe Dossier do
end end
describe '#data_with_champs' 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.data_with_champs }
it { expect(subject[0]).to be_a_kind_of(Integer) } it { expect(subject[0]).to be_a_kind_of(Integer) }
@ -701,8 +704,10 @@ describe Dossier do
it { expect(subject[3]).to be_in([true, false]) } it { expect(subject[3]).to be_in([true, false]) }
it { expect(subject[4]).to be_in([true, false]) } it { expect(subject[4]).to be_in([true, false]) }
it { expect(subject[5]).to eq("draft") } 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) } it { expect(subject.count).to eq(DossierProcedureSerializer.new(dossier).attributes.count + dossier.procedure.types_de_champ.count + dossier.export_entreprise_data.count) }
end end
end
describe '#Dossier.to_csv' do describe '#Dossier.to_csv' do
let!(:procedure) { create(:procedure) } let!(:procedure) { create(:procedure) }
@ -746,6 +751,7 @@ describe Dossier do
it { expect(subject[:entreprise_prenom]).to be_nil } it { expect(subject[:entreprise_prenom]).to be_nil }
end end
describe '#Dossier.to_xlsx' do describe '#Dossier.to_xlsx' do
let!(:procedure) { create(:procedure) } let!(:procedure) { create(:procedure) }
let!(:dossier) { create(:dossier, :with_entreprise, user: user, procedure: procedure) } let!(:dossier) { create(:dossier, :with_entreprise, user: user, procedure: procedure) }
@ -930,4 +936,39 @@ describe Dossier do
it { is_expected.to be_falsey } it { is_expected.to be_falsey }
end end
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 end

View file

@ -10,6 +10,7 @@ describe TypeDePieceJustificative do
it { is_expected.to have_db_column(:created_at) } 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(:updated_at) }
it { is_expected.to have_db_column(:order_place) } it { is_expected.to have_db_column(:order_place) }
it { is_expected.to have_db_column(:lien_demarche) }
end end
describe 'associations' do describe 'associations' do
@ -29,5 +30,12 @@ describe TypeDePieceJustificative do
# it { is_expected.not_to allow_value('').for(:order_place) } # it { is_expected.not_to allow_value('').for(:order_place) }
it { is_expected.to allow_value(1).for(:order_place) } it { is_expected.to allow_value(1).for(:order_place) }
end end
context 'lien_demarche' do
it { is_expected.not_to allow_value(nil).for(:lien_demarche) }
it { is_expected.not_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
end end