diff --git a/public/js/app/views/servers/mods/list.js b/public/js/app/views/servers/mods/list.js index 0691deb..7ede2c1 100644 --- a/public/js/app/views/servers/mods/list.js +++ b/public/js/app/views/servers/mods/list.js @@ -15,12 +15,33 @@ define(function (require) { itemView: ListItemView, template: _.template(tpl), + events: { + "click .check-all": "checkAll", + "click .uncheck-all": "uncheckAll", + }, + buildItemView: function(item, ItemViewType, itemViewOptions){ var options = _.extend({model: item, server: this.options.server}, itemViewOptions); var view = new ItemViewType(options); return view; }, + changeAllCheckbox: function(checked) { + this.$('input:checkbox').map(function (idx, el) { + return $(el).prop('checked', checked); + }) + }, + + checkAll: function(e) { + e.preventDefault(); + this.changeAllCheckbox(true); + }, + + uncheckAll: function(e) { + e.preventDefault(); + this.changeAllCheckbox(false); + }, + serialize: function() { return { mods: this.$('input:checkbox:checked').map(function (idx, el) { diff --git a/public/js/tpl/servers/mods/list.html b/public/js/tpl/servers/mods/list.html index 89db93a..f87f3bb 100644 --- a/public/js/tpl/servers/mods/list.html +++ b/public/js/tpl/servers/mods/list.html @@ -1,4 +1,6 @@