Skip to content

Commit

Permalink
Use select box of countries rather than text field for "Origin Countr…
Browse files Browse the repository at this point in the history
…y" (#1967)
  • Loading branch information
brent-hoover authored and kieckhafer committed Mar 13, 2017
1 parent d683786 commit 2dc1b05
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { isEqual } from "lodash";
import React, { Component, PropTypes } from "react";
import Velocity from "velocity-animate";
import "velocity-animate/velocity.ui";
Expand All @@ -13,7 +14,6 @@ import {
} from "/imports/plugins/core/ui/client/components";
import { Router } from "/client/api";
import { TagListContainer } from "/imports/plugins/core/ui/client/containers";
import { isEqual } from "lodash";
import update from "react/lib/update";

const fieldNames = [
Expand Down Expand Up @@ -149,7 +149,7 @@ class ProductAdmin extends Component {
});
}

handleTemplateChange = (value, field) => {
handleSelectChange = (value, field) => {
if (this.props.onProductFieldSave) {
this.props.onProductFieldSave(this.product._id, field, value);
}
Expand Down Expand Up @@ -241,7 +241,7 @@ class ProductAdmin extends Component {
i18nKeyPlaceholder="productDetailEdit.templateSelectPlaceholder"
label="Template"
name="template"
onChange={this.handleTemplateChange}
onChange={this.handleSelectChange}
options={this.props.templates}
placeholder="Select a template"
value={this.product.template}
Expand Down Expand Up @@ -307,16 +307,17 @@ class ProductAdmin extends Component {
ref="descriptionInput"
value={this.product.description}
/>
<TextField
<Select
clearable={false}
i18nKeyLabel="productDetailEdit.originCountry"
i18nKeyPlaceholder="productDetailEdit.originCountry"
label="Origin Country"
name="originCountry"
onBlur={this.handleFieldBlur}
onChange={this.handleFieldChange}
placeholder="Country of Origin"
onChange={this.handleSelectChange}
placeholder="Select a Country"
ref="countryOfOriginInput"
value={this.product.originCountry}
options={this.props.countries}
/>
</CardBody>
</Card>
Expand Down Expand Up @@ -418,6 +419,7 @@ class ProductAdmin extends Component {
}

ProductAdmin.propTypes = {
countries: PropTypes.arrayOf(PropTypes.object),
editFocus: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
handleFieldBlur: PropTypes.func,
handleFieldChange: PropTypes.func,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Reaction } from "/client/api";
import { composeWithTracker } from "/lib/api/compose";
import { ReactionProduct } from "/lib/api";
import { Tags, Media, Templates } from "/lib/collections";
import { Countries } from "/client/collections";
import { ProductAdmin } from "../components";

class ProductAdminContainer extends Component {
Expand Down Expand Up @@ -144,13 +145,16 @@ function composer(props, onData) {
};
});

const countries = Countries.find({}).fetch();

onData(null, {
editFocus: Reaction.state.get("edit/focus"),
product: product,
media,
tags,
revisonDocumentIds,
templates
templates,
countries
});
} else {
onData(null, {});
Expand Down

0 comments on commit 2dc1b05

Please sign in to comment.