From c8bee03f8c0ca82c3981724e5bc661f630d9ab7e Mon Sep 17 00:00:00 2001 From: RaNaN Date: Tue, 19 Feb 2013 22:13:10 +0100 Subject: integrated new package view --- module/web/static/js/views/fileView.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'module/web/static/js/views/fileView.js') diff --git a/module/web/static/js/views/fileView.js b/module/web/static/js/views/fileView.js index 7e8f899a9..86f7b33d2 100644 --- a/module/web/static/js/views/fileView.js +++ b/module/web/static/js/views/fileView.js @@ -9,7 +9,7 @@ define(['jquery', 'backbone', 'underscore', 'app', 'views/abstract/itemView'], // template: _.template($("#template-file").html()), template: _.compile($("#template-file").html()), events: { - + 'click .checkbox': 'select' }, initialize: function() { @@ -25,6 +25,15 @@ define(['jquery', 'backbone', 'underscore', 'app', 'views/abstract/itemView'], render: function() { this.$el.html(this.template(this.model.toJSON())); return this; + }, + + select: function(e) { + e.preventDefault(); + var checked = this.$('.checkbox').hasClass('checked'); + // toggle class immediately, so no re-render needed + this.model.set('selected', !checked, {silent: true}); + this.$('.checkbox').toggleClass('checked'); + App.vent.trigger('file:selection'); } }); -- cgit v1.2.3