Merge pull request #3671 from betagouv/dev

2019-03-25-01
This commit is contained in:
Pierre de La Morinerie 2019-03-25 16:13:53 +01:00 committed by GitHub
commit a14bbd9f59
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
58 changed files with 105 additions and 65 deletions

View file

@ -50,15 +50,27 @@ $procedure-context-breakpoint: $two-columns-breakpoint;
.procedure-logos {
display: flex;
justify-content: space-around;
align-items: center;
margin-bottom: 20px;
> :not(:last-child) {
margin-right: $default-padding;
}
img {
max-height: 50px;
max-width: 100%;
margin: 0 10px 20px 10px;
max-height: 50px;
// Fix Chrome flexbox issue
// See https://github.com/philipwalton/flexbugs/issues/225
width: 100%;
height: 100%;
min-width: 0;
object-fit: contain;
@media (min-width: $procedure-context-breakpoint) {
max-height: 130px;
max-width: 500px;
max-height: 130px;
}
}
}

View file

@ -164,7 +164,8 @@ module NewGestionnaire
def champs_private_params
params.require(:dossier).permit(champs_private_attributes: [
:id, :primary_value, :secondary_value, :piece_justificative_file, :value, value: []
:id, :primary_value, :secondary_value, :piece_justificative_file, :value, value: [],
champs_attributes: [:id, :_destroy, :value, :primary_value, :secondary_value, :piece_justificative_file, value: []]
])
end

View file

@ -1,4 +1,4 @@
module NewUser
module Users
class CommencerController < ApplicationController
layout 'procedure_context'

View file

@ -1,4 +1,4 @@
module NewUser
module Users
class DemarchesController < UserController
def index
@previous_demarches_still_active = current_user

View file

@ -1,4 +1,4 @@
module NewUser
module Users
class DossiersController < UserController
include Devise::StoreLocationExtension
include DossierHelper

View file

@ -1,4 +1,4 @@
module NewUser
module Users
class FeedbacksController < UserController
def create
current_user.feedbacks.create!(rating: params[:rating])

View file

@ -1,4 +1,4 @@
module NewUser
module Users
class UserController < ApplicationController
before_action :authenticate_user!

View file

@ -467,6 +467,7 @@ class Procedure < ApplicationRecord
def percentile_time(start_attribute, end_attribute, p)
times = dossiers
.where.not(start_attribute => nil, end_attribute => nil)
.where(end_attribute => 1.month.ago..Time.zone.now)
.pluck(start_attribute, end_attribute)
.map { |(start_date, end_date)| end_date - start_date }

View file

@ -89,7 +89,7 @@
%li
.header-help
- if nav_bar_profile == :user && dossier.present?
= render partial: 'new_user/dossier_help_dropdown', locals: { dossier: dossier }
= render partial: 'users/dossier_help_dropdown', locals: { dossier: dossier }
- elsif nav_bar_profile == :gestionnaire
= render partial: 'new_gestionnaire/help_dropdown'
- else

View file

@ -15,8 +15,8 @@
- content_for :footer do
- if procedure
= render partial: 'new_user/procedure_footer', locals: { procedure: procedure, dossier: @dossier }
= render partial: 'users/procedure_footer', locals: { procedure: procedure, dossier: @dossier }
- else
= render partial: 'new_user/dossiers/index_footer'
= render partial: 'users/dossiers/index_footer'
= render template: 'layouts/application'

View file

@ -1,4 +0,0 @@
%footer.procedure-footer
.container
.footer-row.footer-bottom-line
= render partial: "new_user/general_footer_row", locals: { dossier: nil }

View file

@ -1,13 +0,0 @@
- content_for(:title, "Résumé · Dossier nº #{@dossier.id} (#{@dossier.procedure.libelle})")
- content_for :footer do
= render partial: "new_user/procedure_footer", locals: { procedure: @dossier.procedure, dossier: @dossier }
#dossier-show
= render partial: 'new_user/dossiers/show/header', locals: { dossier: @dossier }
.container
= render partial: 'new_user/dossiers/show/status_overview', locals: { dossier: @dossier }
- if !@dossier.termine?
= render partial: 'new_user/dossiers/show/latest_message', locals: { dossier: @dossier }

View file

@ -37,4 +37,4 @@
%p= politique
.footer-row.footer-bottom-line
= render partial: 'new_user/general_footer_row', locals: { dossier: dossier }
= render partial: 'users/general_footer_row', locals: { dossier: dossier }

View file

@ -1,7 +1,7 @@
- content_for(:title, "Démarches")
- content_for :footer do
= render partial: "new_user/dossiers/index_footer"
= render partial: "users/dossiers/index_footer"
#demarches-index
.container

View file

@ -0,0 +1,4 @@
%footer.procedure-footer
.container
.footer-row.footer-bottom-line
= render partial: "users/general_footer_row", locals: { dossier: nil }

View file

@ -1,7 +1,7 @@
- content_for(:title, "Modification du brouillon nº #{@dossier.id} (#{@dossier.procedure.libelle})")
- content_for :footer do
= render partial: "new_user/procedure_footer", locals: { procedure: @dossier.procedure, dossier: @dossier }
= render partial: "users/procedure_footer", locals: { procedure: @dossier.procedure, dossier: @dossier }
.dossier-header.sub-header
.container

View file

@ -1,10 +1,10 @@
- content_for(:title, "Demande · Dossier nº #{@dossier.id} (#{@dossier.procedure.libelle})")
- content_for :footer do
= render partial: "new_user/procedure_footer", locals: { procedure: @dossier.procedure, dossier: @dossier }
= render partial: "users/procedure_footer", locals: { procedure: @dossier.procedure, dossier: @dossier }
#dossier-show
= render partial: 'new_user/dossiers/show/header', locals: { dossier: @dossier }
= render partial: 'users/dossiers/show/header', locals: { dossier: @dossier }
= render partial: 'shared/dossiers/demande', locals: { dossier: @dossier, demande_seen_at: nil, profile: 'usager' }

View file

@ -1,7 +1,7 @@
- content_for(:title, "Informations sur létablissement")
- content_for :footer do
= render partial: "new_user/procedure_footer", locals: { procedure: @dossier.procedure, dossier: @dossier }
= render partial: "users/procedure_footer", locals: { procedure: @dossier.procedure, dossier: @dossier }
.etablissement
.container
@ -17,10 +17,10 @@
- etablissement = @dossier.etablissement
%h2.card-title= raison_sociale_or_name(etablissement)
= render partial: 'new_user/dossiers/etablissement/infos_entreprise', locals: { etablissement: etablissement }
= render partial: 'users/dossiers/etablissement/infos_entreprise', locals: { etablissement: etablissement }
- if etablissement.association?
= render partial: 'new_user/dossiers/etablissement/infos_association', locals: { etablissement: etablissement }
= render partial: 'users/dossiers/etablissement/infos_association', locals: { etablissement: etablissement }
.actions
= link_to 'Utiliser un autre numéro SIRET', siret_dossier_path(@dossier), class: 'button'

View file

@ -1,7 +1,7 @@
- content_for(:title, "Dossiers")
- content_for :footer do
= render partial: "new_user/dossiers/index_footer"
= render partial: "users/dossiers/index_footer"
.dossiers-headers.sub-header
.container

View file

@ -1,7 +1,7 @@
- content_for(:title, "Dossier bien envoyé (#{@dossier.procedure.libelle})")
- content_for :footer do
= render partial: "new_user/procedure_footer", locals: { procedure: @dossier.procedure, dossier: @dossier }
= render partial: "users/procedure_footer", locals: { procedure: @dossier.procedure, dossier: @dossier }
.merci
.container

View file

@ -1,10 +1,10 @@
- content_for(:title, "Messagerie · Dossier nº #{@dossier.id} (#{@dossier.procedure.libelle})")
- content_for :footer do
= render partial: "new_user/procedure_footer", locals: { procedure: @dossier.procedure, dossier: @dossier }
= render partial: "users/procedure_footer", locals: { procedure: @dossier.procedure, dossier: @dossier }
#dossier-show
= render partial: 'new_user/dossiers/show/header', locals: { dossier: @dossier }
= render partial: 'users/dossiers/show/header', locals: { dossier: @dossier }
.container
%p.messagerie-explanation

View file

@ -1,10 +1,10 @@
- content_for(:title, "Modifier · Dossier nº #{@dossier.id} (#{@dossier.procedure.libelle})")
- content_for :footer do
= render partial: "new_user/procedure_footer", locals: { procedure: @dossier.procedure, dossier: @dossier }
= render partial: "users/procedure_footer", locals: { procedure: @dossier.procedure, dossier: @dossier }
#dossier-show
= render partial: 'new_user/dossiers/show/header', locals: { dossier: @dossier }
= render partial: 'users/dossiers/show/header', locals: { dossier: @dossier }
.container
= render partial: "shared/dossiers/edit", locals: { dossier: @dossier, apercu: false }

View file

@ -0,0 +1,13 @@
- content_for(:title, "Résumé · Dossier nº #{@dossier.id} (#{@dossier.procedure.libelle})")
- content_for :footer do
= render partial: "users/procedure_footer", locals: { procedure: @dossier.procedure, dossier: @dossier }
#dossier-show
= render partial: 'users/dossiers/show/header', locals: { dossier: @dossier }
.container
= render partial: 'users/dossiers/show/status_overview', locals: { dossier: @dossier }
- if !@dossier.termine?
= render partial: 'users/dossiers/show/latest_message', locals: { dossier: @dossier }

View file

@ -264,7 +264,7 @@ Rails.application.routes.draw do
# User
#
scope module: 'new_user' do
scope module: 'users' do
namespace :commencer do
get '/test/:path', action: 'commencer_test', as: :test
get '/:path', action: 'commencer'

View file

@ -363,8 +363,16 @@ describe NewGestionnaire::DossiersController, type: :controller do
create(:type_de_champ_datetime, :private, libelle: 'libelle').champ.create
end
let(:champ_repetition) do
tdc = create(:type_de_champ_repetition, :private, libelle: 'libelle')
tdc.types_de_champ << create(:type_de_champ_text, libelle: 'libelle')
champ = tdc.champ.create
champ.add_row
champ
end
let(:dossier) do
create(:dossier, :en_construction, procedure: procedure, champs_private: [champ_multiple_drop_down_list, champ_linked_drop_down_list, champ_datetime])
create(:dossier, :en_construction, procedure: procedure, champs_private: [champ_multiple_drop_down_list, champ_linked_drop_down_list, champ_datetime, champ_repetition])
end
before do
@ -389,6 +397,13 @@ describe NewGestionnaire::DossiersController, type: :controller do
id: champ_linked_drop_down_list.id,
primary_value: 'primary',
secondary_value: 'secondary'
},
'3': {
id: champ_repetition.id,
champs_attributes: {
id: champ_repetition.champs.first.id,
value: 'text'
}
}
}
}
@ -397,12 +412,14 @@ describe NewGestionnaire::DossiersController, type: :controller do
champ_multiple_drop_down_list.reload
champ_linked_drop_down_list.reload
champ_datetime.reload
champ_repetition.reload
end
it { expect(champ_multiple_drop_down_list.value).to eq('["un", "deux"]') }
it { expect(champ_linked_drop_down_list.primary_value).to eq('primary') }
it { expect(champ_linked_drop_down_list.secondary_value).to eq('secondary') }
it { expect(champ_datetime.value).to eq('21/12/2019 13:17') }
it { expect(champ_repetition.champs.first.value).to eq('text') }
it { expect(response).to redirect_to(annotations_privees_gestionnaire_dossier_path(dossier.procedure, dossier)) }
end

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe NewUser::CommencerController, type: :controller do
describe Users::CommencerController, type: :controller do
let(:user) { create(:user) }
let(:published_procedure) { create(:procedure, :published) }
let(:draft_procedure) { create(:procedure, :with_path) }

View file

@ -1,11 +1,11 @@
require 'spec_helper'
describe NewUser::DossiersController, type: :controller do
describe Users::DossiersController, type: :controller do
let(:user) { create(:user) }
describe 'before_actions' do
it 'are present' do
before_actions = NewUser::DossiersController
before_actions = Users::DossiersController
._process_action_callbacks
.find_all { |process_action_callbacks| process_action_callbacks.kind == :before }
.map(&:filter)

View file

@ -1,9 +1,9 @@
require 'spec_helper'
describe NewUser::UserController, type: :controller do
describe Users::UserController, type: :controller do
describe 'before actions: authenticate_gestionnaire!' do
it 'is present' do
before_actions = NewUser::UserController
before_actions = Users::UserController
._process_action_callbacks
.find_all { |process_action_callbacks| process_action_callbacks.kind == :before }
.map(&:filter)

View file

@ -1,4 +1,4 @@
require 'features/new_user/dossier_shared_examples.rb'
require 'features/users/dossier_shared_examples.rb'
describe 'Dossier details:' do
let(:user) { create(:user) }

View file

@ -1,5 +1,5 @@
require 'spec_helper'
require 'features/new_user/dossier_shared_examples.rb'
require 'features/users/dossier_shared_examples.rb'
feature 'Invitations' do
let(:owner) { create(:user) }

View file

@ -780,6 +780,15 @@ describe Procedure do
end
end
context 'when there is a dossier with bad data' do
let(:delays) { [2.days, 2.days] }
let!(:bad_dossier) { create_dossier(instruction_date: nil, processed_date: 10.days.ago) }
it 'ignores bad dossiers' do
expect(procedure.usual_instruction_time).to be_within(10.seconds).of(2.days)
end
end
context 'when there is only one processed dossier' do
let(:delays) { [1.day] }
it { expect(procedure.usual_instruction_time).to be_within(10.seconds).of(1.day) }

View file

@ -1,4 +1,4 @@
describe 'new_user/procedure_footer.html.haml', type: :view do
describe 'users/procedure_footer.html.haml', type: :view do
let(:service) { create(:service) }
let(:dossier) {
dossier = create(:dossier)
@ -6,7 +6,7 @@ describe 'new_user/procedure_footer.html.haml', type: :view do
return dossier
}
subject { render 'new_user/procedure_footer.html.haml', procedure: dossier.procedure, dossier: dossier }
subject { render 'users/procedure_footer.html.haml', procedure: dossier.procedure, dossier: dossier }
it "affiche les informations de contact" do
expect(subject).to have_text(service.nom)

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe 'new_user/dossiers/brouillon.html.haml', type: :view do
describe 'users/dossiers/brouillon.html.haml', type: :view do
let(:procedure) { create(:procedure, :with_two_type_de_piece_justificative, :with_notice, for_individual: true) }
let(:dossier) { create(:dossier, :with_entreprise, :with_service, state: Dossier.states.fetch(:brouillon), procedure: procedure) }
let(:footer) { view.content_for(:footer) }

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe 'new_user/dossiers/demande.html.haml', type: :view do
describe 'users/dossiers/demande.html.haml', type: :view do
let(:procedure) { create(:procedure, :published, :with_two_type_de_piece_justificative, :with_type_de_champ, :with_type_de_champ_private) }
let(:dossier) { create(:dossier, :en_construction, :with_entreprise, procedure: procedure) }

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe 'new_user/dossiers/etablissement.html.haml', type: :view do
describe 'users/dossiers/etablissement.html.haml', type: :view do
let(:etablissement) { create(:etablissement, :with_exercices) }
let(:dossier) { create(:dossier, etablissement: etablissement) }
let(:footer) { view.content_for(:footer) }

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe 'new_user/dossiers/identite.html.haml', type: :view do
describe 'users/dossiers/identite.html.haml', type: :view do
let(:procedure) { create(:simple_procedure, for_individual: true) }
let(:dossier) { create(:dossier, :with_entreprise, :with_service, state: Dossier.states.fetch(:brouillon), procedure: procedure) }

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe 'new_user/dossiers/index.html.haml', type: :view do
describe 'users/dossiers/index.html.haml', type: :view do
let(:user) { create(:user) }
let(:dossier_brouillon) { create(:dossier, state: Dossier.states.fetch(:brouillon), user: user) }
let(:dossier_en_construction) { create(:dossier, state: Dossier.states.fetch(:en_construction), user: user) }

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe 'new_user/dossiers/show.html.haml', type: :view do
describe 'users/dossiers/show.html.haml', type: :view do
let(:dossier) { create(:dossier, :en_construction) }
before do

View file

@ -1,11 +1,11 @@
describe 'new_user/dossiers/show/header.html.haml', type: :view do
describe 'users/dossiers/show/header.html.haml', type: :view do
let(:dossier) { create(:dossier, :en_construction, procedure: create(:procedure)) }
before do
sign_in dossier.user
end
subject! { render 'new_user/dossiers/show/header.html.haml', dossier: dossier }
subject! { render 'users/dossiers/show/header.html.haml', dossier: dossier }
it 'affiche les informations du dossier' do
expect(rendered).to have_text(dossier.procedure.libelle)

View file

@ -1,5 +1,5 @@
describe 'new_user/dossiers/show/_status_overview.html.haml', type: :view do
subject! { render 'new_user/dossiers/show/status_overview.html.haml', dossier: dossier }
describe 'users/dossiers/show/_status_overview.html.haml', type: :view do
subject! { render 'users/dossiers/show/status_overview.html.haml', dossier: dossier }
matcher :have_timeline_item do |selector|
match do |rendered|

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe 'new_user/dossiers/siret.html.haml', type: :view do
describe 'users/dossiers/siret.html.haml', type: :view do
let(:dossier) { create(:dossier) }
before do