set input value for question type of contact page

This commit is contained in:
Christophe Robillard 2020-09-16 21:41:02 +02:00
parent df9a15a224
commit 9be015752a
2 changed files with 8 additions and 0 deletions

View file

@ -41,6 +41,7 @@ ButtonExpand.prototype.showContent = function () {
this.controlledNode.classList.remove('hidden');
}
this.formInput.value = this.domNode.getAttribute('data-question-type');
this.allButtons.forEach((b) => {
if (b != this) {
@ -75,6 +76,10 @@ ButtonExpand.prototype.setAllButtons = function(buttons) {
this.allButtons = buttons;
}
ButtonExpand.prototype.setFormInput = function(formInput) {
this.formInput = formInput;
}
/* EVENT HANDLERS */
ButtonExpand.prototype.handleKeydown = function (event) {
@ -115,6 +120,7 @@ window.addEventListener('load', function (event) {
var buttons = document.querySelectorAll('button[aria-expanded][aria-controls], button.button-without-hint');
var expandButtons = [];
var formInput = document.querySelector('form input#type');
buttons.forEach((button) => {
var be = new ButtonExpand(button);
@ -122,5 +128,6 @@ window.addEventListener('load', function (event) {
expandButtons.push(be);
});
expandButtons.forEach((button) => button.setAllButtons(expandButtons));
expandButtons.forEach((button) => button.setFormInput(formInput));
}, false);

View file

@ -25,6 +25,7 @@
= label_tag :type do
= t('your_question', scope: [:support, :question])
%span.mandatory *
= hidden_field_tag :type, params[:type]
%dl
- @options.each do |(question, question_type, link)|
%dt