pidgin/nest

Merged in default (pull request #91)

17 months ago, Gary Kramlich
4001a8922417
Merged in default (pull request #91)

Initialize search fields from URL correctly.

Approved-by: Gary Kramlich
Approved-by: John Bailey
--- a/hugo/static/js/plugin-table.js Sat Apr 18 02:20:44 2020 -0500
+++ b/hugo/static/js/plugin-table.js Sat Apr 18 07:27:27 2020 +0000
@@ -58,9 +58,20 @@
};
});
- // Add click handler to All|Trusted|Community selector
- $("#publisher-selector").click(updateFilters);
+ // Set up publisher selector interface
+ var publisherSelectors = $("#publisher-selector");
+ var publisherChecked = $('input[id="' + searchState.publisher + '"]', publisherSelectors);
+ if (publisherChecked) {
+ publisherChecked.prop('checked', true);
+ } else {
+ searchState.publisher = "all";
+ $('input[id="all"]', publisherSelectors).prop('checked', true);
+ }
+ publisherSelectors.click(updateFilters);
+
+ // Set up search box interface
searchTextBox = document.querySelector("#plugin-filter-search");
+ searchTextBox.value = searchState.query;
searchTextBox.addEventListener(
"input",
// Wait half a second
@@ -71,6 +82,9 @@
Array.from(
document.querySelectorAll("#plugin-selector>label>input")
).forEach(function(elem) {
+ if (searchState.type.has(elem.dataset.type)) {
+ elem.checked = true;
+ }
elem.addEventListener("click", pluginTypeSelectorClickEvent);
});