all repos — litestore @ 98a52155446efe3062f71ef0a0b45a577ad365e6

A minimalist nosql document store.

src/admin/js/components/guide.js

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
(function(){
  'use strict';
  var app = window.LS || (window.LS = {});
  var u = app.utils;

  // Guide Module
  app.guide = {vm: {}};
  app.guide.vm.init = function() {
    var vm = this;
    vm.id = m.prop(m.route.param("id"));
    vm.content = Page.get(vm.id()).then(function(content){return content}, vm.flashError);
    vm.edit = function(){
      m.route("/document/edit/admin/md/"+vm.id()+".md");
    };
    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", [
      u.toolbar({links: app.guide.vm.links()}),
      m.trust(app.guide.vm.content())
    ]);
  };

  u.layout(app.guide);

}());