1
0
Fork 0

Added views for foxxes that display either mounts or apps

This commit is contained in:
Michael Hackstein 2013-03-27 12:06:31 +01:00
parent d8159a990e
commit 23de5ec092
6 changed files with 128 additions and 0 deletions

View File

@ -0,0 +1,14 @@
<small>
<div class="plain">
<% var appInfos = attributes.app.split(":"); %>
<h5 class="applicationName"><%= appInfos[1] %></h5>
<p>
<!--Description: <%=attributes.description %><br /> -->
Mount-Point: <%=attributes.mount %><br />
Version: <%=appInfos[2] %><br />
Prefix: <%=attributes.collectionPrefix%><br />
Active: <%=attributes.active%>
<!--Git: <a href=<%=attributes.git %>>Repository</a>-->
</p>
</div>
</small>

View File

@ -0,0 +1,11 @@
<small>
<div class="plain">
<h5 class="applicationName"><%= attributes.name %></h5>
<p>
Description: <%=attributes.description %><br />
Path: <%=attributes.path %><br />
Version: <%=attributes.version %><br />
<!--Git: <a href=<%=attributes.git %>>Repository</a>-->
</p>
</div>
</small>

View File

@ -0,0 +1,34 @@
var FoxxActiveListView = Backbone.View.extend({
el: '#content',
template: new EJS({url: '/_admin/html/js/templates/foxxListView.ejs'}),
events: {
// 'click button#add': 'callback'
},
initialize: function() {
this._subViews = {};
var self = this;
this.collection.fetch({
success: function() {
self.collection.where({type: "mount"}.each(function (foxx) {
var subView = new window.FoxxActiveView({model: foxx});
self._subViews[foxx.get('_id')] = subView;
});
self.render();
}
});
this.render();
},
render: function() {
$(this.el).html(this.template.text);
var self = this;
_.each(this._subViews, function (v) {
$("#foxxList").append(v.render());
});
this.delegateEvents();
return this;
}
});

View File

@ -0,0 +1,18 @@
window.FoxxActiveView = Backbone.View.extend({
tagName: 'li',
className: "span3",
template: new EJS({url: '/_admin/html/js/templates/foxxView.ejs'}),
events: {
// 'click button#add': 'callback'
},
initialize: function(){
_.bindAll(this, 'render');
},
render: function(){
$(this.el).html(this.template.render(this.model));
return $(this.el);
}
});

View File

@ -0,0 +1,33 @@
var FoxxInstalledListView = Backbone.View.extend({
el: '#content',
template: new EJS({url: '/_admin/html/js/templates/foxxListView.ejs'}),
events: {
// 'click button#add': 'callback'
},
initialize: function() {
this._subViews = {};
var self = this;
this.collection.fetch({
success: function() {
self.collection.where({type: "app"}).each(function (foxx) {
var subView = new window.FoxxInstalledView({model: foxx});
self._subViews[foxx.get('_id')] = subView;
});
self.render();
}
});
},
render: function() {
$(this.el).html(this.template.text);
var self = this;
_.each(this._subViews, function (v) {
$("#foxxList").append(v.render());
});
this.delegateEvents();
return this;
}
});

View File

@ -0,0 +1,18 @@
window.FoxxInstalledView = Backbone.View.extend({
tagName: 'li',
className: "span3",
template: new EJS({url: '/_admin/html/js/templates/foxxInstalledView.ejs'}),
events: {
// 'click button#add': 'callback'
},
initialize: function(){
_.bindAll(this, 'render');
},
render: function(){
$(this.el).html(this.template.render(this.model));
return $(this.el);
}
});