Skip to content

Commit

Permalink
implement filter and use data-*
Browse files Browse the repository at this point in the history
  • Loading branch information
jollen committed Nov 15, 2014
1 parent 8ef86c2 commit 20a5d05
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 5 additions & 2 deletions public/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ app.ListView = Backbone.View.extend({
render: function() {
this.$el.html(this.template( this.model.attributes ));
},
click: function() {
this.model.filter = '/40/49';
click: function(e) {
var me = $(e.target);
var filter = me.data('filter');

this.model.filter = filter;
this.model.fetch();
}
});
Expand Down
7 changes: 6 additions & 1 deletion views/index.jade
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ block content
div#userList

script(type='text/template', id='tmpl-user-list')
button.btn.btn-primary#btn-filter 40-49
.btn-group
button.btn.btn-primary#btn-filter(data-filter='/20/29') 20-29
button.btn.btn-primary#btn-filter(data-filter='/30/39') 30-39
button.btn.btn-primary#btn-filter(data-filter='/40/49') 40-49
button.btn.btn-primary#btn-filter(data-filter='/50/59') 50-59
button.btn.btn-primary#btn-filter(data-filter='/60/69') 60-69
h3 User List
ul
<% _.each(users, function(user) { %>
Expand Down

0 comments on commit 20a5d05

Please sign in to comment.