Merge pull request #2576 from betagouv/demarches

Page de démarches disponibles
This commit is contained in:
gregoirenovel 2018-09-13 17:28:46 +02:00 committed by GitHub
commit c12ed49df4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 81 additions and 8 deletions

View 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;
}
}

View 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

View file

@ -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

View 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")

View file

@ -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 navez pas encore commencé de démarche. %p.empty-text-details Vous navez 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"

View file

@ -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
# #