all repos — litestore @ 75f584a8174742f7450c0fde20896a0427e1c064

A minimalist nosql document store.

Minor updates related to appdir.
h3rald h3rald@h3rald.com
Sat, 04 Apr 2015 20:40:09 +0200
commit

75f584a8174742f7450c0fde20896a0427e1c064

parent

707dd7955cebb561a97a9ee41ab382e381afe85d

1 files changed, 5 insertions(+), 4 deletions(-)

jump to
M admin/js/modules/document.jsadmin/js/modules/document.js

@@ -7,6 +7,7 @@ // Document module

app.document = {vm: {}}; app.document.vm.init = function() { var vm = this; + vm.dir = app.system.directory; vm.id = m.prop(m.route.param("id")); vm.action = m.route.param("action"); vm.readOnly = true;

@@ -24,9 +25,9 @@ vm.tags = doc.tags;

}, vm.flashError); }; vm.viewDocument = function(){ - if (vm.ext === "md" && vm.id().match(/^app\/md\//)) { + if (vm.ext === "md" && vm.id().match(new Regexp("^"+vm.dir+"\/md\/"))) { // If editing a documentation page, go back to the guide. - m.route("/guide/"+vm.id().replace(/\.md$/, "").replace(/^app\/md\//, "")); + m.route("/guide/"+vm.id().replace(/\.md$/, "").replace(new Regexp("^"+vm.dir+"\/md\/"), "")); } else { m.route("/document/view/"+vm.id()); }

@@ -62,7 +63,7 @@ vm.viewDocument();

}, vm.flashError); }; if (vm.action === "create") { - doc.id = "app/"+vm.id(); + doc.id = vm.dir+"/"+vm.id(); vm.id(doc.id); Doc.get(doc.id) .then(function(){

@@ -115,7 +116,7 @@ var vm = app.document.vm;

var titleLeft = vm.id(); var titleRight = m("span.pull-right", vm.tags.map(function(t){return u.taglink(t);})); if (vm.action === "create"){ - titleLeft = m("span", ["app/",m("input", { + titleLeft = m("span", [vm.dir+"/",m("input", { placeholder: "Document ID", onchange: m.withAttr("value", function(value){ vm.id(value);