Skip to content

Commit

Permalink
Add clear filter button
Browse files Browse the repository at this point in the history
  • Loading branch information
ericpp committed Dec 22, 2024
1 parent 1019fe7 commit e41a23b
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 6 deletions.
5 changes: 3 additions & 2 deletions webroot/html/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,15 @@ <h5 class="titleHeader">
</div>
<div class="messaging">
<div class="inbox_msg">
<div id="inbox-filters" style="display: flex; justify-content: space-between" class="d-none">
<div id="inbox-filters" style="display: flex; align-items: center;" class="d-none">
<div id="filter-podcasts" class="dropdown">
<button class="btn btn-sm btn-outline-dark text-light dropdown-toggle" type="button" data-toggle="dropdown" aria-expanded="false" style="border: .2rem transparent;">
<button class="btn btn-outline-dark text-light dropdown-toggle py-1" type="button" data-toggle="dropdown" aria-expanded="false" style="border: .2rem transparent;">
Filter by podcast
</button>
<div class="dropdown-menu" style="font-size: .875rem;">
</div>
</div>
<a href="#" class="clear-filters d-none"></a>
</div>
<div class="mesgs">
<div class="msg_history"></div>
Expand Down
5 changes: 3 additions & 2 deletions webroot/html/sent.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,15 @@ <h5 class="titleHeader">
</div>
<div class="messaging">
<div class="inbox_msg">
<div id="inbox-filters" style="display: flex; justify-content: space-between" class="d-none">
<div id="inbox-filters" style="display: flex; align-items: center;" class="d-none">
<div id="filter-podcasts" class="dropdown">
<button class="btn btn-sm btn-outline-dark text-light dropdown-toggle" type="button" data-toggle="dropdown" aria-expanded="false" style="border: .2rem transparent;">
<button class="btn btn-outline-dark text-light dropdown-toggle py-1" type="button" data-toggle="dropdown" aria-expanded="false" style="border: .2rem transparent;">
Filter by podcast
</button>
<div class="dropdown-menu" style="font-size: .875rem;">
</div>
</div>
<a href="#" class="clear-filters d-none"></a>
</div>
<div class="mesgs">
<div class="msg_history"></div>
Expand Down
5 changes: 3 additions & 2 deletions webroot/html/streams.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,15 @@ <h5 class="titleHeader">
</div>
<div class="messaging">
<div class="inbox_msg">
<div id="inbox-filters" style="display: flex; justify-content: space-between" class="d-none">
<div id="inbox-filters" style="display: flex; align-items: center;" class="d-none">
<div id="filter-podcasts" class="dropdown">
<button class="btn btn-sm btn-outline-dark text-light dropdown-toggle" type="button" data-toggle="dropdown" aria-expanded="false" style="border: .2rem transparent;">
<button class="btn btn-outline-dark text-light dropdown-toggle py-1" type="button" data-toggle="dropdown" aria-expanded="false" style="border: .2rem transparent;">
Filter by podcast
</button>
<div class="dropdown-menu" style="font-size: .875rem;">
</div>
</div>
<a href="#" class="clear-filters d-none"></a>
</div>
<div class="mesgs">
<div class="msg_history"></div>
Expand Down
18 changes: 18 additions & 0 deletions webroot/script/helipad.js
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,7 @@ $(document).ready(function () {
$('#filter-podcasts button').text(`Filtering by `).append($('<b>').text(filters.podcast));
$('#inbox-filters').removeClass('d-none')
$('.filter a').addClass('text-danger')
$('.clear-filters').removeClass('d-none')
}

$('.filter a').click((ev) => {
Expand Down Expand Up @@ -984,12 +985,29 @@ $(document).ready(function () {
$('.filter a').removeClass('text-danger')
}

$('.clear-filters').toggleClass('d-none', filters.podcast === null);

inbox.empty();
$dropdown.empty();
getBoosts(currentInvoiceIndex, 100, true, true, false);
sessionStorage.setItem(config.filterName, JSON.stringify(filters));
});
});

$('.clear-filters').on('click', async (ev) => {
filters.podcast = null;

$('.filter a').removeClass('text-danger')
$('#filter-podcasts button').text(`Filter by podcast`);
$('.clear-filters').addClass('d-none');
$('#inbox-filters').toggleClass('d-none');

inbox.empty();
$('#filter-podcasts .dropdown-menu').empty();

getBoosts(currentInvoiceIndex, 100, true, true, false);
sessionStorage.setItem(config.filterName, JSON.stringify(filters));
});
}

//Build the UI with the page loads
Expand Down
4 changes: 4 additions & 0 deletions webroot/style/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,10 @@ ul.navButtons li a[aria-selected="true"] {
display: none;
}

a.clear-filters:hover {
opacity: 0.7;
}

.spinner {
width: 1em;
height: 1em;
Expand Down

0 comments on commit e41a23b

Please sign in to comment.