These are chat archives for reactioncommerce/reaction

26th
Oct 2015
newsiberian
@newsiberian
Oct 26 2015 07:18

Hello, @aaronjudd. I have two questions about routing.

  1. there is something strange happening in core/client/templates/products/productGrid/productGrid.js lines: 97-99 in this snippet:
if (position.tag === ReactionCore.getCurrentTag()) {
    _results.push(position);
}

First of all, my guess, we could do some refactoring here and call ReactionCore.getCurrentTag() one time somewhere upper.
And main, this string 'position.tag' is always undefined. So there is only one way when this snippet returns true results: undefined === undefined. And this is exactly what I got in my case.

  1. Why do we using so strange route for tags? We have product/tag/... Does product route exist for one product details?
Aaron Judd
@aaronjudd
Oct 26 2015 14:28
@newsiberian re position: undefined until you drag and drop product within the grid... (that's what position is for, so try that if you are debugging)
re: tag = can be used as a category (when it's tag/xx), or could also resolve to an individual product, the product detail route would be just product
Aaron Judd
@aaronjudd
Oct 26 2015 14:36
@seathony welcome! lots of magento experience around here. we're trying to make it easier to work with than Magento - that's one of our prime directives ;-) - but of course, YMMV. It is different in many ways, but I think if you are coming from rails, reaction and meteor will be easy-ish to pick up. Magento, is well, magento, and certainly more mature (so depends on your requirements)., but also is a lot more complex (however I think reaction can handle all the complexity of magento, but customization required).
newsiberian
@newsiberian
Oct 26 2015 14:53
@aaronjudd , thanks for response. I've tested in Chromium with brakepoint on line 98 with drug'n'droping and position.tag was always undefined
Aaron Judd
@aaronjudd
Oct 26 2015 15:28
and also drag and drop of the tags themselves? I'm not in the code, but I'll check it out later - obviously needs some comments if it's not obvious... (or removed if it's really not needed, but I suspect there is a reason for it)
@newsiberian btw - I've got an idea on removing iron-router from core, that I'm going to start work on very shortly(hopefully today, but I'm still catching up on a couple issues), that should allow either - no-conflict with iron-router, but allow us to start using flow-router as well.
Ryan
@allpoolspa
Oct 26 2015 15:37
@aaronjudd , is there a reason why the tags schema doesn't auto set the createdAt field? When doing bulk import of tags you have to add the createdAt field. Obviously not a big deal, but was unexpected. So I didn't know if this was intended.
Aaron Judd
@aaronjudd
Oct 26 2015 15:38
not intended, probably should have an autoValue attached to the schema. if you create an issue, I'll update in the next release (or happy to take a PR)
newsiberian
@newsiberian
Oct 26 2015 15:44
@aaronjudd that's a really good news))
re tag: when I am moving tags, this code is not involved
Ryan
@allpoolspa
Oct 26 2015 15:59
@aaronjudd ok sounds good. I'll make a PR.
Spencer Norman
@spencern
Oct 26 2015 17:46
@mikemurray - looking to extend some core templates for a package and found this https://github.com/reactioncommerce/reaction/blob/master/docs/developer/templates.md
which is very helpful
I’m worried though that this will make it difficult to keep the ‘copied’ parts of the core template up to date with the actual core
Spencer Norman
@spencern
Oct 26 2015 18:36
edit I tried replacing a template with a template that included that template and it created an infinite loop and I had to kill chrome, so don’t do that. Otherwise, I can replace templates just fine from a package.
Spencer Norman
@spencern
Oct 26 2015 19:16
Is there a quick helper or global function to get the current cart id on the client?
Mike Murray
@mikemurray
Oct 26 2015 20:22
@spencern you could always do ReactionCore.Collections.Cart.findOne() The subscription should take care of giving you just your cart
Spencer Norman
@spencern
Oct 26 2015 20:22
ah, great :+1:
Mike Murray
@mikemurray
Oct 26 2015 20:31
@spencern are you overrding templates just for changing CSS clasnames, or to reorganize the DOM structure to display data differently?
Spencer Norman
@spencern
Oct 26 2015 22:59
the latter - adding to the dom structure to display new data
e.g. in my rental products package, one of the elements that we add is a date/time selector so that the customer can select their desired dates, it’d be nice to be able to append to an existing selector in an existing template, but it seems like the best/only way to currently add to the dom is to replace an entire template and then copy previous template’s code into new template
Mike Murray
@mikemurray
Oct 26 2015 23:45

that would be the best. But we could make it easier by breaking templates into smaller chunks, keep most of the logic in the methods, and only necessary view logic with the template so it works more like an api.

That page is one of the places that needs to be broken up into smaller templates and methods