Skip to content

Commit

Permalink
Merge pull request #6449 from escattone/fix-survey-cancel-message-2118
Browse files Browse the repository at this point in the history
show message after cancelling survey
  • Loading branch information
akatsoulas authored Jan 15, 2025
2 parents 56bcd07 + 1af2358 commit 92db0d3
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions kitsune/wiki/jinja2/wiki/includes/survey_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,28 @@
},
handleSubmit() {
if (this.validateForm()) {
trackEvent('article_survey_submitted', {
trackEvent('article_survey_submitted', {
survey_type: '{{ survey_type }}',
reason: this.selectedReason
reason: this.selectedReason
});
return true; // Allow HTMX to proceed with submission
}
return false;
},
closeSurvey() {
closeSurvey(message) {
const surveyType = '{{ survey_type }}'.trim();
if (surveyType) {
trackEvent('article_survey_closed', { survey_type: surveyType });
}
document.querySelector('.document-vote').remove();
const survey = document.querySelector('.document-vote');
if (message) {
this.responseMessage = message;
setTimeout(() => {
survey.remove();
}, 5000);
} else {
survey.remove();
}
}
}" x-init="
const surveyType = '{{ survey_type }}'.trim();
Expand Down Expand Up @@ -76,7 +84,8 @@ <h3 class="sumo-card-heading text-center">
<p class="error-text" x-show="hasError" style="display: none; color: red;">{{ _('Please provide more details.') }}
</p>
<div class="sumo-button-wrap align-full">
<button class="sumo-button button-sm secondary-button" type="button" @click="closeSurvey()">
<button class="sumo-button button-sm secondary-button" type="button"
@click="closeSurvey('Thanks for voting! Your additional feedback wasn\'t submitted.')">
{{ _('Cancel') }}
</button>
<button class="sumo-button button-sm primary-button" type="submit"
Expand Down

0 comments on commit 92db0d3

Please sign in to comment.