iron-router

Meteor breadcrumb

℡╲_俬逩灬. 提交于 2019-12-04 12:37:00
问题 How do I implement a reactive breadcrumb with Meteor and iron-router? Now I'm looking for the current path, triggered by a reactive session variable and then adding each link that corresponds to that route inside the DOM with jQuery. 回答1: You can call Router.current().path inside a helper function and it will return the current path. Then split the path on / and return the array to your breadcrumbs template. The function is reactive, so updates will propagate: Template.breadcrumbs.path =

Iron-router nested routes with multiple parameters

亡梦爱人 提交于 2019-12-04 12:26:04
I have two models: sites and articles . Each site can have multiple articles. I would like to view the article in the route like this: /siteName/articleFriendlyTitleUrl . At the moment I have helper method to make friendly urls like this: getFriendlyUrl = function(urlString){ urlString = urlString.toLowerCase(); urlString = str.replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '-'); return urlString; } And my router.js file: this.route('showArticle', { path: '/article/:title'), layoutTemplate: 'artLayout', data: function(){ viewData = { title: Articles.findOne({title: this.params.title}), site:

IronRouter authorisation controller

醉酒当歌 提交于 2019-12-04 12:04:13
问题 I'm wondering if anyone could demonstrate how to use a global 'before' action on a router controller class that handles user authentication and displays the appropriate route/template based on the result. My use case is to have an AppController that acts as an authentication firewall and blocks any child controller actions when a user is logged out. E.g. // Create a primary app controller stub with the auth firewall AppController = RouteController.extend({}); // Extend the AppController with

Tell Iron Router not to intercept a link

拟墨画扇 提交于 2019-12-04 09:58:24
I'm moving quite a large application to Iron Router. On the client side, all unknown routes are redirected to /404 . In addition, some routes are managed from the server side - for example /static , that just displays a static page via middleware. The problem is that Iron Router now intercepts all link clicks - so when I click a link to /static , the action is prevented, browser does not display the server response for that address, and user is redirected to /404 instead. How do I prevent such behavior? Is there a way to tell Iron Router not to intercept a certain link? You can tell iron

Meteor, Iron:Router Passing Multiple Properties on Router.go

£可爱£侵袭症+ 提交于 2019-12-04 08:49:12
问题 My dilemma is that I would like to pass multiple object properties to an iron:router route in Meteor. The reasoning is that I would like to pass it a property to name my url with and a property to find a collection item with. They are completely independent of each other and I can't use the url property because it is not a value in the collection item. This is what I have: Template.items.events({ 'click': function () { itemName = this.name.replace(/ /g,'') Router.go('itemDetails', {itemName:

Pause routing in Meteor's Iron Router while a page transition completes

非 Y 不嫁゛ 提交于 2019-12-04 07:40:46
In my Meteor app I have some complex page animations that require a few seconds to complete (instructive animations take priority over page transition speed). There's an out state and an in state in the animation. For simplicity's sake, let's say I need to fade out one page, and then fade in the next, but that I want those fades to take multiple seconds. To do this I use Meteor's Iron Router to call some animation functions that manipulate the CSS. lib/router.js animateContentOut = function(pause) { return $('#content').removeClass("animated fadeIn"); } Router.onAfterAction(animateContentOut);

Meteor's Iron Router doesn't close modal dialog

◇◆丶佛笑我妖孽 提交于 2019-12-04 07:24:45
I'm using Meteor and Iron Router, and I have a modal dialog that won't hide the backdrop when it gets dismissed. To be more accurate, I want that after clicking the dismiss button, the iron router will redirect to another page. The redirection code does work, but the backdrop stays visible. If I remove the routing line - the modal is dismissed and so does the backdrop. Here is the modal's markup: <div class="modal fade" id="confirm-modal" tabindex="-1" role="dialog"> <div class="modal-dialog modal-sm"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close"

iron:router will not re-render after route change with same template

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 02:53:27
How can I make Iron:router re-render a template? I have this html: <head> </head> <body> </body> <template name="mainLayout"> <a href="{{pathFor route='list'}}">list</a> <a href="{{pathFor route='find' query='q=xxx'}}">find</a> {{> yield}} </template> <template name="listTemplate"> <p>list</p> </template> and this js: Router.configure({ layoutTemplate: 'mainLayout' }); Router.route('/list', { name: 'list', template: 'listTemplate' }); Router.route('/find', { name: 'find', template: 'listTemplate', data: function () { return this.params.query; } }); if (Meteor.isClient) { Template.listTemplate

Meteor - Publish just the count for a collection

左心房为你撑大大i 提交于 2019-12-04 02:33:11
Is it possible to publish just the count for a collection to the user? I want to display the total count on the homepage, but not pass all the data to the user. This is what I tried but it does not work: Meteor.publish('task-count', function () { return Tasks.find().count(); }); this.route('home', { path: '/', waitOn: function () { return Meteor.subscribe('task-count'); } }); When I try this I get an endless loading animation. saimeunt Meteor.publish functions should return cursors, but here you're returning directly a Number which is the total count of documents in your Tasks collection.

reywood/meteor-iron-router-ga not working with mobile app cordova for Google Analytics

烂漫一生 提交于 2019-12-03 21:50:43
I am using reywood/meteor-iron-router-ga package for my Google analytics but i do not know why events or Real time events are not logged from mobile app. I did simple configurations for this but not worked. I also used Google Analytics debugger to detect the problem but it looks fine Link Analytics and Search Console -> RESOLVED Bad Default URL -> RESOLVED This is the output of any event click on my app. I also try to replace reywood/meteor-iron-router-ga with simple JavaScript Analytics.js but still no benefit. ga('send', 'event', { eventCategory: Category, eventAction: Action, eventLabel: