add react component (expert view) and block it when the flag is activated
This commit is contained in:
parent
03fd6eaeea
commit
a8b30c0cdc
2 changed files with 39 additions and 29 deletions
|
@ -1,9 +1,17 @@
|
||||||
%section.ask-avis
|
- if @dossier.procedure.feature_enabled?(:admin_affect_experts_to_avis).blank?
|
||||||
|
%section.ask-avis
|
||||||
%h1.tab-title Inviter des personnes à donner leur avis
|
%h1.tab-title Inviter des personnes à donner leur avis
|
||||||
%p.avis-notice Les invités pourront consulter le dossier, donner un avis et contribuer au fil de messagerie. Ils ne pourront pas modifier le dossier.
|
%p.avis-notice Les invités pourront consulter le dossier, donner un avis et contribuer au fil de messagerie. Ils ne pourront pas modifier le dossier.
|
||||||
|
|
||||||
= form_for avis, url: url, html: { class: 'form' } do |f|
|
= form_for avis, url: url, html: { class: 'form' } do |f|
|
||||||
= f.email_field :emails, placeholder: 'Adresses email, séparées par des virgules', required: true, multiple: true, onchange: "javascript:DS.replaceSemicolonByComma(event);"
|
- hidden_field_id = SecureRandom.uuid
|
||||||
|
= hidden_field_tag 'avis[emails]', nil, data: { uuid: hidden_field_id }
|
||||||
|
= react_component("ComboMultipleDropdownList",
|
||||||
|
options: [],
|
||||||
|
selected: [], disabled: [],
|
||||||
|
hiddenFieldId: hidden_field_id,
|
||||||
|
label: 'avis_emails',
|
||||||
|
acceptNewValues: true)
|
||||||
= f.text_area :introduction, rows: 3, value: avis.introduction || 'Bonjour, merci de me donner votre avis sur ce dossier.', required: true
|
= f.text_area :introduction, rows: 3, value: avis.introduction || 'Bonjour, merci de me donner votre avis sur ce dossier.', required: true
|
||||||
%p.tab-title Ajouter une pièce jointe
|
%p.tab-title Ajouter une pièce jointe
|
||||||
.form-group
|
.form-group
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
feature 'Instructing a dossier:' do
|
feature 'Instructing a dossier:', js: true do
|
||||||
include ActiveJob::TestHelper
|
include ActiveJob::TestHelper
|
||||||
|
|
||||||
let(:password) { 'my-s3cure-p4ssword' }
|
let(:password) { 'my-s3cure-p4ssword' }
|
||||||
|
@ -101,11 +101,13 @@ feature 'Instructing a dossier:' do
|
||||||
click_on 'Avis externes'
|
click_on 'Avis externes'
|
||||||
expect(page).to have_current_path(avis_instructeur_dossier_path(procedure, dossier))
|
expect(page).to have_current_path(avis_instructeur_dossier_path(procedure, dossier))
|
||||||
|
|
||||||
|
expert_email_formated = "[\"expert@tps.com\"]"
|
||||||
expert_email = 'expert@tps.com'
|
expert_email = 'expert@tps.com'
|
||||||
ask_confidential_avis(expert_email, 'a good introduction')
|
ask_confidential_avis(expert_email_formated, 'a good introduction')
|
||||||
|
|
||||||
|
expert_email_formated = "[\"#{instructeur2.email}\"]"
|
||||||
expert_email = instructeur2.email
|
expert_email = instructeur2.email
|
||||||
ask_confidential_avis(expert_email, 'a good introduction')
|
ask_confidential_avis(expert_email_formated, 'a good introduction')
|
||||||
|
|
||||||
click_on 'Personnes impliquées'
|
click_on 'Personnes impliquées'
|
||||||
expect(page).to have_text(expert_email)
|
expect(page).to have_text(expert_email)
|
||||||
|
@ -206,7 +208,7 @@ feature 'Instructing a dossier:' do
|
||||||
end
|
end
|
||||||
|
|
||||||
def ask_confidential_avis(to, introduction)
|
def ask_confidential_avis(to, introduction)
|
||||||
fill_in 'avis_emails', with: to
|
page.execute_script("document.querySelector('#avis_emails').value = '#{to}'")
|
||||||
fill_in 'avis_introduction', with: introduction
|
fill_in 'avis_introduction', with: introduction
|
||||||
select 'confidentiel', from: 'avis_confidentiel'
|
select 'confidentiel', from: 'avis_confidentiel'
|
||||||
click_on 'Demander un avis'
|
click_on 'Demander un avis'
|
||||||
|
|
Loading…
Reference in a new issue