iron-router

Meteor with iron-router cant get slick carousel working

旧城冷巷雨未停 提交于 2019-12-17 16:55:26
问题 I am using iron-router, i have a route "models" which has a list of items. When the user clicks one of these items a new route "model" is used, the name of the selected item is passed as a param and used to load data about that model from the database. I want to use slick carousel, using an array of images returned from the database (based on the param). <div id="carousel"> {{#each images}} <div class="item"> <img src="/images/{{this}}" alt=""> </div> {{/each}} </div> Where should I call the

How to serve static content (images, fonts etc.) using iron router

半世苍凉 提交于 2019-12-17 15:38:48
问题 I just started working with iron router on meteor. I need to show an image on homepage. I was able to configure route for 'home' using the client side routing. For static files I tried to google and found that adding a server side route might help. So, I added the following code on server's router.js. Router.map(function() { this.route('files', { path: '/files/:path(*)', action: function() { var path = this.params.path; console.log('will serve static content @ '+path); this.response.sendfile

Meteor: Publish function requires a page refresh after user logs in

点点圈 提交于 2019-12-14 04:19:56
问题 I have a meteor app and I'm calling all the publish functions at once in the iron router configuration like below. I only want to return the subscriptions once the user is logged in, so I check Meteor.userId(): Router.configure({ layoutTemplate: 'layout', loadingTemplate: 'loading', notFoundTemplate: '404', waitOn: function () { if (Meteor.userId()) { return [Meteor.subscribe('users'), Meteor.subscribe('company'), Meteor.subscribe('projects'), Meteor.subscribe('columns'), Meteor.subscribe(

Meteor with Iron Route PathFor

自作多情 提交于 2019-12-13 18:05:53
问题 When I click on user's name, I want the link to go to their profile page. I am using Meteor with iron router. Here are the defined routes: Router.route('/', { name: 'JobsList'}); //homepage with all users //this is where the user's profile is located and works: Router.route('/company/:_id/', { name: 'CompanyPage', data: function() { return Meteor.users.findOne(this.params._id); } }); //this page shows all users with url that works: Router.route('/companies/', {name: 'CompaniesList'}); I get

How do I activate an Iron Router route without changing the path?

倖福魔咒の 提交于 2019-12-13 12:41:44
问题 In my Meteor app, I'm trying to pass data from my Iron Router controller to a template that's a partial in my app. How do I activate a route without changing the path? I don't want to switch pages, only render the partial with my data (if that makes sense). Here's how the app works: Right now, the route is activated when I click a dropdown link in my navbar Template.navbar.events 'click #threads-link': (event)-> Router.go 'allThreads' This renders the template with my data as long as I have a

Routing for multi step process [closed]

自作多情 提交于 2019-12-13 11:08:19
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . Edit: Shortened and clarified the problem. What's the most practical way to achieve the following in my Meteor app using Iron Router: Condition A - show template A Condition B - show template B otherwise - show template C for a single URL, so that a user cannot directly enter "

Loading data using Iron Router and Meteor

吃可爱长大的小学妹 提交于 2019-12-13 05:59:29
问题 Here is my dilemma. I'm currently loading my categories using a static variable onto the 'category' page. Everything loads and the links are clickable but when a user clicks on the category. The 'categoryPage' won't load the respective images that belong to that category. Here is my code. categoryPage HTML: <template name="categoryPage"> <div class="text-center light-container" id="home-section"> <h1>{{categoryName}}</h1> <hr/> <div class="row"> {{#each categoryGifs}} <a href="{{pathFor 'gif'

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})

Meteor: data passed to template from Iron Router, is empty at first load

こ雲淡風輕ζ 提交于 2019-12-13 04:34:55
问题 I'm facing a strange problem. I'm using Iron Router controller to pass data to template: Router.route('/wards/add/:_id?', {name: 'wards.add', controller: 'WardAddController'}); WardAddController = RouteController.extend({ action: function() { this.render('addWard', { data: function(){ return { hospitals : Hospitals.find({}), hospital_id : this.params._id } } }); } }); I return a variable 'hospitals', that should contain all the collection data. Template: <div class="jumbotron"> {{#each

Correct way to manage routes after sign in for different roles

╄→гoц情女王★ 提交于 2019-12-13 01:53:54
问题 I have 2 roles, admins and users. I have a home route '/' that is just a sign in page. When admin users sign in they must go to one route ( 'adminPortal' ) and when user users log in they must go to the 'userPortal' route. On signing out both roles should route back to '/' . Before I had an admin role, I was routing on sign in like so: Router.onBeforeAction(function() { this.render('loading'); if (! Meteor.userId()) { this.render('Home'); } else { this.next(); } }); which worked fine