These are chat archives for reactioncommerce/reaction

7th
Dec 2014
Brad Davis
@thecolorblue
Dec 07 2014 20:41
Hi guys, I am trying out some custom views/forms for more complex meta fields on products.
Here is my first attempt: pearmarket/reaction@84c662e
It's still rough. I looking for a little feedback on architecture, as I am new to meteor.
I am questioning if this is really scale-able for other values. Maybe this could be wrapped into a package somehow?
There are two issues with it right now: custom meta fields are hard coded into the helpers, and there are some repeated helpers that need to be shared between the templates somehow.
Aaron Judd
@aaronjudd
Dec 07 2014 21:30
@thecolorblue what I was originally thinking when I made the “metafield” schema is that we could use namespace, scope, and valueType fields to identify the “where” and “how” to display
I haven’t implemented any of that yet, but this is the exact kind of use case
or we could change / or use/ valueType = ‘Template”, so that you could mix identify what template is used to display different metaFields.
Aaron Judd
@aaronjudd
Dec 07 2014 21:36
thoughts in looking at your code -> you’re doing a lot of work to parse the value: string into and array. Perhaps we should just the ReactionCore.Schemas.Metafield to be:
  value:
    type: [String]
    optional: true
However, I think you could just redefine the schema in your code, (or even add new values to to it). Something like:
ReactionCore.Schemas.CustomMetafield = new SimpleSchema([
  ReactionCore.Schemas.Metafield
  {
    "ingredients":
      type: [String]
      defaultValue: ["N/A"]
  }
])
Aaron Judd
@aaronjudd
Dec 07 2014 21:44
that should inherit all the original schema properties and adds a new [String] array, that you can use more cleanly in your new templates
Aaron Judd
@aaronjudd
Dec 07 2014 21:51
I was thinking that in the core template, we could add a * settings cog, that had allowed entry/selection of existing valueTypes so you could change the form template for each row, and making it easy to reuse for other types of inputs