Merge pull request #36 from Dahlgren/feature/toggle-server-mods

Check and Uncheck all mods for a server
This commit is contained in:
Björn Dahlgren 2017-03-12 11:41:26 +01:00 committed by GitHub
commit 8c16beec6e
2 changed files with 23 additions and 0 deletions

View File

@ -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) {

View File

@ -1,4 +1,6 @@
<form>
<button class="btn btn-xs btn-primary check-all">Check All</button>
<button class="btn btn-xs btn-primary uncheck-all">Uncheck All</button>
<table class="table table-striped">
<thead>
<tr>