From f76232301782dddcabbb42eb3903446c25894db9 Mon Sep 17 00:00:00 2001 From: Lisa Durand Date: Fri, 14 Apr 2023 16:24:50 +0200 Subject: [PATCH] change searchbar from header to dashboard for user --- app/views/layouts/_header.haml | 9 ++-- .../layouts/_search_dossiers_form.html.haml | 2 +- app/views/users/dossiers/index.html.haml | 47 +++++++++++-------- 3 files changed, 32 insertions(+), 26 deletions(-) diff --git a/app/views/layouts/_header.haml b/app/views/layouts/_header.haml index c447fad9e..f00aca282 100644 --- a/app/views/layouts/_header.haml +++ b/app/views/layouts/_header.haml @@ -60,16 +60,13 @@ - if params[:controller] == 'recherche' - = render partial: 'layouts/search_dossiers_form', locals: { search_endpoint: recherche_index_path } + = render partial: 'layouts/search_dossiers_form' - if is_instructeur_context - = render partial: 'layouts/search_dossiers_form', locals: { search_endpoint: recherche_index_path } + = render partial: 'layouts/search_dossiers_form' - if is_expert_context - = render partial: 'layouts/search_dossiers_form', locals: { search_endpoint: recherche_index_path } - - - if is_user_context && current_user.dossiers.count > 2 - = render partial: 'layouts/search_dossiers_form', locals: { search_endpoint: recherche_dossiers_path } + = render partial: 'layouts/search_dossiers_form' - has_header = [is_instructeur_context, is_expert_context, is_user_context] #burger-menu.fr-header__menu.fr-modal diff --git a/app/views/layouts/_search_dossiers_form.html.haml b/app/views/layouts/_search_dossiers_form.html.haml index 9d0a0a7ff..f0aab616e 100644 --- a/app/views/layouts/_search_dossiers_form.html.haml +++ b/app/views/layouts/_search_dossiers_form.html.haml @@ -2,7 +2,7 @@ .fr-container.fr-container-lg--fluid %button.fr-btn--close.fr-btn{ "aria-controls" => "search-modal", :title => t('close_modal', scope: [:layouts, :header]) }= t('close_modal', scope: [:layouts, :header]) #search-473.fr-search-bar.fr-search-bar--lg - = form_tag "#{search_endpoint}", method: :get, :role => "search", class: "flex width-100" do + = form_tag recherche_index_path, method: :get, :role => "search", class: "flex width-100" do = label_tag "q", t('views.users.dossiers.search.search_file'), class: 'fr-label' = text_field_tag "q", "#{@search_terms if @search_terms.present?}", placeholder: t('views.users.dossiers.search.search_file'), class: "fr-input" %button.fr-btn diff --git a/app/views/users/dossiers/index.html.haml b/app/views/users/dossiers/index.html.haml index d5db5b69c..f18d86231 100644 --- a/app/views/users/dossiers/index.html.haml +++ b/app/views/users/dossiers/index.html.haml @@ -8,12 +8,16 @@ .dossiers-headers.sub-header .container - - if @search_terms.present? - %h1.page-title Résultat de la recherche pour « #{@search_terms} » - = render partial: "dossiers_list", locals: { dossiers: @dossiers } + %h1.page-title= t('views.users.dossiers.index.dossiers') + - if current_user.dossiers.count > 2 + #search-2.fr-search-bar.fr-search-bar--lg{ role: "search", "aria-label": t('views.users.dossiers.search.search_file') } + = form_tag recherche_dossiers_path, method: :get, :role => "search", class: "flex width-100 fr-mb-5w" do + = label_tag "q", t('views.users.dossiers.search.search_file'), class: 'fr-label' + = text_field_tag "q", "#{@search_terms if @search_terms.present?}", placeholder: t('views.users.dossiers.search.search_file'), class: "fr-input" + %button.fr-btn + = t('views.users.dossiers.search.simple') - - else - %h1.page-title= t('views.users.dossiers.index.dossiers') + - if @search_terms.blank? %nav.tabs{ role: 'navigation', 'aria-label': t('views.users.dossiers.secondary_menu') } %ul - if @user_dossiers.present? @@ -59,23 +63,28 @@ badge: number_with_html_delimiter(@dossier_transfers.count)) .container - - if @statut == "en-cours" - = render partial: "dossiers_list", locals: { dossiers: @user_dossiers } + - if @search_terms.present? + %h2.page-title Résultat de la recherche pour « #{@search_terms} » + = render partial: "dossiers_list", locals: { dossiers: @dossiers } - - if @statut == "traites" - = render partial: "dossiers_list", locals: { dossiers: @dossiers_traites } + - else + - if @statut == "en-cours" + = render partial: "dossiers_list", locals: { dossiers: @user_dossiers } - - if @statut == "dossiers-invites" - = render partial: "dossiers_list", locals: { dossiers: @dossiers_invites } + - if @statut == "traites" + = render partial: "dossiers_list", locals: { dossiers: @dossiers_traites } - - if @statut == "dossiers-supprimes-recemment" - = render partial: "hidden_dossiers_list", locals: { hidden_dossiers: @dossiers_supprimes_recemment } + - if @statut == "dossiers-invites" + = render partial: "dossiers_list", locals: { dossiers: @dossiers_invites } - - if @statut == "dossiers-supprimes-definitivement" - = render partial: "deleted_dossiers_list", locals: { deleted_dossiers: @dossiers_supprimes_definitivement } + - if @statut == "dossiers-supprimes-recemment" + = render partial: "hidden_dossiers_list", locals: { hidden_dossiers: @dossiers_supprimes_recemment } - - if @statut == "dossiers-transferes" - = render partial: "transfered_dossiers_list", locals: { dossier_transfers: @dossier_transfers } + - if @statut == "dossiers-supprimes-definitivement" + = render partial: "deleted_dossiers_list", locals: { deleted_dossiers: @dossiers_supprimes_definitivement } - - if @statut == "dossiers-expirant" - = render partial: "dossiers_list", locals: { dossiers: @dossiers_close_to_expiration } + - if @statut == "dossiers-transferes" + = render partial: "transfered_dossiers_list", locals: { dossier_transfers: @dossier_transfers } + + - if @statut == "dossiers-expirant" + = render partial: "dossiers_list", locals: { dossiers: @dossiers_close_to_expiration }