client/skr/components/address/Address.cjsx in stockor-0.4.0 vs client/skr/components/address/Address.cjsx in stockor-0.5.0

- old
+ new

@@ -1,18 +1,31 @@ class Skr.Components.Address extends Lanes.React.Component propTypes: + title: React.PropTypes.string model: Lanes.PropTypes.State.isRequired + copyFrom: Lanes.PropTypes.State + modelBindings: + model: 'props' + copyFrom: -> @props.copyFrom or false + + setModelState: (addr) -> + if (addr is @props.copyFrom) + for attr, val of addr.changedAttributes() when attr isnt 'isDirty' + @model[attr] = val if addr.previous(attr) is @model[attr] + else + @forceUpdate() + renderTitle: -> <BS.Row> <BS.Col xs=12> <h3 className="address-title">{@props.title}</h3> </BS.Col> </BS.Row> render: -> - colProps = _.omit(@props, 'name') + colProps = _.omit(@props, _.keys(@constructor.propTypes)) colProps.className = _.classnames("address", @props.className) <BS.Col {...colProps}> {@renderTitle() if @props.title} <BS.Row>