diff --git a/app/dashboards/dossier_dashboard.rb b/app/dashboards/dossier_dashboard.rb index b329da0cd..456b3f3a4 100644 --- a/app/dashboards/dossier_dashboard.rb +++ b/app/dashboards/dossier_dashboard.rb @@ -11,6 +11,7 @@ class DossierDashboard < Administrate::BaseDashboard id: Field::Number.with_options(searchable: true), procedure: Field::HasOne, state: Field::String, + user: Field::BelongsTo, text_summary: Field::String.with_options(searchable: false), created_at: Field::DateTime, updated_at: Field::DateTime, @@ -36,6 +37,7 @@ class DossierDashboard < Administrate::BaseDashboard :text_summary, :state, :procedure, + :user, :types_de_champ, :created_at, :updated_at, diff --git a/app/views/new_gestionnaire/avis/instruction.html.haml b/app/views/new_gestionnaire/avis/instruction.html.haml index 1cdeba6d6..2b26eb134 100644 --- a/app/views/new_gestionnaire/avis/instruction.html.haml +++ b/app/views/new_gestionnaire/avis/instruction.html.haml @@ -15,9 +15,13 @@ = f.text_area :answer, rows: 3, placeholder: 'Votre avis', required: true .flex.justify-between.align-baseline %p.confidentiel.flex - %span.icon.lock - %span - Cet avis est confidentiel et n'est pas affiché aux autres experts consultés + - if @avis.confidentiel? + %span.icon.lock + %span + Cet avis est confidentiel et n'est pas affiché aux autres experts consultés + - else + %span + Cet avis est partagé avec les autres experts .send-wrapper = f.submit 'Envoyer votre avis', class: 'button send' diff --git a/config/deploy.rb b/config/deploy.rb index 5a36ae2ac..ad139f136 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -110,6 +110,7 @@ task :deploy do invoke :'service:restart_puma' invoke :'service:reload_nginx' invoke :'service:restart_delayed_job' + invoke :'deploy:cleanup' end end end diff --git a/db/migrate/20181121234008_remove_champ_id_from_commentaires.rb b/db/migrate/20181121234008_remove_champ_id_from_commentaires.rb new file mode 100644 index 000000000..e8bb7f80d --- /dev/null +++ b/db/migrate/20181121234008_remove_champ_id_from_commentaires.rb @@ -0,0 +1,5 @@ +class RemoveChampIdFromCommentaires < ActiveRecord::Migration[5.2] + def change + remove_column :commentaires, :champ_id + end +end diff --git a/db/schema.rb b/db/schema.rb index b77ed7444..41ef703c6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2018_11_08_151929) do +ActiveRecord::Schema.define(version: 2018_11_21_234008) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -188,9 +188,7 @@ ActiveRecord::Schema.define(version: 2018_11_08_151929) do t.integer "dossier_id" t.datetime "updated_at", null: false t.integer "piece_justificative_id" - t.integer "champ_id" t.string "file" - t.index ["champ_id"], name: "index_commentaires_on_champ_id" t.index ["dossier_id"], name: "index_commentaires_on_dossier_id" end diff --git a/spec/views/new_gestionnaire/avis/instruction.html.haml_spec.rb b/spec/views/new_gestionnaire/avis/instruction.html.haml_spec.rb new file mode 100644 index 000000000..0d23b7b75 --- /dev/null +++ b/spec/views/new_gestionnaire/avis/instruction.html.haml_spec.rb @@ -0,0 +1,21 @@ +describe 'new_gestionnaire/avis/instruction.html.haml', type: :view do + let(:avis) { create(:avis, confidentiel: confidentiel) } + + before do + assign(:avis, avis) + @dossier = create(:dossier, :accepte) + allow(view).to receive(:current_gestionnaire).and_return(avis.gestionnaire) + end + + subject { render } + + context 'with a confidential avis' do + let(:confidentiel) { true } + it { is_expected.to have_text("Cet avis est confidentiel et n'est pas affiché aux autres experts consultés") } + end + + context 'with a not confidential avis' do + let(:confidentiel) { false } + it { is_expected.to have_text("Cet avis est partagé avec les autres experts") } + end +end