diff --git a/apps/static/js/home/subscriptions.js b/apps/static/js/home/subscriptions.js index 9bc4cc9..eec90bc 100644 --- a/apps/static/js/home/subscriptions.js +++ b/apps/static/js/home/subscriptions.js @@ -337,7 +337,7 @@ function clearExistingSubRows() { subTable.clear().draw(false); } -$("#refreshSubscriptionBtn").on("click", async function() { +$("#subscriptionsTabPane").on("click", ".table-refresh-btn", async function() { loadSubscriptions(getCurrentlyActiveServer().guild_id); }); diff --git a/apps/static/js/table.js b/apps/static/js/table.js index e5ec937..094db12 100644 --- a/apps/static/js/table.js +++ b/apps/static/js/table.js @@ -26,38 +26,53 @@ function createSearchRow(containingSelector, searchId, sortDropdownId, filterDro +
`); - if (!options || !options.sort) - return; + $(`${containingSelector} .table-search-row .table-search-buttons`).append(` +
+ +
+ `); - $(`${containingSelector} .table-search-row`).append(` -
-
- -
-
- + if (options.sort) { + $(`${containingSelector} .table-search-row .table-search-buttons`).append(` +
+
`); + populateSortDropdown(sortDropdownId, options.sort); + } - options.sort.forEach(sortKey => { + if (options.actions.GET) { + $(`${containingSelector} .table-search-row .table-search-buttons`).append(` +
+ +
+ `); + populateFilterDropdown(); + } +} + +function populateSortDropdown(sortDropdownId, sortOptions) { + sortOptions.forEach(sortKey => { let label = sortKey.replace(/_/g, " ") $(`#${sortDropdownId} .dropdown-menu`).append(`
  • @@ -72,23 +87,10 @@ function createSearchRow(containingSelector, searchId, sortDropdownId, filterDro
  • `); }); - - //
    - // - // - //
    } +function populateFilterDropdown() { } + async function bindSearchBar(searchBarSelector, loadDataFunc) { searchBar = $("#" + searchBarSelector) searchBar.on("input", async function() {