1
0
Fork 0

Application View skeleton

This commit is contained in:
Lucas Dohmen 2014-12-11 22:44:33 +01:00 committed by Michael Hackstein
parent 83004b08f4
commit 552014bf2f
6 changed files with 37 additions and 6 deletions

View File

@ -3,6 +3,8 @@
"use strict";
window.Foxx = Backbone.Model.extend({
idAttribute: '_key',
defaults: {
"title": "",
"version": "",
@ -23,6 +25,5 @@
isNew: function() {
return false;
}
});
}());

View File

@ -19,6 +19,7 @@
"api": "api",
"databases": "databases",
"applications": "applications",
"applications/:key": "applicationDetail",
"application/documentation/:key": "appDocumentation",
"graph": "graphManagement",
"userManagement": "userManagement",
@ -107,6 +108,16 @@
return true;
},
applicationDetail: function (key) {
if (this.foxxList.length === 0) {
this.foxxList.fetch({ async: false });
}
var applicationDetailView = new window.ApplicationDetailView({
model: this.foxxList.get(key)
});
applicationDetailView.render();
},
login: function () {
if (!this.loginView) {
this.loginView = new window.loginView({

View File

@ -0,0 +1,3 @@
<script id="applicationDetailView.ejs" type="text/template">
Hello <%= attributes.name %>
</script>

View File

@ -0,0 +1,18 @@
/*jshint browser: true */
/*jshint strict: false, unused: false */
/*global Backbone, $, window, arangoHelper, templateEngine, Joi, _*/
window.ApplicationDetailView = Backbone.View.extend({
el: '#content',
template: templateEngine.createTemplate('applicationDetailView.ejs'),
events: {
},
render: function() {
console.log(this.model);
$(this.el).html(this.template.render(this.model));
return $(this.el);
}
});

View File

@ -15,11 +15,7 @@
},
openAppDetailView: function() {
// var url = window.location.origin + "/_db/" +
// encodeURIComponent(arangoHelper.currentDatabase()) +
// this.model.get("mount");
// var windowRef = window.open(url, this.model.get("title"));
alert('Michael will insert something here for ' + this.model.get('mount') + '. Stay tuned.');
window.App.navigate('applications/' + encodeURIComponent(this.model.get('_key')), { trigger: true });
},
render: function(){

View File

@ -26,6 +26,7 @@
"frontend/js/templates/apiView.ejs",
"frontend/js/templates/appDocumentationView.ejs",
"frontend/js/templates/applicationsView.ejs",
"frontend/js/templates/applicationDetailView.ejs",
"frontend/js/templates/arangoTabbar.ejs",
"frontend/js/templates/arangoTable.ejs",
"frontend/js/templates/collectionsItemView.ejs",
@ -143,6 +144,7 @@
"frontend/js/views/apiView.js",
"frontend/js/views/appDocumentationView.js",
"frontend/js/views/applicationsView.js",
"frontend/js/views/applicationDetailView.js",
"frontend/js/views/collectionsItemView.js",
"frontend/js/views/collectionsView.js",
"frontend/js/views/databaseView.js",