From 96ca5113f7b62801674e417f70f9bada6ed4496e Mon Sep 17 00:00:00 2001 From: Julien Portalier Date: Mon, 14 Nov 2016 18:00:26 +0100 Subject: [PATCH 1/5] Flux de commentaires par champs --- .../javascripts/dossier_commentaires_modal.js | 13 +++++ app/controllers/commentaires_controller.rb | 13 +++++ app/facades/dossier_facades.rb | 15 ++++-- app/models/champ.rb | 1 + app/models/commentaire.rb | 1 + .../backoffice/commentaires/index.html.haml | 1 + app/views/dossiers/_infos_dossier.html.haml | 21 ++++++++ app/views/users/commentaires/index.html.haml | 1 + .../_commentaires_flux.html.haml | 2 +- config/routes.rb | 2 + ...1110082244_add_champ_id_to_commentaires.rb | 7 +++ db/schema.rb | 4 +- .../backoffice/flux_de_commentaires_spec.rb | 52 ++++++++++++++++++ .../users/flux_de_commentaires_spec.rb | 53 +++++++++++++++++++ 14 files changed, 181 insertions(+), 5 deletions(-) create mode 100644 app/assets/javascripts/dossier_commentaires_modal.js create mode 100644 app/views/backoffice/commentaires/index.html.haml create mode 100644 app/views/users/commentaires/index.html.haml create mode 100644 db/migrate/20161110082244_add_champ_id_to_commentaires.rb create mode 100644 spec/features/backoffice/flux_de_commentaires_spec.rb create mode 100644 spec/features/users/flux_de_commentaires_spec.rb diff --git a/app/assets/javascripts/dossier_commentaires_modal.js b/app/assets/javascripts/dossier_commentaires_modal.js new file mode 100644 index 000000000..d778412b9 --- /dev/null +++ b/app/assets/javascripts/dossier_commentaires_modal.js @@ -0,0 +1,13 @@ +$(document).ready(function () { + var modal = $("#modalCommentairesDossierParChamp"); + var body = modal.find(".modal-body"); + var originalBody = body.html(); + + modal.on("show.bs.modal", function (e) { + body.load(e.relatedTarget.getAttribute("data-href")); + }); + + $("#modalCommentairesDossierParChamp").on("hidden.bs.modal", function (e) { + body.html(originalBody); + }); +}); diff --git a/app/controllers/commentaires_controller.rb b/app/controllers/commentaires_controller.rb index bea003766..8a1ce41c8 100644 --- a/app/controllers/commentaires_controller.rb +++ b/app/controllers/commentaires_controller.rb @@ -1,7 +1,20 @@ class CommentairesController < ApplicationController + def index + @facade = DossierFacades.new( + params[:dossier_id], + (current_gestionnaire || current_user).email, + params[:champs_id] + ) + render layout: false + rescue ActiveRecord::RecordNotFound + flash.alert = t('errors.messages.dossier_not_found') + redirect_to url_for(controller: '/') + end + def create @commentaire = Commentaire.new @commentaire.dossier = Dossier.find(params['dossier_id']) + @commentaire.champ = @commentaire.dossier.champs.find(params[:champ_id]) if params[:champ_id] if is_gestionnaire? @commentaire.email = current_gestionnaire.email diff --git a/app/facades/dossier_facades.rb b/app/facades/dossier_facades.rb index 04ded4fd9..3dab2233d 100644 --- a/app/facades/dossier_facades.rb +++ b/app/facades/dossier_facades.rb @@ -1,9 +1,10 @@ class DossierFacades #TODO rechercher en fonction de la personne/email - def initialize dossier_id, email + def initialize(dossier_id, email, champ_id = nil) @dossier = Dossier.where(archived: false).find(dossier_id) @email = email + @champ_id = champ_id end def dossier @@ -26,8 +27,16 @@ class DossierFacades @dossier.ordered_pieces_justificatives end + def champ_id + @champ_id + end + def commentaires - @dossier.ordered_commentaires.all.decorate + if @champ_id + @dossier.ordered_commentaires.where(champ_id: @champ_id).decorate + else + @dossier.ordered_commentaires.all.decorate + end end def commentaire_email @@ -61,4 +70,4 @@ class DossierFacades def followers Gestionnaire.joins(:follows).where("follows.dossier_id=#{@dossier.id}") end -end \ No newline at end of file +end diff --git a/app/models/champ.rb b/app/models/champ.rb index cf4325b0e..f6ba23268 100644 --- a/app/models/champ.rb +++ b/app/models/champ.rb @@ -1,6 +1,7 @@ class Champ < ActiveRecord::Base belongs_to :dossier belongs_to :type_de_champ + has_many :commentaires delegate :libelle, :type_champ, :order_place, :mandatory, :description, :drop_down_list, to: :type_de_champ diff --git a/app/models/commentaire.rb b/app/models/commentaire.rb index 2283775d3..e59138ccb 100644 --- a/app/models/commentaire.rb +++ b/app/models/commentaire.rb @@ -1,5 +1,6 @@ class Commentaire < ActiveRecord::Base belongs_to :dossier + belongs_to :champ belongs_to :piece_justificative end diff --git a/app/views/backoffice/commentaires/index.html.haml b/app/views/backoffice/commentaires/index.html.haml new file mode 100644 index 000000000..a764a3e90 --- /dev/null +++ b/app/views/backoffice/commentaires/index.html.haml @@ -0,0 +1 @@ += render partial: '/users/recapitulatif/commentaires_flux' diff --git a/app/views/dossiers/_infos_dossier.html.haml b/app/views/dossiers/_infos_dossier.html.haml index c34efe26c..6d0bf1ef7 100644 --- a/app/views/dossiers/_infos_dossier.html.haml +++ b/app/views/dossiers/_infos_dossier.html.haml @@ -63,6 +63,12 @@ %tr %th{ style: 'width:25%' } =champ.libelle + -if gestionnaire_signed_in? + =link_to "COM", "", "data-href" => backoffice_dossier_commentaires_path(@facade.dossier, champs_id: champ.id), + "data-toggle" => "modal", "data-target" => "#modalCommentairesDossierParChamp" + -else + =link_to "COM", "", "data-href" => users_dossier_commentaires_path(@facade.dossier, champs_id: champ.id), + "data-toggle" => "modal", "data-target" => "#modalCommentairesDossierParChamp" %td -unless champ.decorate.value.blank? =champ.decorate.value.html_safe @@ -114,3 +120,18 @@ %button.action_button.btn.btn-warning %i.fa.fa-circle-o +#modalCommentairesDossierParChamp.modal.fade{"tabindex" => -1, "role" => "dialog"} + .modal-dialog{"role" => "document"} + .modal-content + .modal-header + %button.close{"data-dismiss" => "modal", "aria-label" => "Fermer"} + %span{"aria-hidden" => true} + × + .modal-title + Commentaires + .modal-body + %p + Chargement des commentaires en cours... + .modal-footer + %button.btn.btn-primary{"data-dismiss" => "modal"} + Fermer diff --git a/app/views/users/commentaires/index.html.haml b/app/views/users/commentaires/index.html.haml new file mode 100644 index 000000000..a764a3e90 --- /dev/null +++ b/app/views/users/commentaires/index.html.haml @@ -0,0 +1 @@ += render partial: '/users/recapitulatif/commentaires_flux' diff --git a/app/views/users/recapitulatif/_commentaires_flux.html.haml b/app/views/users/recapitulatif/_commentaires_flux.html.haml index ef9404be1..38202fb3e 100644 --- a/app/views/users/recapitulatif/_commentaires_flux.html.haml +++ b/app/views/users/recapitulatif/_commentaires_flux.html.haml @@ -1,6 +1,6 @@ .content#commentaires_flux{style:'width:100%;'} %div#commentaire_new{style: 'width:80%; margin-left:auto; margin-right:auto; margin-bottom:7%'} - = form_tag(url_for({ controller: 'commentaires', action: :create, dossier_id: @facade.dossier.id }), class: 'form-inline', method: 'POST', multipart: true) do + = form_tag(url_for({ controller: 'commentaires', action: :create, dossier_id: @facade.dossier.id, champ_id: @facade.champ_id }), class: 'form-inline', method: 'POST', multipart: true) do %textarea.form-control{id: 'texte_commentaire', class: 'wysihtml5', name: 'texte_commentaire', style: 'width: 100%; margin-bottom:2%', rows: '5', placeholder:"Commentaire"} %h4.text-primary{style: 'margin-top: 0px'} Ajout un fichier = file_field_tag "piece_justificative[content]", accept: PieceJustificative.accept_format, style: 'float: left; margin-left: 20px' diff --git a/config/routes.rb b/config/routes.rb index 744c3ea61..d9daff608 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -75,6 +75,7 @@ Rails.application.routes.draw do post '/recapitulatif/submit' => 'recapitulatif#submit' post '/commentaire' => 'commentaires#create' + resources :commentaires, only: [:index] get '/carte/position' => 'carte#get_position' post '/carte/qp' => 'carte#get_qp' @@ -162,6 +163,7 @@ Rails.application.routes.draw do post 'close' => 'dossiers#close' put 'follow' => 'dossiers#follow' + resources :commentaires, only: [:index] end diff --git a/db/migrate/20161110082244_add_champ_id_to_commentaires.rb b/db/migrate/20161110082244_add_champ_id_to_commentaires.rb new file mode 100644 index 000000000..1dfc9595f --- /dev/null +++ b/db/migrate/20161110082244_add_champ_id_to_commentaires.rb @@ -0,0 +1,7 @@ +class AddChampIdToCommentaires < ActiveRecord::Migration + def change + change_table :commentaires do |t| + t.references :champ, null: true, index: true + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 7ef1e735e..cdcfa6acf 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20161102154835) do +ActiveRecord::Schema.define(version: 20161110082244) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -112,8 +112,10 @@ ActiveRecord::Schema.define(version: 20161102154835) do t.integer "dossier_id" t.datetime "updated_at", null: false t.integer "piece_justificative_id" + t.integer "champ_id" end + add_index "commentaires", ["champ_id"], name: "index_commentaires_on_champ_id", using: :btree add_index "commentaires", ["dossier_id"], name: "index_commentaires_on_dossier_id", using: :btree create_table "dossiers", force: :cascade do |t| diff --git a/spec/features/backoffice/flux_de_commentaires_spec.rb b/spec/features/backoffice/flux_de_commentaires_spec.rb new file mode 100644 index 000000000..c3b586e14 --- /dev/null +++ b/spec/features/backoffice/flux_de_commentaires_spec.rb @@ -0,0 +1,52 @@ +require 'spec_helper' + +feature 'backoffice: flux de commentaires' do + let(:gestionnaire) { create(:gestionnaire) } + let(:dossier) { create(:dossier, :with_entreprise) } + let(:dossier_id) { dossier.id } + + let(:champ1) { dossier.champs.first } + let(:champ2) { create(:champ, dossier: dossier, type_de_champ: create(:type_de_champ_public, libelle: "subtitle")) } + + let!(:commentaire1) { create(:commentaire, dossier: dossier, champ: champ1) } + let!(:commentaire2) { create(:commentaire, dossier: dossier) } + let!(:commentaire3) { create(:commentaire, dossier: dossier, champ: champ2) } + let!(:commentaire4) { create(:commentaire, dossier: dossier, champ: champ1) } + + before do + login_as gestionnaire, scope: :gestionnaire + visit backoffice_dossier_path(dossier) + end + + scenario "tous les commentaires sont affichés" do + comments = find("#commentaires_flux") + expect(comments).to have_selector(".description", count: 4) + end + + scenario "ouverture commentaires limités au champs dans une modale", js: true do + find("#liste_champs th", text: champ1.libelle).click_link("COM") + expect(page).to have_css("#modalCommentairesDossierParChamp.in") + + modal = find("#modalCommentairesDossierParChamp") + expect(modal).to have_css(".description", count: 2) + end + + scenario "crée un commentaire sur un champ", js: true do + # ouverture modale + find("#liste_champs th", text: champ1.libelle).click_link("COM") + + # ajout du commentaire + form = find("#modalCommentairesDossierParChamp").find("#commentaire_new") + form.fill_in("texte_commentaire", with: "le corps du commentaire sur le champ #{champ1.libelle}") + form.click_on("Poster") + + # ajout du commentaire à la liste des commentaires + comments = find("#commentaires_flux") + expect(comments).to have_selector(".description", count: 5) + + # ajout du commentaire aux commentaires du champs + find("#liste_champs th", text: champ1.libelle).click_link("COM") + modal = find("#modalCommentairesDossierParChamp") + expect(modal).to have_css(".description", count: 3) + end +end diff --git a/spec/features/users/flux_de_commentaires_spec.rb b/spec/features/users/flux_de_commentaires_spec.rb new file mode 100644 index 000000000..57f2fee5a --- /dev/null +++ b/spec/features/users/flux_de_commentaires_spec.rb @@ -0,0 +1,53 @@ +require 'spec_helper' + +feature 'users: flux de commentaires' do + let(:user) { create(:user) } + let(:dossier) { create(:dossier, :with_entreprise, user: user, state: "replied") } + let(:dossier_id) { dossier.id } + + let(:champ1) { dossier.champs.first } + let(:champ2) { create(:champ, dossier: dossier, type_de_champ: create(:type_de_champ_public, libelle: "subtitle")) } + + let!(:commentaire1) { create(:commentaire, dossier: dossier, champ: champ1) } + let!(:commentaire2) { create(:commentaire, dossier: dossier) } + let!(:commentaire3) { create(:commentaire, dossier: dossier, champ: champ2) } + let!(:commentaire4) { create(:commentaire, dossier: dossier, champ: champ1) } + + before do + login_as user, scope: :user + visit users_dossier_recapitulatif_path(dossier) + end + + scenario "tous les commentaires sont affichés" do + comments = find("#commentaires_flux") + expect(comments).to have_selector(".description", count: 4) + end + + scenario "ouverture commentaires limités au champs dans une modale", js: true do + th = find("#liste_champs th", text: champ1.libelle) + th.click_link("COM") + expect(page).to have_css("#modalCommentairesDossierParChamp.in") + + modal = find("#modalCommentairesDossierParChamp") + expect(modal).to have_css(".description", count: 2) + end + + scenario "crée un commentaire sur un champ", js: true do + # ouverture modale + find("#liste_champs th", text: champ1.libelle).click_link("COM") + + # ajout du commentaire + form = find("#modalCommentairesDossierParChamp").find("#commentaire_new") + form.fill_in("texte_commentaire", with: "le corps du commentaire sur le champ #{champ1.libelle}") + form.click_on("Poster") + + # ajout du commentaire à la liste des commentaires + comments = find("#commentaires_flux") + expect(comments).to have_selector(".description", count: 5) + + # ajout du commentaire aux commentaires du champs + find("#liste_champs th", text: champ1.libelle).click_link("COM") + modal = find("#modalCommentairesDossierParChamp") + expect(modal).to have_css(".description", count: 3) + end +end From 8195a57f9c8120390641fc55fc4f322de5e138ac Mon Sep 17 00:00:00 2001 From: Julien Portalier Date: Wed, 16 Nov 2016 16:23:43 +0100 Subject: [PATCH 2/5] Fix: distinction des commentaires par champ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Les commentaires par champ sont distincts des commentaires généraux (non attachés à un champ). Ils ne faut donc pas les afficher dans les commentaires sous le récapitulatif du dossier. --- app/facades/dossier_facades.rb | 6 +----- spec/features/backoffice/flux_de_commentaires_spec.rb | 10 +++++----- spec/features/users/flux_de_commentaires_spec.rb | 10 +++++----- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/app/facades/dossier_facades.rb b/app/facades/dossier_facades.rb index 3dab2233d..0616bce68 100644 --- a/app/facades/dossier_facades.rb +++ b/app/facades/dossier_facades.rb @@ -32,11 +32,7 @@ class DossierFacades end def commentaires - if @champ_id - @dossier.ordered_commentaires.where(champ_id: @champ_id).decorate - else - @dossier.ordered_commentaires.all.decorate - end + @dossier.ordered_commentaires.where(champ_id: @champ_id).decorate end def commentaire_email diff --git a/spec/features/backoffice/flux_de_commentaires_spec.rb b/spec/features/backoffice/flux_de_commentaires_spec.rb index c3b586e14..5550feb62 100644 --- a/spec/features/backoffice/flux_de_commentaires_spec.rb +++ b/spec/features/backoffice/flux_de_commentaires_spec.rb @@ -18,12 +18,12 @@ feature 'backoffice: flux de commentaires' do visit backoffice_dossier_path(dossier) end - scenario "tous les commentaires sont affichés" do + scenario "seuls les commentaires généraux sont affichés" do comments = find("#commentaires_flux") - expect(comments).to have_selector(".description", count: 4) + expect(comments).to have_selector(".description", count: 1) end - scenario "ouverture commentaires limités au champs dans une modale", js: true do + scenario "affichage des commentaires du champs", js: true do find("#liste_champs th", text: champ1.libelle).click_link("COM") expect(page).to have_css("#modalCommentairesDossierParChamp.in") @@ -40,9 +40,9 @@ feature 'backoffice: flux de commentaires' do form.fill_in("texte_commentaire", with: "le corps du commentaire sur le champ #{champ1.libelle}") form.click_on("Poster") - # ajout du commentaire à la liste des commentaires + # le commentaire ne s'ajoute pas aux commentaires généraux comments = find("#commentaires_flux") - expect(comments).to have_selector(".description", count: 5) + expect(comments).to have_selector(".description", count: 1) # ajout du commentaire aux commentaires du champs find("#liste_champs th", text: champ1.libelle).click_link("COM") diff --git a/spec/features/users/flux_de_commentaires_spec.rb b/spec/features/users/flux_de_commentaires_spec.rb index 57f2fee5a..7a6e7fe61 100644 --- a/spec/features/users/flux_de_commentaires_spec.rb +++ b/spec/features/users/flux_de_commentaires_spec.rb @@ -18,12 +18,12 @@ feature 'users: flux de commentaires' do visit users_dossier_recapitulatif_path(dossier) end - scenario "tous les commentaires sont affichés" do + scenario "seuls les commentaires généraux sont affichés" do comments = find("#commentaires_flux") - expect(comments).to have_selector(".description", count: 4) + expect(comments).to have_selector(".description", count: 1) end - scenario "ouverture commentaires limités au champs dans une modale", js: true do + scenario "affichage des commentaires du champs", js: true do th = find("#liste_champs th", text: champ1.libelle) th.click_link("COM") expect(page).to have_css("#modalCommentairesDossierParChamp.in") @@ -41,9 +41,9 @@ feature 'users: flux de commentaires' do form.fill_in("texte_commentaire", with: "le corps du commentaire sur le champ #{champ1.libelle}") form.click_on("Poster") - # ajout du commentaire à la liste des commentaires + # le commentaire ne s'ajoute pas aux commentaires généraux comments = find("#commentaires_flux") - expect(comments).to have_selector(".description", count: 5) + expect(comments).to have_selector(".description", count: 1) # ajout du commentaire aux commentaires du champs find("#liste_champs th", text: champ1.libelle).click_link("COM") From 893bfaef4093331c3173f84b048007b56d495b82 Mon Sep 17 00:00:00 2001 From: Xavier J Date: Thu, 17 Nov 2016 10:50:28 +0100 Subject: [PATCH 3/5] Fix JS --- .../javascripts/dossier_commentaires_modal.js | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/app/assets/javascripts/dossier_commentaires_modal.js b/app/assets/javascripts/dossier_commentaires_modal.js index d778412b9..1b697bd4e 100644 --- a/app/assets/javascripts/dossier_commentaires_modal.js +++ b/app/assets/javascripts/dossier_commentaires_modal.js @@ -1,13 +1,16 @@ -$(document).ready(function () { - var modal = $("#modalCommentairesDossierParChamp"); - var body = modal.find(".modal-body"); - var originalBody = body.html(); +$(document).on('page:load', init_modal_commentaire); +$(document).ready(init_modal_commentaire); - modal.on("show.bs.modal", function (e) { - body.load(e.relatedTarget.getAttribute("data-href")); - }); +function init_modal_commentaire() { + var modal = $("#modalCommentairesDossierParChamp"); + var body = modal.find(".modal-body"); + var originalBody = body.html(); - $("#modalCommentairesDossierParChamp").on("hidden.bs.modal", function (e) { - body.html(originalBody); - }); -}); + modal.on("show.bs.modal", function (e) { + body.load(e.relatedTarget.getAttribute("data-href")); + }); + + $("#modalCommentairesDossierParChamp").on("hidden.bs.modal", function (e) { + body.html(originalBody); + }); +} \ No newline at end of file From d144047a500e1ba00b7729dfda847bca04c11162 Mon Sep 17 00:00:00 2001 From: Xavier J Date: Thu, 17 Nov 2016 11:13:11 +0100 Subject: [PATCH 4/5] Fix export data dossiers --- app/controllers/backoffice/dossiers_list_controller.rb | 4 ++-- app/views/backoffice/dossiers/index.html.haml | 9 +++++---- db/schema.rb | 9 +++++++-- spec/models/procedure_spec.rb | 1 - 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/app/controllers/backoffice/dossiers_list_controller.rb b/app/controllers/backoffice/dossiers_list_controller.rb index 9a98d7e45..8b6d42f3f 100644 --- a/app/controllers/backoffice/dossiers_list_controller.rb +++ b/app/controllers/backoffice/dossiers_list_controller.rb @@ -30,14 +30,14 @@ class Backoffice::DossiersListController < ApplicationController def smartlisting_dossier dossiers_list=nil, liste='a_traiter' dossiers_list_facade liste - dossiers_list = dossiers_list_facade.dossiers_to_display if dossiers_list.nil? + @dossiers_list = dossiers_list_facade.dossiers_to_display if dossiers_list.nil? if param_page.nil? params[:dossiers_smart_listing] = {page: dossiers_list_facade.service.default_page} end @dossiers = smart_listing_create :dossiers, - dossiers_list, + @dossiers_list, partial: "backoffice/dossiers/list", array: true, default_sort: dossiers_list_facade.service.default_sort diff --git a/app/views/backoffice/dossiers/index.html.haml b/app/views/backoffice/dossiers/index.html.haml index 2093a7f4d..2e11f6120 100644 --- a/app/views/backoffice/dossiers/index.html.haml +++ b/app/views/backoffice/dossiers/index.html.haml @@ -6,14 +6,15 @@ =t('dynamics.backoffice.title') %div.dropdown.pull-right#download_menu - - if @dossiers.count > 200 - %button.btn.btn-error.dropdown-toggle#dropdownDownloadMenu{ type: :button, 'data-toggle' => 'dropdown', 'aria-haspopup' => true, 'aria-expanded' => false, class: 'disabled', 'data-toggle' => :tooltip, title: 'Pour réduire le nombre de dossiers et ne pas dépasser la limite autorisée de 200 dossiers en téléchargement, merci de bien vouloir appliquer vos filtres.'} - = t('dynamics.backoffice.limit_excess_download_all_dossiers') + - if @dossiers_list.count > 200 + %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 200, merci de bien vouloir appliquer des filtres.'} + = t('dynamics.backoffice.limit_excess_download_all_dossiers') - else %button.btn.btn-success.dropdown-toggle#dropdownDownloadMenu{ type: :button, 'data-toggle' => 'dropdown', 'aria-haspopup' => true, 'aria-expanded' => false } %i.fa.fa-download = t('dynamics.backoffice.download_all_dossiers') - %span.caret + %span.caret %ul.dropdown-menu.dropdown-menu-right %li = link_to backoffice_download_dossiers_tps_path(format: :csv, procedure_id: params[:id]), { class: 'btn btn-sm' } do diff --git a/db/schema.rb b/db/schema.rb index cdcfa6acf..724af68f2 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20161110082244) do +ActiveRecord::Schema.define(version: 20161115053251) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -62,6 +62,12 @@ ActiveRecord::Schema.define(version: 20161110082244) do add_index "administrations", ["email"], name: "index_administrations_on_email", unique: true, using: :btree add_index "administrations", ["reset_password_token"], name: "index_administrations_on_reset_password_token", unique: true, using: :btree + create_table "ar_internal_metadata", primary_key: "key", force: :cascade do |t| + t.string "value" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + create_table "assign_tos", id: false, force: :cascade do |t| t.integer "gestionnaire_id" t.integer "procedure_id" @@ -308,7 +314,6 @@ ActiveRecord::Schema.define(version: 20161110082244) do t.string "lien_demarche" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.boolean "test" t.integer "administrateur_id" t.boolean "archived", default: false t.boolean "euro_flag", default: false diff --git a/spec/models/procedure_spec.rb b/spec/models/procedure_spec.rb index db62fda24..6b7434208 100644 --- a/spec/models/procedure_spec.rb +++ b/spec/models/procedure_spec.rb @@ -17,7 +17,6 @@ describe Procedure do it { is_expected.to have_db_column(:description) } it { is_expected.to have_db_column(:organisation) } it { is_expected.to have_db_column(:direction) } - it { is_expected.to have_db_column(:test) } it { is_expected.to have_db_column(:euro_flag) } it { is_expected.to have_db_column(:logo) } it { is_expected.to have_db_column(:logo_secure_token) } From 6e4ddcdbcf0f9670a34e81629c91de75a4dfbeaa Mon Sep 17 00:00:00 2001 From: Xavier J Date: Thu, 17 Nov 2016 11:24:49 +0100 Subject: [PATCH 5/5] Fix test --- app/controllers/backoffice/dossiers_list_controller.rb | 4 ++-- app/views/backoffice/dossiers/index.html.haml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/backoffice/dossiers_list_controller.rb b/app/controllers/backoffice/dossiers_list_controller.rb index 8b6d42f3f..9a98d7e45 100644 --- a/app/controllers/backoffice/dossiers_list_controller.rb +++ b/app/controllers/backoffice/dossiers_list_controller.rb @@ -30,14 +30,14 @@ class Backoffice::DossiersListController < ApplicationController def smartlisting_dossier dossiers_list=nil, liste='a_traiter' dossiers_list_facade liste - @dossiers_list = dossiers_list_facade.dossiers_to_display if dossiers_list.nil? + dossiers_list = dossiers_list_facade.dossiers_to_display if dossiers_list.nil? if param_page.nil? params[:dossiers_smart_listing] = {page: dossiers_list_facade.service.default_page} end @dossiers = smart_listing_create :dossiers, - @dossiers_list, + dossiers_list, partial: "backoffice/dossiers/list", array: true, default_sort: dossiers_list_facade.service.default_sort diff --git a/app/views/backoffice/dossiers/index.html.haml b/app/views/backoffice/dossiers/index.html.haml index 2e11f6120..0f0f3326b 100644 --- a/app/views/backoffice/dossiers/index.html.haml +++ b/app/views/backoffice/dossiers/index.html.haml @@ -6,7 +6,7 @@ =t('dynamics.backoffice.title') %div.dropdown.pull-right#download_menu - - if @dossiers_list.count > 200 + - if @dossiers_list_facade.dossiers_to_display.count > 200 %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 200, merci de bien vouloir appliquer des filtres.'} = t('dynamics.backoffice.limit_excess_download_all_dossiers')