Merge pull request #2663 from GSA/2253-bug-on-template-page

Fixes for several bugs on the templates page related to form submission issues
This commit is contained in:
ccostino
2025-06-11 17:52:32 -04:00
committed by GitHub
7 changed files with 68 additions and 20 deletions

View File

@@ -20,7 +20,6 @@
$targets.each(function() {
let content = $('.live-search-relevant', this).text() || $(this).text();
let isMatch = normalize(content).indexOf(normalize(query)) > -1;
if ($(this).has(':checked').length) {
$(this).show();
@@ -29,21 +28,25 @@
}
if (query == '') {
$(this).css('display', '');
$(this).removeClass('js-hidden');
results++;
return;
}
$(this).toggle(isMatch);
if (isMatch) { results++; }
let isMatch = normalize(content).includes(normalize(query));
if (isMatch) {
$(this).removeClass('js-hidden');
results++;
} else {
$(this).addClass('js-hidden');
}
});
if (query !== '' && results === 0) {
$noResultsMessage.show();
$noResultsMessage.removeClass('js-hidden');
} else {
$noResultsMessage.hide();
$noResultsMessage.addClass('js-hidden');
}
if (state === 'loaded') {

View File

@@ -197,6 +197,11 @@
if (event.currentTarget.value === 'add-new-template' && this.$singleNotificationChannel) {
window.location = "/services/" + this.$singleChannelService + "/templates/add-" + this.$singleNotificationChannel;
} else {
if (this.currentState === 'add-new-template') {
this.$form.find('input[type=checkbox]').prop('checked', false);
this.selectionStatus.update({ total: 0, templates: 0, folders: 0 });
}
if (this.stateChanged()) {
this.render();
}
@@ -286,7 +291,29 @@
mode = 'dialog';
}
if (currentStateObj && ('setFocus' in currentStateObj)) {
if (this.currentState === 'add-new-template') {
this.$form.find('.template-list-item').addClass('js-hidden');
$('.live-search').addClass('js-hidden');
$('#breadcrumb-template-folders').addClass('js-hidden');
$('#template-list').addClass('js-hidden');
this.$form.find('input[type=checkbox]').prop('checked', false);
this.selectionStatus.update({ total: 0, templates: 0, folders: 0 });
$('#page-title').text('New Template');
$('#page-description').text('Every message starts with a template. Choose to start with a blank template or copy an existing template.');
document.title = 'New Templates';
} else {
this.$form.find('.template-list-item').removeClass('js-hidden');
$('.live-search').removeClass('js-hidden');
$('#breadcrumb-template-folders').removeClass('js-hidden');
$('#template-list').removeClass('js-hidden');
$('#page-title').text('Select or create a template');
$('#page-description').text('Every message starts with a template. To send, choose or create a template.');
document.title = 'Select or create a template';
}
if (currentStateObj && 'setFocus' in currentStateObj) {
scrollTop = $(window).scrollTop();
currentStateObj.setFocus();
$(window).scrollTop(scrollTop);

View File

@@ -229,6 +229,10 @@ td.table-empty-message {
display: none;
}
.js-hidden {
display: none !important;
}
.folder-heading a.folder-heading-folder,
.template-list-folder {
background: url(../img/material-icons/folder.svg) no-repeat;