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