Merge pull request #2194 from betagouv/remove-old-dossiers-list
Liste des dossiers : suppression de l'ancien code
This commit is contained in:
commit
ceef24b7c6
11 changed files with 5 additions and 418 deletions
|
@ -1,6 +1,5 @@
|
|||
@import "constants";
|
||||
|
||||
#users-index,
|
||||
#admins-index {
|
||||
margin-left: 2rem;
|
||||
margin-right: 2rem;
|
||||
|
|
|
@ -12,32 +12,6 @@ class Users::DossiersController < UsersController
|
|||
authorized_routes? self.class
|
||||
end
|
||||
|
||||
def index
|
||||
@liste ||= params[:liste] || 'a_traiter'
|
||||
|
||||
@user_dossiers = current_user.dossiers
|
||||
|
||||
@dossiers_filtered = case @liste
|
||||
when 'brouillon'
|
||||
@user_dossiers.state_brouillon.order_by_updated_at
|
||||
when 'a_traiter'
|
||||
@user_dossiers.state_en_construction.order_by_updated_at
|
||||
when 'en_instruction'
|
||||
@user_dossiers.state_en_instruction.order_by_updated_at
|
||||
when 'termine'
|
||||
@user_dossiers.state_termine.order_by_updated_at
|
||||
when 'invite'
|
||||
current_user.invites
|
||||
else
|
||||
return redirect_to users_dossiers_path
|
||||
end
|
||||
|
||||
@dossiers = smart_listing_create :dossiers,
|
||||
@dossiers_filtered,
|
||||
partial: "users/dossiers/list",
|
||||
array: true
|
||||
end
|
||||
|
||||
def commencer_test
|
||||
procedure_path = ProcedurePath.find_by(path: params[:procedure_path])
|
||||
procedure = procedure_path&.test_procedure
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
- if smart_listing.present?
|
||||
%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-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-xs-2= 'Action'
|
||||
- @dossiers.each do |dossier|
|
||||
- if dossier.kind_of? Invite
|
||||
- invite = dossier
|
||||
- dossier = invite.dossier.decorate
|
||||
- else
|
||||
- dossier = dossier.decorate
|
||||
|
||||
- dossier_url = users_dossiers_invite_path(id: invite.id) if invite.present?
|
||||
- if invite.nil?
|
||||
- dossier_url = users_dossier_recapitulatif_path(dossier) if !dossier.brouillon?
|
||||
- dossier_url = modifier_dossier_path(dossier) if dossier.brouillon?
|
||||
|
||||
%tr{ id: "tr_dossier_#{dossier.id}", 'data-dossier_url' => dossier_url }
|
||||
%td.center
|
||||
= dossier.id
|
||||
%td
|
||||
= dossier.procedure.libelle
|
||||
|
||||
%td{ id: "dossier_#{dossier.id}_state" }= dossier.display_state
|
||||
%td= dossier.last_update
|
||||
%td= link_to('X', url_for(controller: 'dossiers', action: :destroy, id: dossier.id), 'data-confirm' => "Voulez-vous supprimer le brouillon ?", 'data-method' => :delete, class: 'btn-sm btn-danger') if @liste == "brouillon"
|
||||
|
||||
= smart_listing.paginate
|
||||
= smart_listing.pagination_per_page_links
|
||||
%br
|
||||
|
||||
- else
|
||||
%h4.center
|
||||
Aucun dossier
|
|
@ -1,52 +0,0 @@
|
|||
#state_description.row{ style: 'width: 55%; margin-left: auto; margin-right: auto;' }
|
||||
.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
|
||||
- case liste
|
||||
- when 'brouillon'
|
||||
Les dossiers présents dans cette liste
|
||||
%b
|
||||
n'ont pas encore été soumis aux services instructeurs.
|
||||
Ils ne sont visibles que par vous.
|
||||
- when 'nouveaux'
|
||||
Les dossiers présents dans cette liste
|
||||
%b
|
||||
n'ont pas encore été ouverts
|
||||
par les services instructeurs. Une notification vous sera envoyée quand votre demande aura été étudiée.
|
||||
- when 'a_traiter'
|
||||
Les dossiers présents dans cette liste sont
|
||||
%b
|
||||
visibles par les services instructeurs.
|
||||
%br
|
||||
Ces dossiers ne sont pas encore figés et peuvent être modifiés à souhait.
|
||||
- when 'en_attente'
|
||||
Les dossiers présents dans cette liste sont
|
||||
%b
|
||||
en cours de relecture par le service instructeur.
|
||||
Il reviendra vers vous si des informations ou documents sont manquants pour le futur examen de votre dossier.
|
||||
- when 'valides'
|
||||
Les dossiers présents dans cette liste ont été
|
||||
%b
|
||||
relus et considérés comme complets
|
||||
pour examen par les services instructeurs. Ceux-ci ne peuvent maintenant plus être modifiés. Il faut que vous procédiez à leur dépôt afin qu'une décision finale soit rendue.
|
||||
- when 'en_instruction'
|
||||
Les dossiers présents dans cette liste sont
|
||||
%b
|
||||
en cours de réception
|
||||
ou
|
||||
%b
|
||||
en cours d'examen
|
||||
par les services instructeurs. Une notification vous sera envoyée une fois qu'une décision aura été rendue.
|
||||
- when 'termine'
|
||||
Les dossiers présents dans cette liste sont ceux qui ont été instruits et pour lesquels
|
||||
%b
|
||||
une décision finale a été rendue.
|
||||
Ils peuvent posséder trois états différents : Accepté, Refusé ou Sans Suite.
|
||||
- when 'invite'
|
||||
Les dossiers présents dans cette liste sont ceux
|
||||
%b
|
||||
auxquels vous avez été invités
|
||||
à participer afin d'émettre un avis ou de fournir des documents complémentaires.
|
|
@ -1,15 +0,0 @@
|
|||
#users-index
|
||||
.default-data-block.default_visible
|
||||
.row.show-block#new_dossiers
|
||||
.header
|
||||
.col-lg-10.col-md-10.col-sm-10.col-xs-10.title
|
||||
.carret-right
|
||||
.carret-down
|
||||
Dossiers
|
||||
.col-lg-2.col-md-2.col-sm-2.col-xs-2.count
|
||||
-# 0
|
||||
-# dossiers
|
||||
.body
|
||||
= smart_listing_render :dossiers
|
||||
|
||||
= render partial: 'state_description', locals: { liste: @liste }
|
|
@ -1,2 +0,0 @@
|
|||
<%= smart_listing_update :dossiers %>
|
||||
link_init();
|
|
@ -125,7 +125,11 @@ Rails.application.routes.draw do
|
|||
|
||||
get 'text_summary' => 'dossiers#text_summary'
|
||||
end
|
||||
resource :dossiers
|
||||
|
||||
resource 'dossiers'
|
||||
|
||||
# Redirection of legacy "/users/dossiers" route to "/dossiers"
|
||||
get 'dossiers', to: redirect('/dossiers')
|
||||
end
|
||||
|
||||
namespace :gestionnaire do
|
||||
|
|
|
@ -427,84 +427,6 @@ describe Users::DossiersController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'GET #a_traiter' do
|
||||
context 'when user is connected' do
|
||||
before do
|
||||
sign_in user
|
||||
end
|
||||
|
||||
it 'returns http success' do
|
||||
get :index, params: { liste: :a_traiter }
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #en_instruction' do
|
||||
context 'when user is connected' do
|
||||
before do
|
||||
sign_in user
|
||||
end
|
||||
|
||||
it 'returns http success' do
|
||||
get :index, params: { liste: :en_instruction }
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #brouillon' do
|
||||
context 'when user is connected' do
|
||||
before do
|
||||
sign_in user
|
||||
end
|
||||
|
||||
it 'returns http success' do
|
||||
get :index, params: { liste: :brouillon }
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #termine' do
|
||||
context 'when user is connected' do
|
||||
before do
|
||||
sign_in user
|
||||
end
|
||||
|
||||
it 'returns http success' do
|
||||
get :index, params: { liste: :termine }
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #invite' do
|
||||
context 'when user is connected' do
|
||||
before do
|
||||
sign_in user
|
||||
end
|
||||
|
||||
it 'returns http success' do
|
||||
get :index, params: { liste: :invite }
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #list_fake' do
|
||||
context 'when user is connected' do
|
||||
before do
|
||||
sign_in user
|
||||
end
|
||||
|
||||
it 'returns http success' do
|
||||
get :index, params: { liste: :list_fake }
|
||||
expect(response).to redirect_to(users_dossiers_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'Get #text_summary' do
|
||||
let!(:dossier) { create(:dossier, procedure: procedure) }
|
||||
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
feature 'As a User I want to sort and paginate dossiers', js: true do
|
||||
let(:user) { create(:user) }
|
||||
let(:procedure_for_individual) { create(:procedure, :published, :for_individual, ask_birthday: true) }
|
||||
|
||||
before "Create dossier" do
|
||||
login_as user, scope: :user
|
||||
|
||||
50.times do
|
||||
Dossier.create(procedure_id: procedure_for_individual.id, user_id: user.id, state: "en_construction")
|
||||
end
|
||||
|
||||
visit root_path
|
||||
end
|
||||
|
||||
context 'After sign_in, I can see my 51 dossiers on the index' 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(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((user.dossiers.first.id + 49).to_s)
|
||||
expect(page.all(:css, '#dossiers-list tr')[2].text.split(" ").first).to eq((user.dossiers.first.id + 48).to_s)
|
||||
visit "/users/dossiers?dossiers_smart_listing[sort][id]=asc"
|
||||
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
|
||||
|
||||
# This test always fail with ajax timeout error...
|
||||
# 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(user.dossiers.first.id.to_s)
|
||||
# page.find('.next_page a').click
|
||||
# wait_for_ajax
|
||||
# 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').click
|
||||
# wait_for_ajax
|
||||
# expect(page.all(:css, '#dossiers-list tr')[1].text.split(" ").first).to eq((user.dossiers.first.id + 20).to_s)
|
||||
# page.find('.prev a').click
|
||||
# wait_for_ajax
|
||||
# page.find('.prev a').click
|
||||
# wait_for_ajax
|
||||
# expect(page.all(:css, '#dossiers-list tr')[1].text.split(" ").first).to eq((user.dossiers.first.id).to_s)
|
||||
# end
|
||||
end
|
||||
end
|
|
@ -1,65 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
feature 'on click on tabs button' do
|
||||
let(:user) { create :user }
|
||||
|
||||
let(:dossier_invite) { create(:dossier, :with_entreprise, user: create(:user), state: 'en_construction') }
|
||||
|
||||
before do
|
||||
create(:dossier, :with_entreprise, user: user, state: 'en_construction')
|
||||
create(:dossier, :with_entreprise, user: user, state: 'en_instruction')
|
||||
create(:dossier, :with_entreprise, user: user, state: 'accepte')
|
||||
create(:dossier, :with_entreprise, user: user, state: 'refuse')
|
||||
create(:dossier, :with_entreprise, user: user, state: 'sans_suite')
|
||||
|
||||
create :invite, dossier: dossier_invite, user: user
|
||||
|
||||
login_as user, scope: :user
|
||||
end
|
||||
|
||||
context 'when user is logged in' do
|
||||
context 'when he click on tabs en construction' do
|
||||
before do
|
||||
visit users_dossiers_url(liste: :a_traiter)
|
||||
page.click_on 'En construction 1'
|
||||
end
|
||||
|
||||
scenario 'it redirect to users dossier termine' do
|
||||
expect(page).to have_css('#users-index')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when he click on tabs en examen' do
|
||||
before do
|
||||
visit users_dossiers_url(liste: :en_instruction)
|
||||
page.click_on 'En instruction 1'
|
||||
end
|
||||
|
||||
scenario 'it redirect to users dossier termine' do
|
||||
expect(page).to have_css('#users-index')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when he click on tabs termine' do
|
||||
before do
|
||||
visit users_dossiers_url(liste: :termine)
|
||||
page.click_on 'Terminé 3'
|
||||
end
|
||||
|
||||
scenario 'it redirect to users dossier termine' do
|
||||
expect(page).to have_css('#users-index')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when he click on tabs invitation' do
|
||||
before do
|
||||
visit users_dossiers_url(liste: :invite)
|
||||
page.click_on 'Invitation 1'
|
||||
end
|
||||
|
||||
scenario 'it redirect to users dossier invites' do
|
||||
expect(page).to have_css('#users-index')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,93 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'users/dossiers/index.html.haml', type: :view do
|
||||
let(:user) { create(:user) }
|
||||
|
||||
let!(:decorate_dossier_en_construction) { create(:dossier, :with_entreprise, user: user, state: 'en_construction').decorate }
|
||||
let!(:decorate_dossier_en_instruction) { create(:dossier, :with_entreprise, user: user, state: 'en_instruction').decorate }
|
||||
let!(:decorate_dossier_accepte) { create(:dossier, :with_entreprise, user: user, state: 'accepte').decorate }
|
||||
let!(:decorate_dossier_refuse) { create(:dossier, :with_entreprise, user: user, state: 'refuse').decorate }
|
||||
let!(:decorate_dossier_sans_suite) { create(:dossier, :with_entreprise, user: user, state: 'sans_suite').decorate }
|
||||
let!(:decorate_dossier_invite) { create(:dossier, :with_entreprise, user: create(:user), state: 'en_construction').decorate }
|
||||
|
||||
before do
|
||||
create :invite, dossier: decorate_dossier_invite, user: user
|
||||
end
|
||||
|
||||
shared_examples 'check_tab_content' do
|
||||
before do
|
||||
sign_in user
|
||||
|
||||
assign(:dossiers, (smart_listing_create :dossiers,
|
||||
dossiers_to_display,
|
||||
partial: "users/dossiers/list",
|
||||
array: true))
|
||||
render
|
||||
end
|
||||
|
||||
subject { rendered }
|
||||
|
||||
it 'displays the total count' do
|
||||
expect(dossiers_to_display.count).to eq total_dossiers
|
||||
end
|
||||
|
||||
it 'displays data in columns' do
|
||||
expect(rendered).to have_content(decorate_dossier_at_check.id)
|
||||
expect(rendered).to have_content(decorate_dossier_at_check.procedure.libelle)
|
||||
expect(rendered).to have_content(decorate_dossier_at_check.display_state)
|
||||
expect(rendered).to have_content(decorate_dossier_at_check.last_update)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'on tab en construction' do
|
||||
let(:total_dossiers) { 1 }
|
||||
let(:active_class) { '.active .text-danger' }
|
||||
let(:dossiers_to_display) { user.dossiers.state_en_construction }
|
||||
let(:liste) { 'a_traiter' }
|
||||
|
||||
it_behaves_like 'check_tab_content' do
|
||||
let(:decorate_dossier_at_check) { decorate_dossier_en_construction }
|
||||
end
|
||||
end
|
||||
|
||||
describe 'on tab etude en examen' do
|
||||
let(:total_dossiers) { 1 }
|
||||
let(:active_class) { '.active .text-default' }
|
||||
let(:dossiers_to_display) { user.dossiers.state_en_instruction }
|
||||
let(:liste) { 'en_instruction' }
|
||||
|
||||
it_behaves_like 'check_tab_content' do
|
||||
let(:decorate_dossier_at_check) { decorate_dossier_en_instruction }
|
||||
end
|
||||
end
|
||||
|
||||
describe 'on tab etude termine' do
|
||||
let(:total_dossiers) { 3 }
|
||||
let(:active_class) { '.active .text-success' }
|
||||
let(:dossiers_to_display) { user.dossiers.state_termine }
|
||||
let(:liste) { 'termine' }
|
||||
|
||||
it_behaves_like 'check_tab_content' do
|
||||
let(:decorate_dossier_at_check) { decorate_dossier_accepte }
|
||||
end
|
||||
|
||||
it_behaves_like 'check_tab_content' do
|
||||
let(:decorate_dossier_at_check) { decorate_dossier_refuse }
|
||||
end
|
||||
|
||||
it_behaves_like 'check_tab_content' do
|
||||
let(:decorate_dossier_at_check) { decorate_dossier_sans_suite }
|
||||
end
|
||||
end
|
||||
|
||||
describe 'on tab etude invite' do
|
||||
let(:total_dossiers) { 1 }
|
||||
let(:active_class) { '.active .text-warning' }
|
||||
let(:dossiers_to_display) { user.invites }
|
||||
let(:liste) { 'invite' }
|
||||
|
||||
it_behaves_like 'check_tab_content' do
|
||||
let(:decorate_dossier_at_check) { decorate_dossier_invite }
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue