refactor _new_header so that user and instructeur search share similar signature

This commit is contained in:
clemkeirua 2020-04-03 15:06:27 +02:00
parent 695fd13e77
commit 34188c432c
3 changed files with 6 additions and 5 deletions

View file

@ -219,7 +219,7 @@ module Users
end end
def recherche def recherche
@dossier_id = params[:dossier_id] @dossier_id = params[:q]
dossier = current_user.dossiers.find_by(id: @dossier_id) dossier = current_user.dossiers.find_by(id: @dossier_id)
if dossier if dossier

View file

@ -47,16 +47,17 @@
%li %li
.header-search{ role: 'search' } .header-search{ role: 'search' }
= form_tag instructeur_recherche_path, method: :get, class: "form" do = form_tag instructeur_recherche_path, method: :get, class: "form" do
= label_tag :dossier_id, "Numéro de dossier", class: 'hidden'
= text_field_tag "q", "#{@search_terms if @search_terms.present?}", placeholder: "Rechercher un dossier" = text_field_tag "q", "#{@search_terms if @search_terms.present?}", placeholder: "Rechercher un dossier"
%button{ title: "Rechercher" } %button{ title: "Rechercher" }
= image_tag "icons/search-blue.svg", alt: '' = image_tag "icons/search-blue.svg", alt: 'Rechercher', 'aria-hidden':'true'
- if nav_bar_profile == :user && user_signed_in? && current_user.dossiers.count > 2 - if nav_bar_profile == :user && user_signed_in? && current_user.dossiers.count > 2
%li %li
.header-search{ role: 'search' } .header-search{ role: 'search' }
= form_tag recherche_dossiers_path, method: :post, class: "form" do = form_tag recherche_dossiers_path, method: :get, class: "form" do
= label_tag :dossier_id, "Numéro de dossier", class: 'hidden' = label_tag :dossier_id, "Numéro de dossier", class: 'hidden'
= text_field_tag :dossier_id, "", placeholder: "Numéro de dossier" = text_field_tag "q", "#{@search_terms if @search_terms.present?}", placeholder: "Rechercher un dossier"
%button{ title: "Rechercher" } %button{ title: "Rechercher" }
= image_tag "icons/search-blue.svg", alt: 'Rechercher', 'aria-hidden':'true' = image_tag "icons/search-blue.svg", alt: 'Rechercher', 'aria-hidden':'true'

View file

@ -275,7 +275,7 @@ Rails.application.routes.draw do
end end
collection do collection do
post 'recherche' get 'recherche'
end end
end end
resource :feedback, only: [:create] resource :feedback, only: [:create]