Refactoring: loading datastore info only once.
h3rald h3rald@h3rald.com
Sun, 22 Mar 2015 19:44:27 +0100
4 files changed,
6 insertions(+),
8 deletions(-)
M
app/js/app.js
→
app/js/app.js
@@ -3,10 +3,9 @@ 'use strict';
var app = window.LS || (window.LS = {}); app.flash = m.prop(); - app.system = m.prop(); + app.system = {}; app.init = function(info){ - app.system(info); - console.log(app.system()); + app.system = info; m.route.mode = "hash"; m.route(document.body, "/info", {
M
app/js/modules/document.js
→
app/js/modules/document.js
@@ -93,7 +93,7 @@ vm.viewDocument();
} }; vm.tools = function(){ - if (app.system().read_only) { + if (app.system.read_only) { return []; } switch (vm.action){
M
app/js/modules/guide.js
→
app/js/modules/guide.js
@@ -12,7 +12,7 @@ vm.content = Page.get(vm.id()).then(function(content){return content}, vm.flashError);
vm.edit = function(){ m.route("/document/edit/app/md/"+vm.id()+".md"); }; - vm.links = app.system().read_only ? m.prop([]) : m.prop([{action: vm.edit, title: "Edit", icon: "edit"}]); + vm.links = app.system.read_only ? m.prop([]) : m.prop([{action: vm.edit, title: "Edit", icon: "edit"}]); }; app.guide.main = function(){ return m("article.row", [