From 9fe9f9b6167c901e19479f2a39a7921728ad7ae9 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Thu, 13 Sep 2018 16:13:54 +0200 Subject: [PATCH] Add a new demarches page, showing the demarches already done --- .../new_design/demarches_index.scss | 28 +++++++++++++++++++ .../new_user/demarches_controller.rb | 12 ++++++++ app/views/new_user/demarches/index.html.haml | 11 ++++++++ config/routes.rb | 1 + 4 files changed, 52 insertions(+) create mode 100644 app/assets/stylesheets/new_design/demarches_index.scss create mode 100644 app/controllers/new_user/demarches_controller.rb create mode 100644 app/views/new_user/demarches/index.html.haml diff --git a/app/assets/stylesheets/new_design/demarches_index.scss b/app/assets/stylesheets/new_design/demarches_index.scss new file mode 100644 index 000000000..62e8123bb --- /dev/null +++ b/app/assets/stylesheets/new_design/demarches_index.scss @@ -0,0 +1,28 @@ +@import "colors"; + +.page-title { + margin-top: 30px; + margin-bottom: 30px; +} + +.list-header { + color: $grey; + font-weight: bold; + margin-bottom: 10px; +} + +.demarche-links { + border-top: 1px solid $border-grey; + margin-bottom: 30px; +} + +.demarche-link { + display: block; + padding: 10px; + border-bottom: 1px solid $border-grey; + width: 100%; + + &:hover { + background-color: $lighter-blue; + } +} diff --git a/app/controllers/new_user/demarches_controller.rb b/app/controllers/new_user/demarches_controller.rb new file mode 100644 index 000000000..29b0a85c9 --- /dev/null +++ b/app/controllers/new_user/demarches_controller.rb @@ -0,0 +1,12 @@ +module NewUser + class DemarchesController < UserController + def index + @previous_demarches_still_active = current_user + .dossiers + .includes(:procedure) + .map(&:procedure) + .uniq + .select { |p| p.publiee? } + end + end +end diff --git a/app/views/new_user/demarches/index.html.haml b/app/views/new_user/demarches/index.html.haml new file mode 100644 index 000000000..2fc77c73e --- /dev/null +++ b/app/views/new_user/demarches/index.html.haml @@ -0,0 +1,11 @@ +- content_for(:title, "Démarches") + +.container + %h1.page-title Démarches + + - if @previous_demarches_still_active.present? + %h2.list-header SUR LESQUELLES VOUS AVEZ DÉJÀ DÉPOSÉ UN DOSSIER + %ul.demarche-links + - @previous_demarches_still_active.each do |demarche| + %li + = link_to(demarche.libelle, commencer_url(procedure_path: demarche.path), class: "demarche-link") diff --git a/config/routes.rb b/config/routes.rb index 12b5dab91..4651f88bd 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -292,6 +292,7 @@ Rails.application.routes.draw do end end resource :feedback, only: [:create] + get 'demarches' => 'demarches#index' end #