Merge pull request #3091 from pengfeidong/fix_2969_replace_semicolon_by_comma_in_list_email

[fix #2969] use JS replace semicolon by comma in the list email
This commit is contained in:
Mathieu Magnin 2018-12-03 13:11:15 +01:00 committed by GitHub
commit c195ad2eaa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 2 deletions

View file

@ -3,3 +3,7 @@ import { toggle } from '@utils';
export function toggleCondidentielExplanation() { export function toggleCondidentielExplanation() {
toggle(document.querySelector('.confidentiel-explanation')); toggle(document.querySelector('.confidentiel-explanation'));
} }
export function replaceSemicolonByComma(event) {
event.target.value = event.target.value.replace(/;/g, ',');
}

View file

@ -25,6 +25,7 @@ import { toggleCondidentielExplanation } from '../new_design/avis';
import { scrollMessagerie } from '../new_design/messagerie'; import { scrollMessagerie } from '../new_design/messagerie';
import { showMotivation, motivationCancel } from '../new_design/state-button'; import { showMotivation, motivationCancel } from '../new_design/state-button';
import { toggleChart } from '../new_design/toggle-chart'; import { toggleChart } from '../new_design/toggle-chart';
import { replaceSemicolonByComma } from '../new_design/avis';
// This is the global application namespace where we expose helpers used from rails views // This is the global application namespace where we expose helpers used from rails views
const DS = { const DS = {
@ -32,7 +33,8 @@ const DS = {
scrollMessagerie, scrollMessagerie,
showMotivation, showMotivation,
motivationCancel, motivationCancel,
toggleChart toggleChart,
replaceSemicolonByComma
}; };
// Start Rails helpers // Start Rails helpers

View file

@ -3,7 +3,7 @@
%p.avis-notice Les invités pourront consulter, donner un avis sur le dossier et contribuer au fil de messagerie, mais ils ne pourront pas le modifier. %p.avis-notice Les invités pourront consulter, donner un avis sur le dossier et contribuer au fil de messagerie, mais ils ne pourront pas le modifier.
= 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 = f.email_field :emails, placeholder: 'Adresses email, séparées par des virgules', required: true, multiple: true, onchange: "javascript:DS.replaceSemicolonByComma(event);"
= 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
.flex.justify-between.align-baseline .flex.justify-between.align-baseline
- if must_be_confidentiel - if must_be_confidentiel