Sha256: 3109ae41507e22443c75ceb0482a65c67b98a4e72d95fce17f9a079daa82a901

Contents?: true

Size: 847 Bytes

Versions: 13

Compression:

Stored size: 847 Bytes

Contents

L.provide('OML.mustache', ["vendor/mustache/mustache.js", 'vendor/bootstrap/css/bootstrap.css'], function () {

  if (typeof(OML) == "undefined") OML = {};

  OML['mustache'] = function(opts) {
    
    var moustache = {
      version: "0.1",
    }
    
    var context = opts.context || {};
    var el = $('#' + opts.base_id);
    var render_f = function(template) {
      var html = Mustache.to_html(template, context);
      el.html(html);
      var i = 0;
    };
    
    var text = opts.text;
    if (text) { //} != undefined) {
      render_f(text);
    } else {
      var template_url = opts.template;
      if (! template_url) {
        throw "Missing template declaration in mustache widget";
      }
      $.ajax({
        url: '/resource/' + template_url,
        type: 'get'
      }).done(render_f);
    }

    return moustache;
  }
})

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
omf_web-1.2.9 share/htdocs/js/mustache.js
omf_web-1.2.8 share/htdocs/js/mustache.js
omf_web-1.2.7 share/htdocs/js/mustache.js
omf_web-1.2.6 share/htdocs/js/mustache.js
omf_web-1.2.5 share/htdocs/js/mustache.js
omf_web-1.2.4 share/htdocs/js/mustache.js
omf_web-1.2.3 share/htdocs/js/mustache.js
omf_web-1.2.2 share/htdocs/js/mustache.js
omf_web-1.2.1 share/htdocs/js/mustache.js
omf_web-1.2.0 share/htdocs/js/mustache.js
omf_web-1.0.0 share/htdocs/js/mustache.js
omf_web-0.9.9 share/htdocs/js/mustache.js
omf_web-0.9.8 share/htdocs/js/mustache.js