From 88d46594e9bf1ae156fa64d0975a1dda0b1562c6 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Thu, 29 Mar 2018 10:33:57 +0200 Subject: [PATCH 1/3] Dossier status: move partial dans shared --- app/views/new_gestionnaire/procedures/show.html.haml | 2 +- app/views/new_gestionnaire/recherche/index.html.haml | 2 +- .../procedures => shared/dossiers}/_status.html.haml | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename app/views/{new_gestionnaire/procedures => shared/dossiers}/_status.html.haml (100%) diff --git a/app/views/new_gestionnaire/procedures/show.html.haml b/app/views/new_gestionnaire/procedures/show.html.haml index 01d9b34bb..e8a25a443 100644 --- a/app/views/new_gestionnaire/procedures/show.html.haml +++ b/app/views/new_gestionnaire/procedures/show.html.haml @@ -110,7 +110,7 @@ %td.status-col = link_to(gestionnaire_dossier_path(@procedure, dossier), class: 'cell-link') do - = render partial: 'status', locals: { dossier: dossier } + = render partial: 'shared/dossiers/status', locals: { dossier: dossier } %td.follow-col= render partial: 'dossier_actions', locals: { procedure: @procedure, dossier: dossier, dossier_is_followed: @followed_dossiers_id.include?(dossier.id) } = paginate @dossiers - else diff --git a/app/views/new_gestionnaire/recherche/index.html.haml b/app/views/new_gestionnaire/recherche/index.html.haml index ccd7f4f45..e34f419f0 100644 --- a/app/views/new_gestionnaire/recherche/index.html.haml +++ b/app/views/new_gestionnaire/recherche/index.html.haml @@ -29,6 +29,6 @@ %td= link_to(dossier.user.email, dossier_linked_path(current_gestionnaire, dossier), class: 'cell-link') %td.status-col = link_to(dossier_linked_path(current_gestionnaire, dossier), class: 'cell-link') do - = render partial: 'new_gestionnaire/procedures/status', locals: { dossier: dossier } + = render partial: 'shared/dossiers/status', locals: { dossier: dossier } - else %h2 Aucun dossier correspondant à votre recherche n'a été trouvé diff --git a/app/views/new_gestionnaire/procedures/_status.html.haml b/app/views/shared/dossiers/_status.html.haml similarity index 100% rename from app/views/new_gestionnaire/procedures/_status.html.haml rename to app/views/shared/dossiers/_status.html.haml From 48ddb4cfb6546b7db544f2bf82e782825bd83e22 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Thu, 29 Mar 2018 10:39:43 +0200 Subject: [PATCH 2/3] Dossier status: add brouillon label --- app/views/root/patron.html.haml | 1 + app/views/shared/dossiers/_status.html.haml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/app/views/root/patron.html.haml b/app/views/root/patron.html.haml index 9fb3df1c8..21ef9951e 100644 --- a/app/views/root/patron.html.haml +++ b/app/views/root/patron.html.haml @@ -60,6 +60,7 @@ %h1 Labels %span.label .label + %span.label.brouillon .label.brouillon %span.label.instruction .label.instruction %span.label.construction .label.construction %span.label.accepted .label.accepted diff --git a/app/views/shared/dossiers/_status.html.haml b/app/views/shared/dossiers/_status.html.haml index 6cdbc1601..89ec7d002 100644 --- a/app/views/shared/dossiers/_status.html.haml +++ b/app/views/shared/dossiers/_status.html.haml @@ -1,3 +1,5 @@ +- if dossier.brouillon? + %span.label.brouillon brouillon - if dossier.en_instruction? %span.label.instruction en instruction - elsif dossier.en_construction? From b2f04e250314e4bf14ea4806e221ad7cc1c3b3a9 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 28 Mar 2018 15:02:37 +0200 Subject: [PATCH 3/3] Usager UI: simple dossier index --- .../new_design/dossiers_table.scss | 4 +++ .../new_user/dossiers_controller.rb | 6 +++- app/views/new_user/dossiers/index.html.haml | 31 +++++++++++++++++++ config/routes.rb | 2 +- 4 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 app/views/new_user/dossiers/index.html.haml diff --git a/app/assets/stylesheets/new_design/dossiers_table.scss b/app/assets/stylesheets/new_design/dossiers_table.scss index a01a7b8a9..b3cd92a4e 100644 --- a/app/assets/stylesheets/new_design/dossiers_table.scss +++ b/app/assets/stylesheets/new_design/dossiers_table.scss @@ -66,6 +66,10 @@ } } + .updated-at-col { + width: 110px; + } + .follow-col { width: 200px; text-align: right; diff --git a/app/controllers/new_user/dossiers_controller.rb b/app/controllers/new_user/dossiers_controller.rb index ba2b4ee39..acba445b2 100644 --- a/app/controllers/new_user/dossiers_controller.rb +++ b/app/controllers/new_user/dossiers_controller.rb @@ -1,6 +1,6 @@ module NewUser class DossiersController < UserController - before_action :ensure_ownership! + before_action :ensure_ownership!, except: [:index] def attestation send_data(dossier.attestation.pdf.read, filename: 'attestation.pdf', type: 'application/pdf') @@ -83,6 +83,10 @@ module NewUser @dossier = current_user.dossiers.includes(:procedure).find(params[:id]) end + def index + @dossiers = current_user.dossiers.includes(:procedure).page([params[:page].to_i, 1].max) + end + private # FIXME: require(:dossier) when all the champs are united diff --git a/app/views/new_user/dossiers/index.html.haml b/app/views/new_user/dossiers/index.html.haml new file mode 100644 index 000000000..2c18b9d7f --- /dev/null +++ b/app/views/new_user/dossiers/index.html.haml @@ -0,0 +1,31 @@ +.container + %h1.page-title Mes dossiers + + %table.table.dossiers-table.hoverable + %thead + %tr + %th + %th.number-col Nº dossier + %th Procédure + %th.status-col Statut + %th.updated-at-col Mis à jour + %tbody + - @dossiers.each do |dossier| + %tr + %td.folder-col + = link_to(modifier_dossier_path(dossier), class: 'cell-link') do + %span.icon.folder + %td.number-col + = link_to(modifier_dossier_path(dossier), class: 'cell-link') do + = dossier.id + %td + = link_to(modifier_dossier_path(dossier), class: 'cell-link') do + = dossier.procedure.libelle + %td.status-col + = link_to(modifier_dossier_path(dossier), class: 'cell-link') do + = render partial: 'shared/dossiers/status', locals: { dossier: dossier } + %td.updated-at-col + = link_to(modifier_dossier_path(dossier), class: 'cell-link') do + = dossier.updated_at.localtime.strftime("%d/%m/%Y") + + = paginate(@dossiers) diff --git a/config/routes.rb b/config/routes.rb index ce989a7fe..b2cb6bea7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -206,7 +206,7 @@ Rails.application.routes.draw do get "patron" => "root#patron" scope module: 'new_user' do - resources :dossiers, only: [:update] do + resources :dossiers, only: [:index, :update] do member do get 'identite' patch 'update_identite'