meteor-blaze

How do I iterate over an unknown object in a Meteor Spacebars template?

大憨熊 提交于 2019-12-13 06:39:23
问题 So I have a Meteor Collection. Each object/document in that collection can have an unknown structure. That is to say, I don't know the name of each property, nor how many there are, until runtime. Essentially, each object in the collection is created from arbitrary data people provide via my front-end page (via CSV upload, which works fine). So I don't initialize the collection when Meteor starts. Now I'd like to create a table in my HTML page, that renders the collection, but without me pre

Google Maps with Meteor and a reactive InfoWindow

淺唱寂寞╮ 提交于 2019-12-13 06:25:12
问题 I have a google maps API v3 application for meteor that I'm currently working on. When a person clicks on a marker, it shows an infoWindow with some at-window-creation time static content. What I would like to do is use a reactive template to render the infoWindow's contents, either directly as HTML which can change or by referring to a dom element that updates reactively. I've verified that if I use an infoWindow to refer to a DOM element, and that element's contents change, the Maps API

Issue with subscriptions on multiple instances of a template

99封情书 提交于 2019-12-13 05:59:33
问题 Here is the scenario. I have a template that contains a #each loop and renders an instance of a particular template, setting the data context on each template as per the docs. <template name = 'live'> <div class = 'row'> {{#each runways}} <div class = 'col-md-2'> {{> runway_panel}} </div> {{/each}} </div> </template> And this is the helper backing it: Template.live.helpers({ runways: function(){ return Runway_Data.find(); } }); This works, my issue is as follows. Each live_event_log instance

Meteor and Iron Router subscription queries

ぃ、小莉子 提交于 2019-12-13 05:24:52
问题 I found that I can just call a findOne in a global function and I'll have access to the subscription... The only thing I'm confused about is, how global a function distinguishes between collections, one subscription to the other. // pubs Meteor.publish("just_dob_and_id_shared_collection", function () { return shared_collection.find({_id: this.userId}, {fields: {'dob': 1}}); }); Meteor.publish("entire_recordset_shared_collection", function () { return shared_collection.find({_id: this.userId})

Using helper arguments and template keyword arguments at the same time

a 夏天 提交于 2019-12-13 02:26:43
问题 I have a template taskList that receives a list of tasks and an options hash as arguments like this: {{> taskList tasks=taskHelper options=listOptions}} In this case, the taskHelper returns all existing tasks. Is it possible to pass arguments to the taskHelper in this scenario? For example, if I want to show only done tasks in the template, I would like to do something like this: {{> taskList tasks=taskHelper 'done' options=listOptions}} That won't work because the template compiler doesn't

How to put a reactive Template inside of a Surface in famo.us/Meteor

被刻印的时光 ゝ 提交于 2019-12-13 02:13:26
问题 I've read several posts on this but nothing that would really answer my question in an up-to-date way (i.e. UI.insert is depreciated). So what's the best way of inserting/rendering a Template into a Surface reactively, meaning, not only one data object (renderWithData), but whatever is defined in the Template.helpers should also be updated reactively. Code tried so far: var div = document.createElement('div'); //UI.insert(UI.render(function() { return Template.hello; }), div); surface = new

Fastest way to check whether the cursor returned by a template helper is empty?

做~自己de王妃 提交于 2019-12-13 02:10:19
问题 I often do something like this, using the items helper twice: {{#if items}} <h1>Items</h1> {{#each items}} {{> item}} {{/each}} {{/if}} Template.foo.helpers items: -> Items.find bar: true , sort: created: -1 transform: (item) -> i.good = true i Is Meteor doing extra work in this scenario? Would it be more efficient to switch the if to use something like areItems ? areItems: -> Items.find bar: true .count() > 0 回答1: In the template, you can use {{#with items}} and then either 'this.count' or

Meteor: How to use object names including dashes in Spacebars

半世苍凉 提交于 2019-12-12 22:08:33
问题 Didn't find the answer anywhere, but maybe one of you knows it. I'm getting back data from http.call('GET'), I can use the data correctly in Spacebars like {{anydata.specificdata}} but have no chance to use data w/ object names containing dashes like {{anydata.specific-data}} I tried {{anydata.'specific-data'}} , but this does not work either. As I'm retrieving a lot of different data I would like to avoid to create helpers for every field containing dashes. Does anyone know how I could

JQuery and Reactive Meteor Components

泪湿孤枕 提交于 2019-12-12 21:18:59
问题 I am using jquery steps in order to render a wizard within a Blaze template. js: Template.form.onRendered( function () { var form = $("#form1"); form.children("div").steps({ headerTag: "h4", bodyTag: "fieldset", transitionEffect: "slideLeft" }) }) Template.form.helpers({ person : function () { return People.find(); }, }) html : <template name="form"> <form id="form1"> <div> <h4>1</h4> <fieldset> <small>First Step</small> </fieldset> <h4>2</h4> <fieldset> <small>Second Step</small> </fieldset>

How do I convert Handlebars isEq helper to Spacebars in Meteor?

岁酱吖の 提交于 2019-12-12 19:29:23
问题 I've had in my Meteor project handlebar helper: Handlebars.registerHelper('isEq', function(v1, v2, options){ if(v1 === v2){ return options.fn(this); }else{ return options.inverse(this); } }); But after update to 0.8 and switch from handlebars to spacebars it is not working anymore - I've found in other stackoverflow topic that now I should change Handlebars.registerHelper to UI.registerHelper but it is still not working - anyone know how to implement this properly for spacebars? 回答1: You want