Skip to content

Commit

Permalink
Merge pull request #2661 from justcarakas/2627-faq-allow-feedback
Browse files Browse the repository at this point in the history
faq allow feedback
  • Loading branch information
StijnVrolijk committed Oct 16, 2018
2 parents cc94b65 + 57f2786 commit 519525c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Frontend/Modules/Faq/Actions/Detail.php
Expand Up @@ -180,7 +180,7 @@ private function isFeedbackNoInfoHidden(): bool
return (bool) $this->feedbackForm->getField('useful')->getValue();
}

return false;
return true;
}

private function increaseViewCount(): void
Expand Down
15 changes: 8 additions & 7 deletions src/Frontend/Modules/Faq/Js/Faq.js
Expand Up @@ -13,17 +13,18 @@ jsFrontend.faq.feedback = {
$('input[data-role=fork-feedback-useful]').on('change', function () {
var $wrapperForm = $(this.form)

// init useful status
var useful = $('input[data-role=fork-feedback-useful]:checked').val()
var useful = parseInt($('input[data-role=fork-feedback-useful]:checked').val())

// show or hide the form
if (useful) {
// submit when it is useful, ask for feedback otherwise
if (useful === 1) {
$wrapperForm.find('textarea[data-role=fork-feedback-improve-message]').prop('required', false)
$wrapperForm.submit()
} else {
$wrapperForm.find('textarea[data-role=fork-feedback-improve-message]').prop('required', true)
$wrapperForm.find('*[data-role=fork-feedback-container]').show()

return
}

$wrapperForm.find('textarea[data-role=fork-feedback-improve-message]').prop('required', true)
$wrapperForm.find('[data-role=fork-feedback-container]').show()
})
}
}
Expand Down

0 comments on commit 519525c

Please sign in to comment.