Add tag filter to debates page
This commit is contained in:
@@ -33,6 +33,7 @@ var initialize_modules = function() {
|
||||
App.Stats.initialize();
|
||||
App.LocaleSwitcher.initialize();
|
||||
App.DebatesOrderSelector.initialize();
|
||||
App.DebatesTagFilter.initialize();
|
||||
};
|
||||
|
||||
$(function(){
|
||||
|
||||
17
app/assets/javascripts/debates_tag_filter.js.coffee
Normal file
17
app/assets/javascripts/debates_tag_filter.js.coffee
Normal 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))
|
||||
|
||||
Reference in New Issue
Block a user