mirror of
https://github.com/GSA/notifications-admin.git
synced 2025-12-11 07:33:36 -05:00
- Clears any selected checkboxes to prevent form submission issues
- Fix search functionality to respect .template-list-item-hidden-by-default - Add missing "No templates found" message to template search - Ensure nested template items remain hidden when searching and clearing search - Hides all template items when clicking "New template" button - Shows everything again when exiting the "new template" state
This commit is contained in:
@@ -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') {
|
||||
|
||||
@@ -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,15 @@
|
||||
mode = 'dialog';
|
||||
}
|
||||
|
||||
if (currentStateObj && ('setFocus' in currentStateObj)) {
|
||||
if (this.currentState === 'add-new-template') {
|
||||
this.$form.find('.template-list-item').addClass('js-hidden');
|
||||
this.$form.find('input[type=checkbox]').prop('checked', false);
|
||||
this.selectionStatus.update({ total: 0, templates: 0, folders: 0 });
|
||||
} else {
|
||||
this.$form.find('.template-list-item').removeClass('js-hidden');
|
||||
}
|
||||
|
||||
if (currentStateObj && 'setFocus' in currentStateObj) {
|
||||
scrollTop = $(window).scrollTop();
|
||||
currentStateObj.setFocus();
|
||||
$(window).scrollTop(scrollTop);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -59,6 +59,10 @@
|
||||
|
||||
{{ live_search(target_selector='#template-list .template-list-item', show=show_search_box, form=search_form) }}
|
||||
|
||||
<div class="js-live-search-no-results" style="display: none;">
|
||||
<p class="usa-body margin-top-2">No templates found</p>
|
||||
</div>
|
||||
|
||||
{% if current_user.has_permissions('manage_templates') and user_has_template_folder_permission %}
|
||||
{% call form_wrapper(
|
||||
class='sticky-scroll-area',
|
||||
|
||||
Reference in New Issue
Block a user