handlebars.js

Accessing an Ember.Mixin within a custom handlebars helper

不打扰是莪最后的温柔 提交于 2019-12-23 06:05:05
问题 Is there an elegant way of using methods defined in an Ember.Mixin object within a custom handlebars helper? For example, in my case I have a mixin, App.Format which contains a bunch of different methods for formatting numbers, dates, ect and I would like to make some of these methods accessible directly from templates via custom helpers (e.g. {{formatNumber 450324}} ). The reason I don't just put the method implementation directly in the helper instead of the mixin is that I also need these

Accessing an Ember.Mixin within a custom handlebars helper

邮差的信 提交于 2019-12-23 06:04:17
问题 Is there an elegant way of using methods defined in an Ember.Mixin object within a custom handlebars helper? For example, in my case I have a mixin, App.Format which contains a bunch of different methods for formatting numbers, dates, ect and I would like to make some of these methods accessible directly from templates via custom helpers (e.g. {{formatNumber 450324}} ). The reason I don't just put the method implementation directly in the helper instead of the mixin is that I also need these

Safe way to let users register handelbars helpers in nodejs

一个人想着一个人 提交于 2019-12-23 05:05:52
问题 I have a node js web app that is using handlebars. Users are asking me to let them register their own handlebars helpers. I'm quite hesitant about letting them do it... but I'll give it a go if there is a secure way of doing it so. var Handlebars = require("handlebars"); var fs = require("fs"); var content = fs.readFileSync("template.html", "utf8"); //This helper will be posted by the user var userHandlebarsHelpers = "Handlebars.registerHelper('foo', function(value) { return 'Foo' + value; })

Datepicker inside a handlebars template

半城伤御伤魂 提交于 2019-12-23 04:51:33
问题 I am trying to figure out a way to have jqueryui datepicker inside handlebars template. So far I have the following that doesn't seem to work: > <script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.0/jquery-ui.min.js"></script> > <script> > $(function () { > $(".datePicker").datepicker(); > }); </script> <script id="template-row" type="text/x-handlebars-template"> <div class="returnRow{{#if altRow}} returnRow-alt{{/if}} clearfix"> <input type="hidden" class="return-id" value="{{ID}}" /

ember handlebars: find which addon is defining a helper (Not present in app/helpers)

瘦欲@ 提交于 2019-12-23 04:28:13
问题 Having a hard time finding out where a helper not in app/helpers is defined. The helper was very generically named, I searched my package.json for the helper name but there was nothing. I was stuck hunting around with google to try and figure out what addon defined it. Given some helper ( {{totally-generic-name param1="foo"}} ) how would one go about finding where it's defined? (I happen to be on Ember 2.13) (Note: the helper was contains defined in ember-composable-helpers , so it would have

Binding child views and collections within an outlet in emberjs

和自甴很熟 提交于 2019-12-22 12:43:06
问题 I'm trying to render a view Team inside of an {{outlet}} . This Team view is comprised of a simple Person view (the team leader), and a collection of Person views (team members). The outlet is set up by calling connectOutlet() on the ApplicationController. Although the Person child views are rendered in the markup as expected, all the values of name are missing. It sure seems like my bindings and/or controller are not set up properly. What am I missing? Code and demo: http://jsfiddle.net

grunt-contrib-handlebars - Output is different than when I run the handlebars npm task

雨燕双飞 提交于 2019-12-22 10:28:13
问题 Thank you in advance for your time and help. I'm trying to precompile handlebars (.hbs) templates using grunt-contrib-handlebars When I run the run task I end up with this: this["JST"] = this["JST"] || {}; this["JST"]["app/templates/err.hbs"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'>= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; var buffer = "", stack1, functionType="function", escapeExpression=this

metalsmith-collections 'path' key not accessible from Handlebars template?

狂风中的少年 提交于 2019-12-22 10:25:33
问题 My template: {{#each collections }} <span class="Category__Title">{{ @key }}</span> {{#each this }} <a href="{{ this.path }}">{{ this.title }}</a> {{/each}} {{/each}} Renders ( this.path is undefined ): <span class="Category__Title">French</span> <a href="">Braised vegetables</a> <span class="Category__Title">Thai</span> <a href="">Rice noodles</a> I'm using metalsmith: metalsmith .use(collections()) .use(markdown()) .use(templates({ engine: 'handlebars', directory: 'templates' })) .use

metalsmith-collections 'path' key not accessible from Handlebars template?

若如初见. 提交于 2019-12-22 10:18:07
问题 My template: {{#each collections }} <span class="Category__Title">{{ @key }}</span> {{#each this }} <a href="{{ this.path }}">{{ this.title }}</a> {{/each}} {{/each}} Renders ( this.path is undefined ): <span class="Category__Title">French</span> <a href="">Braised vegetables</a> <span class="Category__Title">Thai</span> <a href="">Rice noodles</a> I'm using metalsmith: metalsmith .use(collections()) .use(markdown()) .use(templates({ engine: 'handlebars', directory: 'templates' })) .use

Turn a meteor method returning a single object into a context for handlebar

馋奶兔 提交于 2019-12-22 09:40:07
问题 In the basic leaderboard example on meteor.com there is a method called selected_name. Template.leaderboard.selected_name = function () { var player = Players.findOne(Session.get("selected_player")); return player && player.name; }; {{#if selected_name}} <div class="details"> <div class="name">{{selected_name}}</div> <input type="button" class="inc" value="Give 5 points" /> </div> {{/if}} Instead I would like to return the entire player object and then have that object be treated as a context