1 /* This is an example that uses xoslib + marionette to display the developer
4 \r For an example that uses xoslib + datatables, see xosDeveloper_datatables.js
7 \rDeveloperApp = new Marionette.Application();
9 DeveloperApp.addRegions({
\r
10 mainRegion: "#developerView"
\r
13 DeveloperApp.SliceDetailView = Marionette.ItemView.extend({
14 template: "#developer-slicedetail-template",
\r
16 className: 'developer_slicedetail'
\r
19 DeveloperApp.SliceListView = Marionette.CompositeView.extend({
21 className: "table table-bordered table-striped",
\r
22 template: "#developer-slicetable-template",
\r
23 childView: DeveloperApp.SliceDetailView,
\r
24 childViewContainer: "tbody",
\r
26 events: {"click .sort": "changeSort"},
\r
28 initialize: function() {
\r
29 this.listenTo(this.collection, 'change', this._renderChildren);
\r
32 changeSort: function(e) {
\r
33 parts=$(e.currentTarget).attr("id").split('-');
\r
36 this.collection.sortVar = fieldName;
\r
37 this.collection.sortOrder = order;
\r
38 this.collection.sort();
\r
41 attachHtml: function(compositeView, childView, index) {
\r
42 // The REST API will let admin users see everything. For the developer
\r
43 // view we still want to hide slices we are not members of.
\r
44 if (childView.model.get("sliceInfo").roles.length == 0) {
\r
47 DeveloperApp.SliceListView.__super__.attachHtml(compositeView, childView, index);
\r
51 DeveloperApp.on("start", function() {
52 var developerSliceListView = new DeveloperApp.SliceListView({
53 collection: xos.slicesPlus
\r
55 DeveloperApp.mainRegion.show(developerSliceListView);
\r
56 xos.slicesPlus.startPolling();
\r
59 $(document).ready(function(){