From b2f04e250314e4bf14ea4806e221ad7cc1c3b3a9 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 28 Mar 2018 15:02:37 +0200 Subject: [PATCH] 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'