Skip to content

Commit

Permalink
Add history pseudo-feature
Browse files Browse the repository at this point in the history
could cache the results in a hash but refreshing the results via an ajax
call is probably less error prone and complex
  • Loading branch information
fiveNinePlusR committed Jan 29, 2025
1 parent 17973b4 commit 4891ddd
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions app/views/pages/activity.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,18 @@
= render partial: 'render_activity'

:javascript
$('#activity_filter').on('submit', function(e) {
e.preventDefault();
window.addEventListener("popstate", function(e) {
let url = new URL(e.target.location.href)
let pagenum = ""
if (url.searchParams.has("page")) {
pagenum = `?page=${url.searchParams.get("page")}`
}

refreshActivityList(url, pagenum, true)
});

$('#activity_filter').on('submit', function(e){
e.preventDefault()
let url = new URL(window.location.href)
refreshActivityList(url)
});
Expand All @@ -52,8 +61,6 @@
activityFilters.push(this.value);
});

let url = new URL(window.location.href);

$("#activity").html(loadingHTML());

$.ajax({
Expand Down

0 comments on commit 4891ddd

Please sign in to comment.