iron-router

Routing to home screen when not signed in

帅比萌擦擦* 提交于 2019-12-12 03:36:34
问题 I want to redirect all users to a home page if they are not logged in. Currently I am doing this: Router.onBeforeAction(function() { this.render('loading'); if (! Meteor.userId()) { this.render('Home'); } else { this.next(); } }); Which I saw online, but this seems to be prevent my 'loading' template from ever showing and instead shows the default Loading... in the top left of the screen. If I change this.render('Home'); to this.redirect('/') I see the correct loading template. However in the

Access HTML after this.render() in Iron Router

霸气de小男生 提交于 2019-12-12 03:19:03
问题 I need to apply some Semantic UI on newly rendered templates, but I have no idea how to get the rendered HTML from the router. Here's my code : Router.route('/', { name: 'home', where: 'client', action: function () { this.render('home'); }, onAfterAction: function () { console.log( $('#homeSidebar') ); } }); Basically, $('#homeSidebar') should return the sidebar element, but it returns nothing as the HTML is not yet available. The only solution, so far, was to change the function like this

Meteor JS Iron Router, route sub directory

怎甘沉沦 提交于 2019-12-12 03:17:41
问题 I am working on a admin and client portal in Meteor JS using Iron:Router. I know i can create a route using: this.route('tasks',{path:'/projects', layoutTemplate: 'adminLayout'}); But is it possible to make a route with a sub directory such as: this.route('tasks',{path:'/admin/projects', layoutTemplate: 'adminLayout'}); So that way i can also have a sub directory of: this.route('/admin/projects', {name: 'admin.projects', template: 'projects', layoutTemplate: 'adminLayout'} and this.route('

Meteor's Iron Router - Alter Path before routing

旧街凉风 提交于 2019-12-12 01:47:06
问题 Is there a way to change the path before the page is routed based on some logic, such as a Session variable? For example: // Before routing Router.onBeforeAction(function () { if(Session.get('key') === true) { prependToPath('prefix'); } }); 回答1: You can get the current path using Iron.Location.get().path , run through your logic, and then use the new path in Router.go() . Like so: // If abc is set on the URL, then keep it there if (Session.get('abc') === true) { // You can use better logic

what is wrong with this route to user_profile?

 ̄綄美尐妖づ 提交于 2019-12-11 22:43:24
问题 I am trying to add a profile page to the microscope app. Thanks to help I got here I was able to get most of it working but I can't get the route to another users profile to work. This is the code for the route. Thanks in comment.html template <span class="author"><a href="{{pathFor 'user_profile'}}">{{username}}</a></span> router.js this.route('user_profile',{ path: '/profile/:_username', waitOn: function () { return Meteor.subscribe('userprofile', this.params._username) }, data: function ()

meteor client async pattern / how to implement a waitOn for a list of subscriptions w callbacks

穿精又带淫゛_ 提交于 2019-12-11 22:21:20
问题 for various reasons I'm writing an app that doesn't use IronRouter, but has to implement some similar logic. One is waiting for a list of subscriptions to be ready. Since this is an async call client side in meteor, what are some techniques for doing this? If I want to have a list of subs like: sublist = [ PubSubMan.subscribe("Players"), PubSubMan.subscribe("Stuff") ] then start with the rest of the app once they are all .ready() = true what is a good way to do this? I can't quite understand

Iron Router Get Current Item?

亡梦爱人 提交于 2019-12-11 20:54:32
问题 Right now I have two routes in my application. There's the main page route that has a list of Ideas (just text items) and then there's a route for showing and editing Ideas. My problem is with editing ideas... I'm not sure how to actually get the item being edited and persist the changes. I could use a global variable, but that's almost certainly a hack and not the "meteor way" (or the right way in any software, for that matter.) I could use the Session , but that doesn't seem quite right to

call method in Iron-Router RouteController from Template.tmpl.helpers() not working

会有一股神秘感。 提交于 2019-12-11 20:01:54
问题 I'm trying to push new data on to my clients array each time the loadMoreClients method is called. The publication is expecting this back_to parameter and knows how to handle it. My problem is that I can't seem to call these methods from my Template helpers . I logged Iron and Iron.controller to the console and both of those exist and are showing me what I expected to see. I just can't seem to find current docs or examples of how to access Iron.controller() methods/properties from my Template

How to view and modify incoming HTTP post data size limits

こ雲淡風輕ζ 提交于 2019-12-11 19:33:28
问题 I am using Iron-Router with my Meteor app to accept incoming HTTP requests. How do I know what the POST data size limits are? How do I set the limit for it? 回答1: I'm not sure about how to check the limits, but you can set limits with the following code: Router.configureBodyParsers = function() { Router.onBeforeAction(Iron.Router.bodyParser.urlencoded({ extended : true, limit : "8mb" })); }; 来源: https://stackoverflow.com/questions/30749930/how-to-view-and-modify-incoming-http-post-data-size

meteor.js iron-router: prevent static template re-render and glitching?

六眼飞鱼酱① 提交于 2019-12-11 13:56:39
问题 I have a global template: <template name="layout"> {{> header}} {{> primaryNav}} {{yield 'banner'}} {{yield}} {{> footer}} {{> deleteConfirmModal }} <span class="responsive-state"></span> </template> and when I do a route @route 'blog', path: '/blog/' Everything works dandy. I can click back and forth through my header links and nav links with no glitching. But if I add a data context: @route 'blog', path: '/blog/' data: -> blogPosts: BlogPosts.find({}, {date: -1, time: -1}) When providing a