mirror of
https://github.com/Dahlgren/arma-server-web-admin.git
synced 2024-08-30 17:22:10 +00:00
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
|
define(function (require) {
|
||
|
|
||
|
"use strict";
|
||
|
|
||
|
var $ = require('jquery'),
|
||
|
_ = require('underscore'),
|
||
|
Backbone = require('backbone'),
|
||
|
Marionette = require('marionette'),
|
||
|
EmptyView = require('app/views/servers/empty'),
|
||
|
ListItemView = require('app/views/servers/list_item'),
|
||
|
tpl = require('text!tpl/servers/list.html'),
|
||
|
|
||
|
template = _.template(tpl);
|
||
|
|
||
|
return Marionette.CompositeView.extend({
|
||
|
itemView: ListItemView,
|
||
|
itemViewContainer: "tbody",
|
||
|
template: template,
|
||
|
|
||
|
emptyView: EmptyView,
|
||
|
|
||
|
buildItemView: function(item, ItemViewType, itemViewOptions){
|
||
|
// build the final list of options for the item view type
|
||
|
var options = _.extend({model: item}, itemViewOptions);
|
||
|
|
||
|
if (ItemViewType == EmptyView) {
|
||
|
options = _.extend({servers: this.collection}, options);
|
||
|
}
|
||
|
|
||
|
// create the item view instance
|
||
|
var view = new ItemViewType(options);
|
||
|
// return it
|
||
|
return view;
|
||
|
},
|
||
|
});
|
||
|
});
|