set input value for question type of contact page
This commit is contained in:
parent
df9a15a224
commit
9be015752a
2 changed files with 8 additions and 0 deletions
|
@ -41,6 +41,7 @@ ButtonExpand.prototype.showContent = function () {
|
||||||
this.controlledNode.classList.remove('hidden');
|
this.controlledNode.classList.remove('hidden');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
this.formInput.value = this.domNode.getAttribute('data-question-type');
|
||||||
|
|
||||||
this.allButtons.forEach((b) => {
|
this.allButtons.forEach((b) => {
|
||||||
if (b != this) {
|
if (b != this) {
|
||||||
|
@ -75,6 +76,10 @@ ButtonExpand.prototype.setAllButtons = function(buttons) {
|
||||||
this.allButtons = buttons;
|
this.allButtons = buttons;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ButtonExpand.prototype.setFormInput = function(formInput) {
|
||||||
|
this.formInput = formInput;
|
||||||
|
}
|
||||||
|
|
||||||
/* EVENT HANDLERS */
|
/* EVENT HANDLERS */
|
||||||
|
|
||||||
ButtonExpand.prototype.handleKeydown = function (event) {
|
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 buttons = document.querySelectorAll('button[aria-expanded][aria-controls], button.button-without-hint');
|
||||||
var expandButtons = [];
|
var expandButtons = [];
|
||||||
|
var formInput = document.querySelector('form input#type');
|
||||||
|
|
||||||
buttons.forEach((button) => {
|
buttons.forEach((button) => {
|
||||||
var be = new ButtonExpand(button);
|
var be = new ButtonExpand(button);
|
||||||
|
@ -122,5 +128,6 @@ window.addEventListener('load', function (event) {
|
||||||
expandButtons.push(be);
|
expandButtons.push(be);
|
||||||
});
|
});
|
||||||
expandButtons.forEach((button) => button.setAllButtons(expandButtons));
|
expandButtons.forEach((button) => button.setAllButtons(expandButtons));
|
||||||
|
expandButtons.forEach((button) => button.setFormInput(formInput));
|
||||||
|
|
||||||
}, false);
|
}, false);
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
= label_tag :type do
|
= label_tag :type do
|
||||||
= t('your_question', scope: [:support, :question])
|
= t('your_question', scope: [:support, :question])
|
||||||
%span.mandatory *
|
%span.mandatory *
|
||||||
|
= hidden_field_tag :type, params[:type]
|
||||||
%dl
|
%dl
|
||||||
- @options.each do |(question, question_type, link)|
|
- @options.each do |(question, question_type, link)|
|
||||||
%dt
|
%dt
|
||||||
|
|
Loading…
Add table
Reference in a new issue