Skip to content

Commit

Permalink
Avoided leading ?& GET parameters. (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredahern authored Feb 22, 2021
1 parent a0aea31 commit 1799f78
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion rangefilter/static/rangefilter/iife.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
function(event){
event.preventDefault();
var form_data = django.jQuery('#'+form_name).serialize();
window.location = window.location.pathname + query_string + '&' + form_data;
amp = query_string == "?" ? "" : "&"; // avoid leading ?& combination
window.location = window.location.pathname + query_string + amp + form_data;
});

// Bind reset buttons
Expand Down
3 changes: 2 additions & 1 deletion rangefilter/templates/rangefilter/date_filter.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ <h3>{{ title }}</h3>
event.preventDefault();
var query_string = django.jQuery('input#'+qs_name).val();
var form_data = django.jQuery('#'+form_name).serialize();
window.location = window.location.pathname + query_string + '&' + form_data;
amp = query_string == "?" ? "" : "&"; // avoid leading ?& combination
window.location = window.location.pathname + query_string + amp + form_data;
}
function datefilter_reset(qs_name){
var query_string = django.jQuery('input#'+qs_name).val();
Expand Down
4 changes: 2 additions & 2 deletions rangefilter/templates/rangefilter/date_filter_1_8.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ <h3>{{ title }}</h3>
function datefilter_apply(event, qs_name, form_name){
event.preventDefault();
var query_string = django.jQuery('input#'+qs_name).val();
var form_data = django.jQuery('#'+form_name).serialize();
window.location = window.location.pathname + query_string + '&' + form_data;
amp = query_string == "?" ? "" : "&"; // avoid leading ?& combination
window.location = window.location.pathname + query_string + amp + form_data;
}
function datefilter_reset(qs_name){
var query_string = django.jQuery('input#'+qs_name).val();
Expand Down

0 comments on commit 1799f78

Please sign in to comment.