These are chat archives for reactioncommerce/reaction

1st
Oct 2015
Ruiyun Zhou
@farcryzry
Oct 01 2015 21:42
I have a question about router configuration. How to override routes from reaction.core?
/**
* Router configure
* Global Route Configuration
*  Extend/override in reaction/client/routing.coffee
*/
I saw this comment in ../packages/core/common/routers.js
but didn't find the routing.coffee, any example for route overriding?
Mike Murray
@mikemurray
Oct 01 2015 21:45
it should be routing.js. we've since moved from coffee to es6
Ruiyun Zhou
@farcryzry
Oct 01 2015 21:47
I guess it is this file you are mentioning, right?
Mike Murray
@mikemurray
Oct 01 2015 21:47
yup
Ruiyun Zhou
@farcryzry
Oct 01 2015 21:48
thanks!
In my case, I want to replace the header template to something else. Any suggestion how to override it in routing.js?
the route I want to override is this one:
  this.route('cartCheckout', {
    layoutTemplate: "coreLayout",
    path: 'checkout',
    template: 'cartCheckout',
    yieldTemplates: {
      checkoutHeader: {
        to: "layoutHeader"
      }
    },
    waitOn: function() {
      this.subscribe("Packages");
      this.subscribe("Products");
      this.subscribe("Shipping");
      return this.subscribe("AccountOrders");
    }
  });
I want to change the layoutHeader to other template
Mike Murray
@mikemurray
Oct 01 2015 22:12
@farcryzry looking. gimme a few seconds
Ruiyun Zhou
@farcryzry
Oct 01 2015 22:29
@mikemurray thanks!
Ruiyun Zhou
@farcryzry
Oct 01 2015 22:37
Just found one solution for it:
Defined a template named header. And use the following code to replace checkoutHeader
'''
Template.header.replaces("checkoutHeader");
Mike Murray
@mikemurray
Oct 01 2015 22:39
I think I may have found a solution too! incase you really do want to override the route
Ruiyun Zhou
@farcryzry
Oct 01 2015 22:39
great!
Mike Murray
@mikemurray
Oct 01 2015 22:39
testing
  _.extend(Router.routes.cartCheckout.options, {
    yieldTemplates: {
      checkoutHeader: {
        to: "layoutHeader"
      }
    }
  });
and then override whatever
Ruiyun Zhou
@farcryzry
Oct 01 2015 22:41
cool. Let me try it.
Ruiyun Zhou
@farcryzry
Oct 01 2015 23:15
seems it doesn't work for me
Bryan Wu
@cooloney
Oct 01 2015 23:26
I think Template.header.replaces(); is the right solution here.
Ruiyun Zhou
@farcryzry
Oct 01 2015 23:32
Thanks @cooloney
Erik Eppel
@epps
Oct 01 2015 23:51
Hi, @aaronjudd! I just ran into a small routing bug on the Introduction page to the Docs. I get "Oops, looks like there's no route on the client or the server for url: "https://reactioncommerce.com/docs/development/gitter.im/reactioncommerce/reaction." when I click on the chat room link.
Aaron Judd
@aaronjudd
Oct 01 2015 23:57
@epps :thumbsup: