From 5c1a0337fa79e1f9c591114880514679385c959c Mon Sep 17 00:00:00 2001 From: Michael Hackstein Date: Wed, 27 Mar 2013 19:30:18 +0100 Subject: [PATCH] Frontend: Added Edit-Icon to running foxxes, but no functionality yet, Foxxes are now reloaded whenever application is opened, no reload of Admin-Interface necessary anymore. --- html/admin/css/foxxView.css | 2 +- html/admin/js/routers/router.js | 4 ++-- html/admin/js/templates/foxxActiveView.ejs | 3 +++ html/admin/js/views/foxxActiveListView.js | 16 ++++++++++++++++ html/admin/js/views/foxxActiveView.js | 6 +++++- html/admin/js/views/foxxInstalledListView.js | 14 ++++++++++++++ 6 files changed, 41 insertions(+), 4 deletions(-) diff --git a/html/admin/css/foxxView.css b/html/admin/css/foxxView.css index a05f5f56b4..0fe7bc510b 100644 --- a/html/admin/css/foxxView.css +++ b/html/admin/css/foxxView.css @@ -2,7 +2,7 @@ padding-top: 30px; } .foxxDescription { - width:190px; + width:170px; float: left; text-align: left; word-wrap: break-word; diff --git a/html/admin/js/routers/router.js b/html/admin/js/routers/router.js index b96bed2992..5519543723 100644 --- a/html/admin/js/routers/router.js +++ b/html/admin/js/routers/router.js @@ -164,7 +164,7 @@ $(document).ready(function() { collection: this.foxxList }); } - this.applicationsInstalledView.render(); + this.applicationsInstalledView.reload(); this.naviView.selectMenuItem('applications-menu'); }, @@ -177,7 +177,7 @@ $(document).ready(function() { collection: this.foxxList }); } - this.applicationsActiveView.render(); + this.applicationsActiveView.reload(); this.naviView.selectMenuItem('applications-menu'); }, diff --git a/html/admin/js/templates/foxxActiveView.ejs b/html/admin/js/templates/foxxActiveView.ejs index 4d96b29f23..e2dc4ad453 100644 --- a/html/admin/js/templates/foxxActiveView.ejs +++ b/html/admin/js/templates/foxxActiveView.ejs @@ -2,6 +2,9 @@
<% var appInfos = attributes.app.split(":"); %>
<%= appInfos[1] %>
+
+ +
icon

diff --git a/html/admin/js/views/foxxActiveListView.js b/html/admin/js/views/foxxActiveListView.js index 7024824f61..741d6bf0a7 100644 --- a/html/admin/js/views/foxxActiveListView.js +++ b/html/admin/js/views/foxxActiveListView.js @@ -16,11 +16,27 @@ var FoxxActiveListView = Backbone.View.extend({ self._subViews[foxx.get('_id')] = subView; }); self.render(); + }, + error: function() { + console.log("Erroreoror!!"); } }); this.render(); }, + reload: function() { + var self = this; + this.collection.fetch({ + success: function() { + self._subViews = {}; + _.each(self.collection.where({type: "mount"}), function (foxx) { + var subView = new window.FoxxActiveView({model: foxx}); + self._subViews[foxx.get('_id')] = subView; + }); + self.render(); + } + }); + }, render: function() { $(this.el).html(this.template.text); diff --git a/html/admin/js/views/foxxActiveView.js b/html/admin/js/views/foxxActiveView.js index f92fd69fb6..b16b5db016 100644 --- a/html/admin/js/views/foxxActiveView.js +++ b/html/admin/js/views/foxxActiveView.js @@ -4,13 +4,17 @@ window.FoxxActiveView = Backbone.View.extend({ template: new EJS({url: '/_admin/html/js/templates/foxxActiveView.ejs'}), events: { - // 'click button#add': 'callback' + 'click .icon-edit': 'editFoxx' }, initialize: function(){ _.bindAll(this, 'render'); }, + editFoxx: function() { + alert("Functionality will be added soon: You will be able to configure your foxx here.") + }, + render: function(){ $(this.el).html(this.template.render(this.model)); return $(this.el); diff --git a/html/admin/js/views/foxxInstalledListView.js b/html/admin/js/views/foxxInstalledListView.js index 84fcd7ac3d..b5a01f2e4c 100644 --- a/html/admin/js/views/foxxInstalledListView.js +++ b/html/admin/js/views/foxxInstalledListView.js @@ -20,6 +20,20 @@ var FoxxInstalledListView = Backbone.View.extend({ }); }, + reload: function() { + var self = this; + this.collection.fetch({ + success: function() { + self._subViews = {}; + _.each(self.collection.where({type: "app"}), 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);