iron-router

Jquery (metis-menu) not working with iron:router in meteor

自古美人都是妖i 提交于 2020-01-06 03:28:27
问题 I'm trying to implement a sidebar (leveraging the sidebar from sb-admin-2When I use the side bar as part of main.html, the toggles work perfectly fine. However, when I implement the same via iron:router and set the sidebar to be persistent, the sidebar loses the toggle/hide functionality. basically, the child level elements are always expanded and I have no means to hide those child level elements. Is there a work around to this? I've the side bar code here in pastie --> This works when in

Meteor cannot get data

流过昼夜 提交于 2020-01-04 14:21:31
问题 Im new to meteor, I have a problem I can't get collection from mongodb (i use iron router ) /client/routes.js Router.route('/page', function(){ this.render('page'); }); /client/foo.js city = new Mongo.Collection('data'); if (Meteor.isClient) { Template.foo.helpers({ data: function(){ return city.find(); } }); } client/views/foo.html <template name="foo"> {{#each data}} {{> all_data}} {{/each}} </template> <template name="all_data"> <li>{{city}}</li> </template> in chrome console the command

How to get rid of Meteor template flickers

柔情痞子 提交于 2020-01-03 04:21:14
问题 I have a Meteor template with multiple conditions, and I get a flicker of some of the conditional views when it loads initially. I'm using iron router and I'm aware of the subscriptions, wait() and ready() options, however one of the problems is that the main conditional isInstalled depends on a meteor.call callback to set the isInstalled variable, so the wait doesn't depend on a subscription. So how do I account for this use case? <template name="adminLayout"> {{#if isInstalled}} {{#if

How do I get onRendered to run a second time when the route changes but the template remains the same?

本小妞迷上赌 提交于 2020-01-02 05:05:53
问题 I have an iron-router route for updating the data of a specific project: Router.route('/project/:key/update', { ... }); Each time the user navigates to an "edit project page" I want to focus the project-name input. template.onRendered(function() { this.$('form input[name="project_name"]').focus(); }); This works great when navigating from the Dashboard to any given edit project page. However, navigating to/from one project page to another the onRendered function doesn't rerun and consequently

Configuring Iron Router in Meteor - React

断了今生、忘了曾经 提交于 2020-01-01 06:55:09
问题 Using Meteor 1.2.0.1 and React. My simple app works great but now I needed iron router. app layout: client\ app.jsx lib\ router.jsx server views\ home.jsx layout.jsx home.jsx: Home = React.createClass({ render() { return ( <div> <h3>Hello World</h3> <p>from home</p> </div> ); } }); layout.jsx: Layout = React.createClass({ render() { return ( <div> {this.props.children} </div> ); } }); routes.jsx: Router.route('/', () => { let page = ( <Layout> <Home/> </Layout> ); React.render(page, document

Configuring Iron Router in Meteor - React

拥有回忆 提交于 2020-01-01 06:54:10
问题 Using Meteor 1.2.0.1 and React. My simple app works great but now I needed iron router. app layout: client\ app.jsx lib\ router.jsx server views\ home.jsx layout.jsx home.jsx: Home = React.createClass({ render() { return ( <div> <h3>Hello World</h3> <p>from home</p> </div> ); } }); layout.jsx: Layout = React.createClass({ render() { return ( <div> {this.props.children} </div> ); } }); routes.jsx: Router.route('/', () => { let page = ( <Layout> <Home/> </Layout> ); React.render(page, document

Meteor Iron-Router Without Layout Template or JSON View

筅森魡賤 提交于 2019-12-30 10:33:17
问题 Using Meteor Iron-Router how can I either render data as JSON or simply display it "raw" (without a layout template) Essentially I want to be able to do something like: this.route('rawdata', { path: '/raw/:collection', layoutTemplate: 'nolayout', template: 'raw' }) where /raw/posts would display the raw json of Posts (the collection). Thanks! Notes : I'm aware of JSON endpoint in Meteor But meteor-router is discontinued and Iron-Router does not appear to have a JSON-end-point feature. I also

Meteor : how to publish custom JSON data?

时光总嘲笑我的痴心妄想 提交于 2019-12-30 07:11:30
问题 Edit: The solution I used is @Kyll's one. Suppose the server side objects I'd like to return are "complicated" to build and need different attributes from different collections. I first tried: /server/publications.js Meteor.publish('myCustomDocument', function(){ // suppose here that I need to X.find() different collections // and create a complex Array of JSON data (which contains different // attributes from different Collections return [ {appName: 'aName', category: 'catName', anotherField

Serving an “index.html” file in public/ when using MeteorJS and Iron Router?

≯℡__Kan透↙ 提交于 2019-12-30 06:41:26
问题 I want to serve a static HTML file from MeteorJS's public folder (as is possible with Rails and Express). The reason I'm doing this is because I have one template for the dynamic "admin" part of my webapp and another for the sales-y "frontend" part of the app. I don't want this file to be wrapped in a Meteor template as suggested in this answer as it will automatically bring in the minified CSS, etc... that the dynamic pages use. Is there a way I can setup the public folder (and all its

meteor js iron router: apply CSS change whenever route changes

↘锁芯ラ 提交于 2019-12-28 13:57:59
问题 I have homepage, contact page, and several other product related pages in my app. The goal is to apply a background image to ONLY specifc routes: /homepage and /contact . If user navigates away from either route, apply some css change. I am hacking this together now with a helper on my homepage, like so: Template.homepage.rendered = function () { var route = Router.current(); if ( route.path == '/' ) { document.body.className = "showBackgroundImage"; } }; Partial win here, since this will