Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.compile_template = function (name) {
var included_fns = exports.find_included_partials(name);
_.each(included_fns, function (fn) {
exports.compile_template(fn);
});
if (Handlebars.templates === undefined) {
Handlebars.templates = {};
}
if (_.has(Handlebars.template, name)) {
// we already compile the template
return;
}
var file = exports.template_finder.get(name);
var data = fs.readFileSync(file.url).toString();
Handlebars.templates[name] = Handlebars.compile(data);
};
var Handlebars = require('handlebars');
var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
templates['helloWorld'] = template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
var helper, alias1=helpers.helperMissing, alias2="function", alias3=container.escapeExpression;
return "\n\n \n <div>Hello world! "
+ alias3(((helper = (helper = helpers.message || (depth0 != null ? depth0.message : depth0)) != null ? helper : alias1),(typeof helper === alias2 ? helper.call(depth0,{"name":"message","hash":{},"data":data}) : helper)))
+ "</div>\n \n";
},"useData":true});
module.exports = templates;
var Handlebars = require("handlebars"); var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
templates['comments/form'] = template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
return "<form method="\"get\"">"
+ escapeExpression(((helper = (helper = helpers.content || (depth0 != null ? depth0.content : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"content","hash":{},"data":data}) : helper)))
+ "</form>";
},"useData":true});
templates['user/listItem'] = template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
return "<li class="\"user\"">"
+ escapeExpression(((helper = (helper = helpers.content || (depth0 != null ? depth0.content : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"content","hash":{},"data":data}) : helper)))
+ "</li>";
},"useData":true});
module.exports = templates;
var Handlebars = require('handlebars');
var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
templates['helloWorld'] = template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
var helper, alias1=helpers.helperMissing, alias2="function", alias3=container.escapeExpression;
return "\n\n \n <div>Hello world! "
+ alias3(((helper = (helper = helpers.message || (depth0 != null ? depth0.message : depth0)) != null ? helper : alias1),(typeof helper === alias2 ? helper.call(depth0,{"name":"message","hash":{},"data":data}) : helper)))
+ "</div>\n \n";
},"useData":true});
init() {
Object.keys(helpers).forEach(function (helperName) {
Handlebars.registerHelper(helperName, helpers[helperName]);
});
window.CLIQZ.templates = Handlebars.templates = templates;
Handlebars.partials = templates;
Object.keys(VIEWS).forEach(view => UI.VIEWS[view] = new (VIEWS[view])() );
window.CLIQZ.UI = UI;
window.CLIQZ.UI.init();
}
_.each(data.rows, function(row) {
var topicDoc = row.doc;
topicIds.push(topicDoc._id);
userIds.push(topicDoc.user);
topicDoc.timestamp_formatted = moment(topicDoc.timestamp).fromNow();
topicDoc.user_hash = common.userToHash(topicDoc.user);
topicDoc.gravatar_url = common.getGravatar({name: topicDoc.user}, 32);
topicDoc.short_text = topicDoc.text.substring(0, 200);
if (topicDoc.text.length > 200) topicDoc.short_text += '...';
$('.topics').append(handlebars.templates['topic-row.html'](topicDoc, {}));
});
}
define(function(require) {
var Handlebars = require('handlebars');
var Popup = Backbone.View.extend( {
className: "pop-up",
parent: "#wrapper",
template: Handlebars.templates.popup,
initialize: function(){
this.$parent = $(this.parent);
_.bindAll(this, "move", "stop");
this.render();
},
render: function(){
var html = this.template(this.model.toJSON());
this.$el.html(html).appendTo(this.$parent);
this.setup();
},
setup: function(){
this.dimensions = {
x: this.$el.width(),
renderTemplate: function(tplName, data) {
var tpl = Handlebars.templates[tplName];
this.injectTarget.html(tpl(data));
mediator.publish('content:rendered', data.page_meta);
}
});
function renderPage(pageName, next) {
pageContent.innerHTML = hb.templates['page-' + pageName](pageData[pageName]);
next();
}
render: function() {
var data = this.model.toJSON();
var template = Handlebars.templates['contextMenuItem'];
$(this.el).html(template(data)).appendTo('.context-menu-holder');
return this;
},