Merge branch 'dev'

This commit is contained in:
gregoirenovel 2018-02-02 10:35:38 +01:00
commit 4afbda9c7b
11 changed files with 137 additions and 69 deletions

View file

@ -12,11 +12,11 @@ defaults: &defaults
bundle_restore_cache: &bundle_restore_cache
restore_cache:
key: bundle-install-v7-{{ arch }}-{{ checksum "Gemfile.lock" }}
key: bundle-install-v8-{{ arch }}-{{ checksum "Gemfile.lock" }}
bundle_save_cache: &bundle_save_cache
save_cache:
key: bundle-install-v7-{{ arch }}-{{ checksum "Gemfile.lock" }}
key: bundle-install-v8-{{ arch }}-{{ checksum "Gemfile.lock" }}
paths:
- ~/vendor/bundle

View file

@ -30,27 +30,27 @@ GEM
remote: https://rubygems.org/
specs:
CFPropertyList (2.3.6)
actioncable (5.1.4)
actionpack (= 5.1.4)
nio4r (~> 2.0)
actioncable (5.0.6)
actionpack (= 5.0.6)
nio4r (>= 1.2, < 3.0)
websocket-driver (~> 0.6.1)
actionmailer (5.1.4)
actionpack (= 5.1.4)
actionview (= 5.1.4)
activejob (= 5.1.4)
actionmailer (5.0.6)
actionpack (= 5.0.6)
actionview (= 5.0.6)
activejob (= 5.0.6)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.1.4)
actionview (= 5.1.4)
activesupport (= 5.1.4)
actionpack (5.0.6)
actionview (= 5.0.6)
activesupport (= 5.0.6)
rack (~> 2.0)
rack-test (>= 0.6.3)
rack-test (~> 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.1.4)
activesupport (= 5.1.4)
actionview (5.0.6)
activesupport (= 5.0.6)
builder (~> 3.1)
erubi (~> 1.4)
erubis (~> 2.7.0)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
active_model_serializers (0.10.7)
@ -58,43 +58,44 @@ GEM
activemodel (>= 4.1, < 6)
case_transform (>= 0.2)
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
activejob (5.1.4)
activesupport (= 5.1.4)
activejob (5.0.6)
activesupport (= 5.0.6)
globalid (>= 0.3.6)
activemodel (5.1.4)
activesupport (= 5.1.4)
activemodel (5.0.6)
activesupport (= 5.0.6)
activemodel-serializers-xml (1.0.2)
activemodel (> 5.x)
activesupport (> 5.x)
builder (~> 3.1)
activerecord (5.1.4)
activemodel (= 5.1.4)
activesupport (= 5.1.4)
arel (~> 8.0)
activesupport (5.1.4)
activerecord (5.0.6)
activemodel (= 5.0.6)
activesupport (= 5.0.6)
arel (~> 7.0)
activesupport (5.0.6)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
administrate (0.8.1)
actionpack (>= 4.2, < 5.2)
actionview (>= 4.2, < 5.2)
activerecord (>= 4.2, < 5.2)
autoprefixer-rails (>= 6.0)
administrate (0.4.0)
autoprefixer-rails (~> 6.0)
bourbon (~> 4.2)
datetime_picker_rails (~> 0.0.7)
jquery-rails (>= 4.0)
kaminari (>= 1.0)
jquery-rails (~> 4.0)
kaminari (~> 0.16)
momentjs-rails (~> 2.8)
neat (~> 1.1)
normalize-rails (~> 3.0)
rails (>= 4.2, < 5.1)
sass-rails (~> 5.0)
selectize-rails (~> 0.6)
apipie-rails (0.5.6)
rails (>= 4.1)
arel (8.0.0)
arel (7.1.4)
ast (2.3.0)
attr_required (1.0.1)
autoprefixer-rails (7.2.5)
autoprefixer-rails (6.7.7.2)
execjs
axlsx (2.0.1)
htmlentities (~> 4.3.1)
@ -108,6 +109,9 @@ GEM
sass (>= 3.3.4)
bootstrap-wysihtml5-rails (0.3.3.8)
railties (>= 3.0)
bourbon (4.3.4)
sass (~> 3.4)
thor (~> 0.19)
brakeman (4.1.1)
browser (2.5.2)
builder (3.2.3)
@ -134,7 +138,7 @@ GEM
chartkick (2.2.5)
childprocess (0.8.0)
ffi (~> 1.0, >= 1.0.11)
chunky_png (1.3.10)
chunky_png (1.3.8)
clamav-client (3.1.0)
coderay (1.1.2)
coffee-rails (4.2.2)
@ -167,7 +171,7 @@ GEM
activerecord (> 3.0.0)
delayed_job (> 2.0.3)
sinatra (>= 1.4.4)
devise (4.4.0)
devise (4.4.1)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0, < 5.2)
@ -189,7 +193,6 @@ GEM
em-websocket (0.5.1)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
erubi (1.7.0)
erubis (2.7.0)
eventmachine (1.2.1)
excon (0.60.0)
@ -399,7 +402,7 @@ GEM
domain_name (~> 0.5)
http_parser.rb (0.6.0)
httpclient (2.8.3)
i18n (0.9.3)
i18n (0.9.1)
concurrent-ruby (~> 1.0)
inflecto (0.0.2)
ipaddress (0.8.3)
@ -415,18 +418,9 @@ GEM
url_safe_base64
jsonapi-renderer (0.2.0)
jwt (1.5.6)
kaminari (1.1.1)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.1.1)
kaminari-activerecord (= 1.1.1)
kaminari-core (= 1.1.1)
kaminari-actionview (1.1.1)
actionview
kaminari-core (= 1.1.1)
kaminari-activerecord (1.1.1)
activerecord
kaminari-core (= 1.1.1)
kaminari-core (1.1.1)
kaminari (0.17.0)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
kgio (2.11.1)
launchy (2.4.3)
addressable (~> 2.3)
@ -462,18 +456,22 @@ GEM
mimemagic (0.3.2)
mini_mime (1.0.0)
mini_portile2 (2.3.0)
minitest (5.11.1)
minitest (5.11.3)
momentjs-rails (2.17.1)
railties (>= 3.1)
multi_json (1.13.1)
multi_xml (0.6.0)
multipart-post (2.0.0)
mustermann (1.0.1)
neat (1.9.0)
sass (>= 3.3)
thor (~> 0.19)
nenv (0.3.0)
netrc (0.11.0)
nio4r (2.2.0)
nokogiri (1.8.1)
nokogiri (1.8.2)
mini_portile2 (~> 2.3.0)
normalize-rails (3.0.3)
notiffany (0.1.1)
nenv (~> 0.1)
shellany (~> 0.0)
@ -539,19 +537,19 @@ GEM
rack (>= 1.1)
rack-protection (2.0.0)
rack
rack-test (0.8.2)
rack (>= 1.0, < 3)
rails (5.1.4)
actioncable (= 5.1.4)
actionmailer (= 5.1.4)
actionpack (= 5.1.4)
actionview (= 5.1.4)
activejob (= 5.1.4)
activemodel (= 5.1.4)
activerecord (= 5.1.4)
activesupport (= 5.1.4)
rack-test (0.6.3)
rack (>= 1.0)
rails (5.0.6)
actioncable (= 5.0.6)
actionmailer (= 5.0.6)
actionpack (= 5.0.6)
actionview (= 5.0.6)
activejob (= 5.0.6)
activemodel (= 5.0.6)
activerecord (= 5.0.6)
activesupport (= 5.0.6)
bundler (>= 1.3.0)
railties (= 5.1.4)
railties (= 5.0.6)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.2)
actionpack (~> 5.x, >= 5.0.1)
@ -562,9 +560,9 @@ GEM
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
railties (5.1.4)
actionpack (= 5.1.4)
activesupport (= 5.1.4)
railties (5.0.6)
actionpack (= 5.0.6)
activesupport (= 5.0.6)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
@ -713,7 +711,7 @@ GEM
turbolinks-source (5.1.0)
tzinfo (1.2.4)
thread_safe (~> 0.1)
uglifier (4.1.4)
uglifier (4.1.3)
execjs (>= 0.3.0, < 3)
unf (0.1.4)
unf_ext

View file

@ -20,4 +20,8 @@
&.justify-center {
justify-content: center;
}
&.justify-start {
justify-content: flex-start;
}
}

View file

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

View file

@ -33,6 +33,14 @@ module NewGestionnaire
@following_accompagnateurs_emails = dossier.followers_gestionnaires.pluck(:email)
@avis_emails = dossier.avis.includes(:gestionnaire).map(&:email_to_display)
@invites_emails = dossier.invites.map(&:email)
@potential_recipients = procedure.gestionnaires.reject { |g| g == current_gestionnaire }
end
def envoyer_a_accompagnateur
recipient = Gestionnaire.find(params[:recipient])
GestionnaireMailer.send_dossier(current_gestionnaire, dossier, recipient).deliver_later
flash.notice = "Dossier envoyé"
redirect_to(personnes_impliquees_dossier_path(procedure, dossier))
end
def follow

View file

@ -10,6 +10,14 @@ class GestionnaireMailer < ApplicationMailer
send_mail gestionnaire.email, overview, 'Vos activités sur TPS'
end
def send_dossier(sender, dossier, recipient)
@sender = sender
@dossier = dossier
subject = "#{sender.email} vous a envoyé le dossier nº #{dossier.id}"
mail(to: recipient.email, subject: subject)
end
private
def vars_mailer email, args

View file

@ -0,0 +1,9 @@
Bonjour,
<%= @sender.email %> vous a envoyé le dossier nº <%= @dossier.id %>, cliquez sur le lien ci-dessous pour y accéder :
<%= dossier_url(@dossier.procedure, @dossier) %>
Bonne journée,
L'équipe Téléprocédures Simplifiées

View file

@ -0,0 +1,6 @@
.tab-title= "Envoyer ce dossier à un autre accompagnateur"
= form_for dossier, url: envoyer_a_accompagnateur_dossier_path(dossier.procedure, dossier), method: :post, html: { class: 'form' } do |f|
.flex.justify-start.align-baseline
= select_tag(:recipient, options_from_collection_for_select(potential_recipients, :id, :email))
= f.submit "Envoyer", class: "button large send gap-left"

View file

@ -3,6 +3,8 @@
= render partial: "header", locals: { dossier: @dossier }
.personnes-impliquees.container
= render partial: 'new_gestionnaire/dossiers/envoyer_dossier_block', locals: { dossier: @dossier, potential_recipients: @potential_recipients }
= render partial: 'new_gestionnaire/dossiers/personnes_impliquees_block', locals: { emails_collection: @following_accompagnateurs_emails, title: "Accompagnateurs qui suivent le dossier", blank: "Aucun accompagnateur ne suit ce dossier" }
= render partial: 'new_gestionnaire/dossiers/personnes_impliquees_block', locals: { emails_collection: @avis_emails, title: "Personnes à qui un avis a été demandé", blank: "Aucun avis n'a été demandé" }

View file

@ -231,6 +231,7 @@ Rails.application.routes.draw do
post 'passer-en-instruction' => 'dossiers#passer_en_instruction'
post 'repasser-en-construction' => 'dossiers#repasser_en_construction'
post 'terminer'
post 'envoyer-a-accompagnateur' => 'dossiers#envoyer_a_accompagnateur'
scope :carte do
get 'position'
end

View file

@ -4,7 +4,8 @@ describe NewGestionnaire::DossiersController, type: :controller do
render_views
let(:gestionnaire) { create(:gestionnaire) }
let(:procedure) { create(:procedure, :published, gestionnaires: [gestionnaire]) }
let(:gestionnaires) { [gestionnaire] }
let(:procedure) { create(:procedure, :published, gestionnaires: gestionnaires) }
let(:dossier) { create(:dossier, :en_construction, procedure: procedure) }
before { sign_in(gestionnaire) }
@ -30,6 +31,32 @@ describe NewGestionnaire::DossiersController, type: :controller do
end
end
describe '#envoyer_a_accompagnateur' do
let(:recipient) { create(:gestionnaire) }
let(:gestionnaires) { [gestionnaire, recipient] }
let(:mail) { double("mail") }
before do
expect(mail).to receive(:deliver_later)
expect(GestionnaireMailer)
.to receive(:send_dossier)
.with(gestionnaire, dossier, recipient)
.and_return(mail)
post(
:envoyer_a_accompagnateur,
params: {
recipient: recipient,
procedure_id: procedure.id,
dossier_id: dossier.id
}
)
end
it { expect(response).to redirect_to(personnes_impliquees_dossier_url) }
end
describe '#follow' do
before do
patch :follow, params: { procedure_id: procedure.id, dossier_id: dossier.id }