Add tag filter to debates page

This commit is contained in:
Marko Lovic
2015-08-28 12:41:10 +02:00
parent 1d997d4929
commit 4285ba4bb3
5 changed files with 74 additions and 6 deletions

View File

@@ -33,6 +33,7 @@ var initialize_modules = function() {
App.Stats.initialize();
App.LocaleSwitcher.initialize();
App.DebatesOrderSelector.initialize();
App.DebatesTagFilter.initialize();
};
$(function(){

View File

@@ -0,0 +1,17 @@
App.DebatesTagFilter =
href_with_params: (query_params) ->
loc = window.location
loc.protocol + "//" + loc.hostname +
(if loc.port then ':' + loc.port else '') +
loc.pathname +
loc.hash +
'?' + $.param(query_params)
initialize: ->
$('.js-tag-filter').on 'change', ->
query_params = window.getQueryParameters()
query_params['tag'] = $(this).val()
window.location.assign(App.DebatesTagFilter.href_with_params(query_params))