From 53b0b9ee63c95a6c25b0fe84010237ceb6ba905b Mon Sep 17 00:00:00 2001 From: Xavier J Date: Mon, 28 Nov 2016 16:49:50 +0100 Subject: [PATCH] Fix bug right preference panel --- app/controllers/backoffice/dossiers/procedure_controller.rb | 1 - app/controllers/backoffice/dossiers_controller.rb | 1 - app/controllers/backoffice/dossiers_list_controller.rb | 2 +- .../backoffice/preference_list_dossier_controller.rb | 4 ++-- app/views/backoffice/dossiers/_filter_framed.html.haml | 2 +- app/views/backoffice/dossiers/_list.html.haml | 6 +++--- app/views/backoffice/dossiers/_pref_list.html.haml | 6 +++--- app/views/backoffice/dossiers/index.html.haml | 4 ++-- app/views/backoffice/dossiers/index.js.erb | 6 +++--- app/views/backoffice/dossiers/search.js.erb | 4 +++- app/views/dossiers/_download_dossiers.html.haml | 2 +- ...left_panel_backoffice_dossierscontroller_index.html.haml | 2 +- 12 files changed, 20 insertions(+), 20 deletions(-) diff --git a/app/controllers/backoffice/dossiers/procedure_controller.rb b/app/controllers/backoffice/dossiers/procedure_controller.rb index b0044dfba..74b092f43 100644 --- a/app/controllers/backoffice/dossiers/procedure_controller.rb +++ b/app/controllers/backoffice/dossiers/procedure_controller.rb @@ -4,7 +4,6 @@ class Backoffice::Dossiers::ProcedureController < Backoffice::DossiersListContro super dossiers_list_facade.service.filter_procedure! params[:id] - @facade_data_view = dossiers_list_facade render 'backoffice/dossiers/index' rescue ActiveRecord::RecordNotFound diff --git a/app/controllers/backoffice/dossiers_controller.rb b/app/controllers/backoffice/dossiers_controller.rb index c6f63f321..8ca61ad15 100644 --- a/app/controllers/backoffice/dossiers_controller.rb +++ b/app/controllers/backoffice/dossiers_controller.rb @@ -123,7 +123,6 @@ class Backoffice::DossiersController < Backoffice::DossiersListController @liste = cookies[:liste] || 'a_traiter' end - dossiers_list_facade @liste smartlisting_dossier render 'backoffice/dossiers/index', formats: :js diff --git a/app/controllers/backoffice/dossiers_list_controller.rb b/app/controllers/backoffice/dossiers_list_controller.rb index ff69a816c..e1057caba 100644 --- a/app/controllers/backoffice/dossiers_list_controller.rb +++ b/app/controllers/backoffice/dossiers_list_controller.rb @@ -25,7 +25,7 @@ class Backoffice::DossiersListController < ApplicationController end def dossiers_list_facade liste='a_traiter' - @dossiers_list_facade ||= DossiersListFacades.new current_gestionnaire, liste, retrieve_procedure + @facade_data_view ||= DossiersListFacades.new current_gestionnaire, liste, retrieve_procedure end def smartlisting_dossier dossiers_list=nil, liste='a_traiter' diff --git a/app/controllers/backoffice/preference_list_dossier_controller.rb b/app/controllers/backoffice/preference_list_dossier_controller.rb index 645ddc049..39ddba55d 100644 --- a/app/controllers/backoffice/preference_list_dossier_controller.rb +++ b/app/controllers/backoffice/preference_list_dossier_controller.rb @@ -1,4 +1,4 @@ -class Backoffice::PreferenceListDossierController < ApplicationController +class Backoffice::PreferenceListDossierController < Backoffice::DossiersListController include SmartListing::Helper::ControllerExtensions helper SmartListing::Helper @@ -22,7 +22,7 @@ class Backoffice::PreferenceListDossierController < ApplicationController end def reload_pref_list - @dossiers_list_facade = DossiersListFacades.new current_gestionnaire, '', retrieve_procedure + dossiers_list_facade render partial: 'backoffice/dossiers/pref_list', id: params_procedure_id end diff --git a/app/views/backoffice/dossiers/_filter_framed.html.haml b/app/views/backoffice/dossiers/_filter_framed.html.haml index 35c60c7f8..5e8337870 100644 --- a/app/views/backoffice/dossiers/_filter_framed.html.haml +++ b/app/views/backoffice/dossiers/_filter_framed.html.haml @@ -2,7 +2,7 @@ .panel-heading = preference.libelle - =form_tag @dossiers_list_facade.filter_url, {class: 'panel-body form-inline', method: :post} do + =form_tag @facade_data_view.filter_url, {class: 'panel-body form-inline', method: :post} do %input.form-control.filter_input{name: "filter_input[#{preference.table_attr}]", style:'width: 69%', value: "#{preference.filter}"} %button.btn.btn-sm.btn-success %i.fa.fa-check diff --git a/app/views/backoffice/dossiers/_list.html.haml b/app/views/backoffice/dossiers/_list.html.haml index d39f50987..62b28e426 100644 --- a/app/views/backoffice/dossiers/_list.html.haml +++ b/app/views/backoffice/dossiers/_list.html.haml @@ -1,12 +1,12 @@ %table#dossiers_list.table %thead - - @dossiers_list_facade.preference_list_dossiers_filter.each do |preference| + - @facade_data_view.preference_list_dossiers_filter.each do |preference| %th{class: "col-md-#{preference.bootstrap_lg} col-lg-#{preference.bootstrap_lg}"} - if preference.table.to_s.include? 'champs' = preference.libelle -else = smart_listing.sortable preference.libelle, preference.table_attr - - if @dossiers_list_facade.active_filter? preference + - if @facade_data_view.active_filter? preference %i.filter.fa.fa-filter{style: "cursor: pointer; margin-left:3px; font-size: 1.1em; color:#{(preference.filter.blank? ? 'grey' : 'orange')}", id: "filter_#{smart_listing.name.to_s}_#{preference.table_attr.sub('.', '_')}"} = render partial: 'backoffice/dossiers/filter_framed', locals:{preference: preference, filter_framed_id: "framed_filter_#{smart_listing.name.to_s}_#{preference.table_attr.sub('.', '_')}"} @@ -16,7 +16,7 @@ - unless smart_listing.empty? - smart_listing.collection.each do |dossier| %tr{id: "tr_dossier_#{dossier.id}", 'data-dossier_url' => backoffice_dossier_url(id: dossier.id)} - - @dossiers_list_facade.preference_list_dossiers_filter.each_with_index do |preference, index| + - @facade_data_view.preference_list_dossiers_filter.each_with_index do |preference, index| %td - if preference.table.nil? || preference.table.empty? - value = dossier.decorate.public_send(preference.attr_decorate) diff --git a/app/views/backoffice/dossiers/_pref_list.html.haml b/app/views/backoffice/dossiers/_pref_list.html.haml index 310852807..0cb0f9d1e 100644 --- a/app/views/backoffice/dossiers/_pref_list.html.haml +++ b/app/views/backoffice/dossiers/_pref_list.html.haml @@ -10,7 +10,7 @@ Actuelles %ul - - @dossiers_list_facade.preference_list_dossiers_filter.each_with_index do |preference, index| + - @facade_data_view.preference_list_dossiers_filter.each_with_index do |preference, index| %li = form_tag backoffice_preference_list_dossier_delete_path, method: :delete, remote: true do = hidden_field_tag :pref_id, preference.id @@ -23,7 +23,7 @@ Disponibles %table - - PreferenceListDossier.available_columns_for(@dossiers_list_facade.procedure_id).each_with_index do |tables, index| + - PreferenceListDossier.available_columns_for(@facade_data_view.procedure_id).each_with_index do |tables, index| - if index%2 == 0 || tables.first.to_s.include?('champs') %tr @@ -38,7 +38,7 @@ = hidden_field_tag :attr, columns.second[:attr] = hidden_field_tag :attr_decorate, columns.second[:attr_decorate] = hidden_field_tag :bootstrap_lg, columns.second[:bootstrap_lg] - = hidden_field_tag :procedure_id, @dossiers_list_facade.procedure_id + = hidden_field_tag :procedure_id, @facade_data_view.procedure_id = columns.second[:libelle] %button.btn.btn-default.btn-xs{type: :submit, id: "add_pref_list_#{columns.second[:table]}_#{columns.second[:attr]}"} diff --git a/app/views/backoffice/dossiers/index.html.haml b/app/views/backoffice/dossiers/index.html.haml index 70cc0c4cf..99603e885 100644 --- a/app/views/backoffice/dossiers/index.html.haml +++ b/app/views/backoffice/dossiers/index.html.haml @@ -23,7 +23,7 @@ %div.carret-down Dossiers suivis %div.col-lg-2.col-md-2.count - =@dossiers_list_facade.suivi_total + =@facade_data_view.suivi_total dossiers %div.body = smart_listing_render :follow_dossiers @@ -36,7 +36,7 @@ %div.carret-down Tous les dossiers %div.col-lg-2.col-md-2.count - =@dossiers_list_facade.all_state_total + =@facade_data_view.all_state_total dossiers %div.body = smart_listing_render :all_state_dossiers diff --git a/app/views/backoffice/dossiers/index.js.erb b/app/views/backoffice/dossiers/index.js.erb index 98e47f14e..14108f49a 100644 --- a/app/views/backoffice/dossiers/index.js.erb +++ b/app/views/backoffice/dossiers/index.js.erb @@ -1,6 +1,6 @@ -<%= smart_listing_update :new_dossiers %> -<%= smart_listing_update :follow_dossiers %> -<%= smart_listing_update :all_state_dossiers %> +<%= smart_listing_update :new_dossiers, {force: true} %> +<%= smart_listing_update :follow_dossiers, {force: true} %> +<%= smart_listing_update :all_state_dossiers, {force: true} %> filters_init(); link_init(); \ No newline at end of file diff --git a/app/views/backoffice/dossiers/search.js.erb b/app/views/backoffice/dossiers/search.js.erb index 0f7d43419..daf0cda6b 100644 --- a/app/views/backoffice/dossiers/search.js.erb +++ b/app/views/backoffice/dossiers/search.js.erb @@ -1,3 +1,5 @@ -<%= smart_listing_update :dossiers %> +<%= smart_listing_update :new_dossiers %> +<%= smart_listing_update :follow_dossiers %> +<%= smart_listing_update :all_state_dossiers %> filters_init(); \ No newline at end of file diff --git a/app/views/dossiers/_download_dossiers.html.haml b/app/views/dossiers/_download_dossiers.html.haml index 781a641ba..088f18dca 100644 --- a/app/views/dossiers/_download_dossiers.html.haml +++ b/app/views/dossiers/_download_dossiers.html.haml @@ -1,5 +1,5 @@ %div.dropdown.pull-right#download-menu - - if @dossiers_list_facade.dossiers_to_display.count > 400 + - if @facade_data_view.dossiers_to_display.count > 400 %button.btn.btn-error.dropdown-toggle#dropdownDownloadMenu{ type: :button, 'data-toggle' => 'dropdown', 'aria-haspopup' => true, 'aria-expanded' => false, class: 'disabled'} %span{'data-toggle' => :tooltip, "data-placement" => :left, title: 'Pour réduire le nombre de dossiers et ne pas dépasser la limite autorisée de 400, merci de bien vouloir appliquer des filtres.'} = t('dynamics.backoffice.limit_excess_download_all_dossiers') diff --git a/app/views/layouts/left_panels/_left_panel_backoffice_dossierscontroller_index.html.haml b/app/views/layouts/left_panels/_left_panel_backoffice_dossierscontroller_index.html.haml index f17a03236..19eb2f79d 100644 --- a/app/views/layouts/left_panels/_left_panel_backoffice_dossierscontroller_index.html.haml +++ b/app/views/layouts/left_panels/_left_panel_backoffice_dossierscontroller_index.html.haml @@ -20,7 +20,7 @@ %div#infos-block #procedure_list %div.procedure_list_element - - @dossiers_list_facade.gestionnaire_procedures_name_and_id_list.each do |procedure| + - @facade_data_view.gestionnaire_procedures_name_and_id_list.each do |procedure| %div.procedure_list_element =link_to truncate(procedure[:libelle], {length: 50}), backoffice_dossiers_procedure_path(procedure[:id]),{title: procedure[:libelle]}