Merge branch 'staging'

This commit is contained in:
gregoirenovel 2017-05-03 10:43:45 +02:00
commit 14697be576
28 changed files with 91 additions and 65 deletions

View file

@ -36,7 +36,7 @@ linters:
style: lisp_case
ImplicitDiv:
enabled: false
enabled: true
Indentation:
enabled: true

View file

@ -1,6 +1,8 @@
class Backoffice::DossiersController < Backoffice::DossiersListController
respond_to :html, :xlsx, :ods, :csv
before_action :ensure_gestionnaire_is_authorized, only: :show
def index
procedure = current_gestionnaire.procedure_filter
@ -185,6 +187,14 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
private
def ensure_gestionnaire_is_authorized
current_gestionnaire.dossiers.find(params[:id])
rescue ActiveRecord::RecordNotFound
flash.alert = t('errors.messages.dossier_not_found')
redirect_to url_for(controller: '/backoffice')
end
def create_dossier_facade dossier_id
@facade = DossierFacades.new dossier_id, current_gestionnaire.email

View file

@ -15,7 +15,7 @@
%td.col-xs-6
= procedure.libelle
- if @active_class
%td= link_to procedure.lien, procedure.lien, class: 'procedure-lien', 'data-method' => :get
%td.procedure-lien= link_to procedure.lien, procedure.lien, 'data-method' => :get
%td
= procedure.created_at_fr
%td

View file

@ -15,7 +15,7 @@
type: 'email',
placeholder: 'Email administrateur cible',
style: 'width: 300px; margin-left:auto; margin-right:auto' }
%div#not_found_admin.center.text-danger{ style:'display: none; margin-top: 10px;' }
#not_found_admin.center.text-danger{ style:'display: none; margin-top: 10px;' }
Cet administrateur n'existe pas.
.modal-footer
= submit_tag "Envoyer", class: 'btn btn-success'

View file

@ -7,7 +7,7 @@
.carret-down
Procédures
%a{ href: '/admin/procedures/new' }
%div#new-procedure.col-lg-2.col-md-2.col-sm-2.col-xs-2.action
#new-procedure.col-lg-2.col-md-2.col-sm-2.col-xs-2.action
Nouvelle
.body

View file

@ -2,11 +2,11 @@
#procedure_show
- unless @facade.procedure.published?
- if @facade.procedure.gestionnaires.size == 0
%a.action_button.btn.btn-success{ style: 'float: right; margin-top: 10px;', disabled: 'disabled', 'data-toggle' => :tooltip, title: 'Vous ne pouvez pas publier une procédure sans qu\'aucun accompagnateur ne soit affecté à celle-ci.', id: 'publish-procedure' }
%a.action_button.btn.btn-success#publish-procedure{ style: 'float: right; margin-top: 10px;', disabled: 'disabled', 'data-toggle' => :tooltip, title: 'Vous ne pouvez pas publier une procédure sans qu\'aucun accompagnateur ne soit affecté à celle-ci.' }
%i.fa.fa-eraser
Publier
- else
%a.btn.btn-success{ "data-target" => "#publish-modal", "data-toggle" => "modal", :type => "button", style: 'float: right; margin-top: 10px;', id: 'publish-procedure' }
%a.btn.btn-success#publish-procedure{ "data-target" => "#publish-modal", "data-toggle" => "modal", :type => "button", style: 'float: right; margin-top: 10px;' }
%i.fa.fa-eraser
Publier

View file

@ -44,9 +44,9 @@
CARTOGRAPHIE
= render partial: '/dossiers/edit_carto'
.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}" }
%input#json_latlngs{ type: 'hidden', value: "#{@facade.dossier.json_latlngs}", name: 'json_latlngs' }
%input#quartier_prioritaires{ type: 'hidden', value: "#{@facade.dossier.quartier_prioritaires.to_json}" }
%input#cadastres{ type: 'hidden', value: "#{@facade.dossier.cadastres.to_json}" }
= render partial: '/users/carte/map', locals: { dossier: @facade.dossier }
= render partial: 'users/carte/init_carto', locals: { dossier: @facade.dossier }

View file

@ -1,5 +1,5 @@
- unless @facade.dossier.read_only?
- if user_signed_in? && (@facade.dossier.owner?(current_user.email) || @facade.dossier.invite_by_user?(current_user.email))
%a#maj_infos.action{ href: "/users/dossiers/#{@facade.dossier.id}/description" }
%div#edit-dossier.col-lg-2.col-md-2.col-sm-2.col-xs-2.action
#edit-dossier.col-lg-2.col-md-2.col-sm-2.col-xs-2.action
= "éditer".upcase

View file

@ -2,9 +2,9 @@
.col-xs-12
#map.mini{ class: @facade.dossier.procedure.module_api_carto.classes }
%input{ id: 'json_latlngs', type: 'hidden', value: "#{@facade.dossier.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}" }
%input#json_latlngs{ type: 'hidden', value: "#{@facade.dossier.json_latlngs}" }
%input#quartier_prioritaires{ type: 'hidden', value: "#{@facade.dossier.quartier_prioritaires.to_json}" }
%input#cadastres{ type: 'hidden', value: "#{@facade.dossier.cadastres.to_json}" }
%script{ type: 'text/javascript' }
= "var dossier_id =#{@facade.dossier.id}"

View file

@ -1,7 +1,7 @@
#pieces-justificatives
%table.table
- if @facade.procedure.cerfa_flag?
%tr{ id: "piece_justificative_0" }
%tr#piece_justificative_0
%th.col-lg-6
Formulaire
%td.col-lg-6.col-md-6.col-sm-6.col-xs-6

View file

@ -1,6 +1,6 @@
= form_tag(url_for({ controller: 'commentaires', action: :create, dossier_id: dossier_facade.dossier.id, champ_id: dossier_facade.champ_id }), class: 'form-inline', method: 'POST', multipart: true) do
%textarea.form-control.wysihtml5{ id: 'texte_commentaire', name: 'texte_commentaire', style: 'width: 100%; margin-bottom: 2%;', rows: '5', placeholder: "Commentaire" }
%textarea.form-control.wysihtml5#texte_commentaire{ name: 'texte_commentaire', style: 'width: 100%; margin-bottom: 2%;', rows: '5', placeholder: "Commentaire" }
.row
.col-md-6

View file

@ -1,4 +1,4 @@
%div#footer
#footer
%p{ class: "copyright col-md-push-#{12-main_container_size} col-md-#{main_container_size} col-lg-push-#{12-main_container_size} col-lg-#{main_container_size} text-muted small" }
= link_to 'SGMAP', "http://etatplateforme.modernisation.gouv.fr"
= Time.now.year

View file

@ -1,6 +1,6 @@
.new-header
.header-inner-content
%img{ src: image_url("header/logo-tps.svg"), class: "header-logo pull-left" }
%img.header-logo.pull-left{ src: image_url("header/logo-tps.svg") }
= link_to "Connexion", new_user_session_path, :class => "header-login-button pull-right"

View file

@ -32,9 +32,9 @@
= render partial: 'layouts/ie_lt_10'
%div#wrap
#wrap
.row
%div#header.navbar
#header.navbar
= render partial: "layouts/navbar"
.row.no-margin
- if RenderPartialService.left_panel_exist? @left_pannel_url

View file

@ -1,27 +1,27 @@
%div#first-block
#first-block
.en-cours
%b
= dossier_count = current_administrateur.procedures.count
= ("Procedures".pluralize(dossier_count)).upcase
%div#action-block
#action-block
%div#menu-block
#menu-block
.split-hr-left
#procedure-list
%a{ :href => "#{url_for :admin_procedures_draft}", id: "draft-procedures" }
%a#draft-procedures{ :href => "#{url_for :admin_procedures_draft}" }
.procedure-list-element{ class: @draft_class }
Brouillons
.badge.progress-bar-default
= current_administrateur.procedures.where(published: false, archived: false).count
%a{ :href => "#{url_for :admin_procedures}", id: "active-procedures" }
%a#active-procedures{ :href => "#{url_for :admin_procedures}" }
.procedure-list-element{ class: @active_class }
Actives
.badge.progress-bar-success
= current_administrateur.procedures.where(published: true, archived: false).count
%a{ :href => "#{url_for :admin_procedures_archived}", id: "archived-procedures" }
%a#archived-procedures{ :href => "#{url_for :admin_procedures_archived}" }
.procedure-list-element{ class: @archived_class }
Archivées
.badge.progress-bar-purple
@ -30,4 +30,4 @@
.split-hr-left
%div#infos-block
#infos-block

View file

@ -1,51 +1,51 @@
%div#first-block
#first-block
.en-cours
- unless @procedure.logo.blank?
= image_tag @procedure.decorate.logo_img, style: 'width: 30px;'
%b
= @procedure.libelle
%div#action-block
#action-block
%div#menu-block
#menu-block
.split-hr-left
#procedure-list
%a{ :href => "#{url_for admin_procedure_path(@procedure)}", id: 'onglet-infos' }
%a#onglet-infos{ :href => "#{url_for admin_procedure_path(@procedure)}" }
.procedure-list-element{ class: ('active' if active == 'Informations') }
Informations
%a{ :href => "#{url_for admin_procedure_accompagnateurs_path(@procedure)}", id: 'onglet-accompagnateurs' }
%a#onglet-accompagnateurs{ :href => "#{url_for admin_procedure_accompagnateurs_path(@procedure)}" }
.procedure-list-element{ class: ('active' if active == 'Accompagnateurs') }
= t('dynamics.admin.procedure.onglets.accompagnateurs')
%a{ :href => "#{url_for edit_admin_procedure_path(@procedure)}", id: 'onglet-description' }
%a#onglet-description{ :href => "#{url_for edit_admin_procedure_path(@procedure)}" }
.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' }
%a#onglet-champs{ :href => "#{url_for admin_procedure_types_de_champ_path(@procedure)}" }
.procedure-list-element{ class: ('active' if active == 'Champs') }
Champs
- unless @procedure.locked?
%a{ :href => "#{url_for admin_procedure_pieces_justificatives_path(@procedure)}", id: 'onglet-pieces' }
%a#onglet-pieces{ :href => "#{url_for admin_procedure_pieces_justificatives_path(@procedure)}" }
.procedure-list-element{ class: ('active' if active == 'Pieces') }
Pièces jointes
- unless @procedure.locked?
%a{ :href => "#{url_for admin_procedure_types_de_champ_private_path(@procedure)}", id: 'onglet-private-champs' }
%a#onglet-private-champs{ :href => "#{url_for admin_procedure_types_de_champ_private_path(@procedure)}" }
.procedure-list-element{ class: ('active' if active == 'Champs privés') }
Champs privés
%a{ :href => "#{url_for admin_procedure_mail_templates_path(@procedure)}", id: 'onglet-inemailsfos' }
%a#onglet-inemailsfos{ :href => "#{url_for admin_procedure_mail_templates_path(@procedure)}" }
.procedure-list-element{ class: ('active' if active == 'E-mails') }
E-mails
%a{ :href => "#{url_for admin_procedure_previsualisation_path(@procedure)}", id: 'onglet-preview' }
%a#onglet-preview{ :href => "#{url_for admin_procedure_previsualisation_path(@procedure)}" }
.procedure-list-element{ class: ('active' if active == 'Prévisualisation') }
Prévisualisation
.split-hr-left
%div#infos-block
#infos-block

View file

@ -1,4 +1,4 @@
%div#cgu_menu_block
#cgu_menu_block
#procedure-list{ style: 'margin-top: 0;' }
= link_to cgu_path(:anchor => "editeur") do
.procedure-list-element

View file

@ -1,46 +1,46 @@
%div#first-block
#first-block
.en-cours
= dossier_count = current_user.dossiers.count
= ("Dossier".pluralize(dossier_count)).upcase
%br
EN COURS
%div#action-block
#action-block
%div#menu-block
#menu-block
.split-hr-left
#procedure-list
- unless current_user.dossiers.count == 0
%a{ :href => "#{url_for users_dossiers_path(liste: 'brouillon')}", 'data-toggle' => :tooltip, title: 'Les dossiers jamais proposés à la relecture.' }
.procedure-list-element{ class: ('active' if @liste == 'brouillon'), id: 'brouillon' }
.procedure-list-element#brouillon{ class: ('active' if @liste == 'brouillon') }
Brouillons
.badge.progress-bar-default
= @user_dossiers.brouillon.count
%a{ :href => "#{url_for users_dossiers_path(liste: 'a_traiter')}", 'data-toggle' => :tooltip, title: 'Les dossiers qui requièrent une action de votre part.' }
.procedure-list-element{ class: ('active' if @liste == 'a_traiter'), id: 'a_traiter' }
.procedure-list-element#a_traiter{ class: ('active' if @liste == 'a_traiter') }
En construction
.badge.progress-bar-danger
= @user_dossiers.en_construction.count
%a{ :href => "#{url_for users_dossiers_path(liste: 'en_instruction')}", 'data-toggle' => :tooltip, title: 'Les dossiers en cours d\'examen par l\'administration compétante.' }
.procedure-list-element{ class: ('active' if @liste == 'en_instruction'), id: 'en_instruction' }
.procedure-list-element#en_instruction{ class: ('active' if @liste == 'en_instruction') }
En instruction
.badge.progress-bar-default
= @user_dossiers.en_instruction.count
%a{ :href => "#{url_for users_dossiers_path(liste: 'termine')}", 'data-toggle' => :tooltip, title: 'Les dossiers cloturés qui peuvent être "Accepté", "Refusé" ou "Sans suite".' }
.procedure-list-element{ class: ('active' if @liste == 'termine'), id: 'termine' }
.procedure-list-element#termine{ class: ('active' if @liste == 'termine') }
Terminé
.badge.progress-bar-success
= @user_dossiers.termine.count
%a{ :href => "#{url_for users_dossiers_path(liste: 'invite')}" }
.procedure-list-element{ class: ('active' if @liste == 'invite'), id: 'invite' }
.procedure-list-element#invite{ class: ('active' if @liste == 'invite') }
Invitation
.badge.progress-bar-warning
= current_user.invites.count
.split-hr-left
%div#infos-block
#infos-block

View file

@ -1,12 +1,12 @@
%div#first-block
#first-block
.en-cours
%h2 Récapitulatif
.infos
%div= t('dynamics.dossiers.numéro') + @facade.dossier.id.to_s
%div#menu-block
#menu-block
%div#infos-block
#infos-block
.split-hr-left
.dossier-state= @facade.dossier.display_state
.split-hr-left

View file

@ -3,5 +3,5 @@
.input-group
= text_field_tag('q', "#{@search_terms unless @search_terms.nil?}", id: 'q', placeholder: "Recherchez parmi tous vos dossiers", class: 'form-control')
%span.input-group-btn
%button.btn.btn-default{ id: 'search-button' }
%button.btn.btn-default#search-button
%i.fa.fa-search

View file

@ -4,7 +4,7 @@
.col-lg-3.col-md-3.col-sm-3.col-xs-3.options
.row.centered-option
.col-lg-12.col-md-12.col-sm-12.col-xs-12
%div#invitations.dropdown-toggle{ 'data-toggle' => 'dropdown', 'aria-haspopup' => true, 'aria-expanded' => false }
#invitations.dropdown-toggle{ 'data-toggle' => 'dropdown', 'aria-haspopup' => true, 'aria-expanded' => false }
%i.fa.fa-user
= t('utils.involved')
.badge.progress-bar-info

View file

@ -1,5 +1,5 @@
- if current_user.loged_in_with_france_connect?
%div{ id: "fconnect-profile", "data-fc-logout-url" => '/users/sign_out" data-method="delete' }
#fconnect-profile{ "data-fc-logout-url" => '/users/sign_out" data-method="delete' }
%a.text-info{ href: "#" }
= "#{current_user.given_name} #{current_user.family_name}"
= link_to "", "/users/sign_out", method: :delete, class: "btn fa fa-power-off off-fc-link"

View file

@ -20,9 +20,9 @@
= form_tag(url_for({ controller: :carte, action: :save, dossier_id: @dossier.id }), class: 'form-inline', method: 'POST') do
%br
%input{ type: 'hidden', value: "#{@dossier.json_latlngs}", name: 'json_latlngs', id: 'json_latlngs' }
%input{ id: 'quartier_prioritaires', type: 'hidden', value: "#{@dossier.quartier_prioritaires.to_json}" }
%input{ id: 'cadastres', type: 'hidden', value: "#{@dossier.cadastres.to_json}" }
%input#json_latlngs{ type: 'hidden', value: "#{@dossier.json_latlngs}", name: 'json_latlngs' }
%input#quartier_prioritaires{ type: 'hidden', value: "#{@dossier.quartier_prioritaires.to_json}" }
%input#cadastres{ type: 'hidden', value: "#{@dossier.cadastres.to_json}" }
- if @dossier.draft?
= render partial: '/layouts/etape_suivante'

View file

@ -8,15 +8,15 @@
%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
-# %a#lien_cerfa{ href: "#{dossier.procedure.lien_demarche}", target: '_blank' } Télécharger
%td
- if dossier.cerfa_available?
%span.btn.btn-sm.btn-file.btn-success
Modifier
%input{ type: 'file', name: 'cerfa_pdf', id: 'cerfa_pdf', accept: PieceJustificative.accept_format, :max_file_size => 6.megabytes }
%input#cerfa_pdf{ type: 'file', name: 'cerfa_pdf', accept: PieceJustificative.accept_format, :max_file_size => 6.megabytes }
- else
%input{ type: 'file', name: 'cerfa_pdf', id: 'cerfa_pdf', accept: PieceJustificative.accept_format, :max_file_size => 6.megabytes }
%input#cerfa_pdf{ type: 'file', name: 'cerfa_pdf', accept: PieceJustificative.accept_format, :max_file_size => 6.megabytes }
- dossier.types_de_piece_justificative.order('order_place ASC').each do |tpj|
%tr

View file

@ -1,4 +1,4 @@
%p.lead{ id: 'pro_section' }
%p.lead#pro_section
.flag
= image_tag(image_url(LOGO_NAME))
%br

View file

@ -1,7 +1,8 @@
require 'spec_helper'
feature 'add commentaire on backoffice' do
let(:dossier) { create(:dossier, :with_entreprise) }
let(:procedure) { create(:procedure) }
let(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'updated') }
let(:dossier_id) { dossier.id }
let!(:commentaire) { create(:commentaire, dossier: dossier, email: 'toto@toto.com') }
let(:email_commentaire) { 'test@test.com' }
@ -10,6 +11,7 @@ feature 'add commentaire on backoffice' do
let(:body) { 'Commentaire de test' }
before do
create :assign_to, gestionnaire: gestionnaire, procedure: procedure
login_as gestionnaire, scope: :gestionnaire
visit backoffice_dossier_path(dossier)
end

View file

@ -1,12 +1,13 @@
require 'spec_helper'
feature 'backoffice: flux de commentaires' do
let(:procedure) { create(:procedure) }
let(:gestionnaire) { create(:gestionnaire) }
let(:dossier) { create(:dossier, :with_entreprise) }
let(:dossier) { create(:dossier, :with_entreprise, procedure: procedure, state: 'updated') }
let(:dossier_id) { dossier.id }
let(:champ1) { dossier.champs.first }
let(:champ2) { create(:champ, dossier: dossier, type_de_champ: create(:type_de_champ_public, libelle: "subtitle")) }
let(:champ1) { create(:champ, dossier: dossier, type_de_champ: create(:type_de_champ_public, libelle: "subtitle1")) }
let(:champ2) { create(:champ, dossier: dossier, type_de_champ: create(:type_de_champ_public, libelle: "subtitle2")) }
let!(:commentaire1) { create(:commentaire, dossier: dossier, champ: champ1) }
let!(:commentaire2) { create(:commentaire, dossier: dossier) }
@ -14,6 +15,7 @@ feature 'backoffice: flux de commentaires' do
let!(:commentaire4) { create(:commentaire, dossier: dossier, champ: champ1) }
before do
create :assign_to, gestionnaire: gestionnaire, procedure: procedure
login_as gestionnaire, scope: :gestionnaire
visit backoffice_dossier_path(dossier)
end

View file

@ -32,6 +32,18 @@ feature 'on backoffice page', js: true do
expect(page).to have_css('#backoffice-dossier-show')
end
end
context "and goes to the page of a dossier he hasn't access to" do
let!(:unauthorized_dossier) { create(:dossier, :with_entreprise, state: 'updated') }
before do
visit backoffice_dossier_path(unauthorized_dossier)
end
scenario "it shows an error message" do
expect(page).to have_content("Le dossier n'existe pas ou vous n'y avez pas accès.")
end
end
end
context 'when gestionnaire have enterprise and individual dossier in his inbox', js: true do