Commit 95acca20 by alexandre

Switch from select to ul for filters

parent 7d96519f
......@@ -1769,41 +1769,38 @@ window.W = window.W || {};
W.ChoiceItemView = Backbone.Marionette.View.extend({
// template: '#filters-template',
template: _.template('<%- label %> (<%- n %>)'),
tagName: 'option',
tagName: 'li',
attributes : function () {
return {
value : this.model.get( 'value' )
'data-value' : this.model.get( 'value' )
};
}
},
triggers: {
'click': 'filter'
},
});
W.ChoiceListView = Backbone.Marionette.CollectionView.extend({
tagName: 'select',
tagName: 'ol',
triggers: {
'change': 'filter',
},
childView: W.ChoiceItemView,
attributes: {
'multiple': true
childViewTriggers: {
// Propagate change events to the parent
'filter': 'filter'
},
childView: W.ChoiceItemView,
initialize: function (options) {
options.syncWith.listenTo(this, 'filter', function(view, xhr, options) {
this.queryParams[view.collection.action] = view.$el.val().join(",");
var that = this;
options.syncWith.listenTo(this, 'filter', function(view, event, options) {
console.log(view);
this.queryParams[that.collection.action] = $(event.currentTarget).data("value");
this.fetch()
});
},
onFilter: function (view, event) {
console.log(this.$el.val());
// this.collection.queryParams.score_type = $(event.currentTarget).data('value');
// this.collection.queryParams.score_type = e.val();
// this.collection.fetch();
},
});
......
<div>
<h1><%- t('Partitions existantes') %></h1>
<div id="search"></div>
<br>
<p>languages</p>
<div id="language-filter"></div>
<br>
<p>score types</p>
<div id="score-type-filter"></div>
<br>
<p>tags</p>
<div id="tag-filter"></div>
<br>
<div id="list"></div>
<div id="pagination"></div>
</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment