mirror of
https://github.com/Dahlgren/arma-server-web-admin.git
synced 2024-08-30 17:22:10 +00:00
Merge pull request #36 from Dahlgren/feature/toggle-server-mods
Check and Uncheck all mods for a server
This commit is contained in:
commit
8c16beec6e
@ -15,12 +15,33 @@ define(function (require) {
|
|||||||
itemView: ListItemView,
|
itemView: ListItemView,
|
||||||
template: _.template(tpl),
|
template: _.template(tpl),
|
||||||
|
|
||||||
|
events: {
|
||||||
|
"click .check-all": "checkAll",
|
||||||
|
"click .uncheck-all": "uncheckAll",
|
||||||
|
},
|
||||||
|
|
||||||
buildItemView: function(item, ItemViewType, itemViewOptions){
|
buildItemView: function(item, ItemViewType, itemViewOptions){
|
||||||
var options = _.extend({model: item, server: this.options.server}, itemViewOptions);
|
var options = _.extend({model: item, server: this.options.server}, itemViewOptions);
|
||||||
var view = new ItemViewType(options);
|
var view = new ItemViewType(options);
|
||||||
return view;
|
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() {
|
serialize: function() {
|
||||||
return {
|
return {
|
||||||
mods: this.$('input:checkbox:checked').map(function (idx, el) {
|
mods: this.$('input:checkbox:checked').map(function (idx, el) {
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
<form>
|
<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">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
Loading…
Reference in New Issue
Block a user