Skip to content

Commit

Permalink
sort
Browse files Browse the repository at this point in the history
  • Loading branch information
Joanna committed Sep 17, 2019
1 parent 0ead8aa commit 83908eb
Showing 1 changed file with 16 additions and 23 deletions.
39 changes: 16 additions & 23 deletions apps/templates/snippets/sort_dropdown.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,22 +86,19 @@


function ascaddURL(element) {
debugger;
$(element).attr('href', function () {
if (window.location.search.length == 0) {
location.href = this.href + '?sort=title&order=asc';
return location.href;
this.href = this.href + '?sort=title&order=asc';
return this.href;
} else if (window.location.search.match(/[?&]order=asc/gi)) {
location.href = this.href.replace('order=asc', 'order=asc');
return location.href;
this.href = this.href.replace('order=asc', 'order=asc');
return this.href;
} else if (window.location.search.match(/[?&]order=desc/gi)) {
location.href = this.href.replace('order=desc', 'order=asc');
return location.href;

this.href = this.href.replace('order=desc', 'order=asc');
return this.href;
} else {
location.href = this.href + '&order=asc';
return location.href;

this.href = this.href + '&order=asc';
return this.href;
}
});
}
Expand All @@ -110,21 +107,17 @@

$(element).attr('href', function () {
if (window.location.search.length == 0) {
location.href = this.href + '?sort=title&order=desc';
return location.href;

this.href = this.href + '?sort=title&order=desc';
return this.href;
} else if (window.location.search.match(/[?&]order=asc/gi)) {
location.href = this.href.replace('order=asc', 'order=desc');
return location.href;

this.href = this.href.replace('order=asc', 'order=desc');
return this.href;
} else if (window.location.search.match(/[?&]order=desc/gi)) {
location.href = this.href.replace('order=desc', 'order=desc');
return location.href;

this.href = this.href.replace('order=desc', 'order=desc');
return this.href;
} else {
location.href = this.href + '&order=desc';
return location.href;

this.href = this.href + '&order=desc';
return this.href;
}
});
}
Expand Down

0 comments on commit 83908eb

Please sign in to comment.