Skip to content

Commit

Permalink
TTK-26552: Keep search text (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
albacodina authored Oct 29, 2024
1 parent a2d29a5 commit d8c4865
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Resources/views/Stats/js.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@
$('.btn-stats-search-text').on('click', function(event) {
event.preventDefault();
page = 0;
var url = new URL(window.location.href);
url.searchParams.set('page', page);
window.history.pushState({}, '', url);
var data = window.prepareSearch();
window.getAjaxRequest(data);
});
Expand All @@ -100,7 +104,10 @@
var data = window.prepareSearch();
var page_selected = $(this).data('value');
location.search = "?page="+page_selected;
var url = new URL(window.location.href);
url.searchParams.set('page', page_selected);
window.history.pushState({}, '', url);
{% if app.request.get('_route') == 'pumukit_stats_series_index' %}
window.most_viewed_series(data['criteria'], data['from_date'], data['to_date'], page_selected);
Expand Down Expand Up @@ -746,7 +753,7 @@
window.createPager = function(data) {
var pages = Math.ceil(data.total / 10);
var active_page = data.page == 0 ? data.page : parseInt("{{ app.request.get('page')|default(0) }}");
var active_page = data.page;
var aPages = range(pages,active_page);
var disabled_previous = '';
var disabled_next = '';
Expand Down

0 comments on commit d8c4865

Please sign in to comment.