Merge pull request #2576 from betagouv/demarches
Page de démarches disponibles
This commit is contained in:
commit
c12ed49df4
6 changed files with 81 additions and 8 deletions
32
app/assets/stylesheets/new_design/demarches_index.scss
Normal file
32
app/assets/stylesheets/new_design/demarches_index.scss
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
@import "colors";
|
||||||
|
|
||||||
|
#demarches-index {
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.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;
|
||||||
|
}
|
||||||
|
}
|
21
app/controllers/new_user/demarches_controller.rb
Normal file
21
app/controllers/new_user/demarches_controller.rb
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
module NewUser
|
||||||
|
class DemarchesController < UserController
|
||||||
|
def index
|
||||||
|
@previous_demarches_still_active = current_user
|
||||||
|
.dossiers
|
||||||
|
.includes(:procedure)
|
||||||
|
.map(&:procedure)
|
||||||
|
.uniq
|
||||||
|
.select { |p| p.publiee? }
|
||||||
|
|
||||||
|
@popular_demarches = Procedure
|
||||||
|
.select("procedures.*, COUNT(*) AS procedures_count")
|
||||||
|
.joins(:dossiers)
|
||||||
|
.publiees
|
||||||
|
.where(dossiers: { created_at: 7.days.ago..Time.now })
|
||||||
|
.group("procedures.id")
|
||||||
|
.order("procedures_count DESC")
|
||||||
|
.limit(5)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -2,8 +2,6 @@ module NewUser
|
||||||
class DossiersController < UserController
|
class DossiersController < UserController
|
||||||
include DossierHelper
|
include DossierHelper
|
||||||
|
|
||||||
helper_method :new_demarche_url
|
|
||||||
|
|
||||||
before_action :ensure_ownership!, except: [:index, :show, :demande, :messagerie, :brouillon, :update_brouillon, :modifier, :update, :recherche]
|
before_action :ensure_ownership!, except: [:index, :show, :demande, :messagerie, :brouillon, :update_brouillon, :modifier, :update, :recherche]
|
||||||
before_action :ensure_ownership_or_invitation!, only: [:show, :demande, :messagerie, :brouillon, :update_brouillon, :modifier, :update, :create_commentaire]
|
before_action :ensure_ownership_or_invitation!, only: [:show, :demande, :messagerie, :brouillon, :update_brouillon, :modifier, :update, :create_commentaire]
|
||||||
before_action :ensure_dossier_can_be_updated, only: [:update_identite, :update_brouillon, :modifier, :update]
|
before_action :ensure_dossier_can_be_updated, only: [:update_identite, :update_brouillon, :modifier, :update]
|
||||||
|
@ -177,10 +175,6 @@ module NewUser
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def new_demarche_url
|
|
||||||
"https://doc.demarches-simplifiees.fr/listes-des-demarches"
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def ensure_dossier_can_be_updated
|
def ensure_dossier_can_be_updated
|
||||||
|
|
25
app/views/new_user/demarches/index.html.haml
Normal file
25
app/views/new_user/demarches/index.html.haml
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
- content_for(:title, "Démarches")
|
||||||
|
|
||||||
|
- content_for :footer do
|
||||||
|
= render partial: "new_user/dossiers/index_footer"
|
||||||
|
|
||||||
|
#demarches-index
|
||||||
|
.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")
|
||||||
|
|
||||||
|
- if @popular_demarches.present?
|
||||||
|
%h2.list-header LES PLUS POPULAIRES
|
||||||
|
%ul.demarche-links
|
||||||
|
- @popular_demarches.each do |demarche|
|
||||||
|
%li
|
||||||
|
= link_to(demarche.libelle, commencer_url(procedure_path: demarche.path), class: "demarche-link")
|
||||||
|
|
||||||
|
%h2.list-header TOUTES LES DÉMARCHES
|
||||||
|
= link_to("Voir l'intégralité des démarches disponibles", LISTE_DES_DEMARCHES_URL, class: "button")
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
.dossiers-headers.sub-header
|
.dossiers-headers.sub-header
|
||||||
.container
|
.container
|
||||||
= link_to "Commencer une nouvelle démarche", new_demarche_url, class: "button secondary new-demarche"
|
= link_to "Commencer une nouvelle démarche", demarches_url, class: "button secondary new-demarche"
|
||||||
|
|
||||||
- if @dossiers_invites.count == 0
|
- if @dossiers_invites.count == 0
|
||||||
%h1.page-title Mes dossiers
|
%h1.page-title Mes dossiers
|
||||||
|
@ -66,4 +66,4 @@
|
||||||
.dossiers-table-empty
|
.dossiers-table-empty
|
||||||
%h2.empty-text Aucun dossier.
|
%h2.empty-text Aucun dossier.
|
||||||
%p.empty-text-details Vous n’avez pas encore commencé de démarche.
|
%p.empty-text-details Vous n’avez pas encore commencé de démarche.
|
||||||
= link_to "Commencer une nouvelle démarche", new_demarche_url, class: "button primary"
|
= link_to "Commencer une nouvelle démarche", demarches_url, class: "button primary"
|
||||||
|
|
|
@ -292,6 +292,7 @@ Rails.application.routes.draw do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
resource :feedback, only: [:create]
|
resource :feedback, only: [:create]
|
||||||
|
get 'demarches' => 'demarches#index'
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in a new issue