all repos — litestore @ bfaf9633a6259f119b0c70ec12241fc952a4f6eb

A minimalist nosql document store.

app/js/utils.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
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
var app = app || {};
var u = {};
  
(function(){
  'use strict';
  /**
   * @param mod a module
   * @param vm a view-model (with init function)
   * @param main the main view to load
   */
  u.layout = function(mod) {
  
    mod.controller = function(){
      this.navbar = new app.navbar.controller();
      mod.vm.init();
    }
  
    mod.view = function(ctrl){
      return m("div", [
        m(".container", [
            app.navbar.view(ctrl.navbar),
            m("main", [mod.main()])
          ])
      ])
    }
  }

  u.panel = function(obj){
    return m(".panel.panel-default", [
      m(".panel-heading", [
        m("h2.panel-title", obj.title)  
      ]),
      m(".panel-body", [
        obj.content
      ])
    ])
  }
  
}());