|
2 | 2 | // IMPORTANT:
|
3 | 3 | // You must update ResourceUrl.RESOURCES_VERSION each time whenever you're modified this file!
|
4 | 4 | //
|
5 |
| -// @todo #1342 AddCatalogPriceForm: show a currency |
| 5 | +// @todo #1388 AddCatalogPriceForm: consider using a tooltip for currency |
6 | 6 |
|
7 | 7 | class AddCatalogPriceForm extends React.Component {
|
8 | 8 | constructor(props) {
|
@@ -33,6 +33,21 @@ class AddCatalogPriceForm extends React.Component {
|
33 | 33 | });
|
34 | 34 | }
|
35 | 35 |
|
| 36 | + getCurrencyByCatalogName(catalog) { |
| 37 | + switch (catalog) { |
| 38 | + case 'michel': |
| 39 | + case 'yvert': |
| 40 | + return ['\u20AC', 'EUR']; |
| 41 | + case 'scott': |
| 42 | + return ['$', 'USD']; |
| 43 | + case 'gibbons': |
| 44 | + return ['\u00A3', 'GBP']; |
| 45 | + case 'solovyov': |
| 46 | + case 'zagorski': |
| 47 | + return ['\u20BD', 'RUB']; |
| 48 | + } |
| 49 | + } |
| 50 | + |
36 | 51 | handleSubmit(event) {
|
37 | 52 | event.preventDefault();
|
38 | 53 |
|
@@ -86,6 +101,8 @@ class AddCatalogPriceForm extends React.Component {
|
86 | 101 | }
|
87 | 102 | render() {
|
88 | 103 | const hasValidationErrors = this.state.validationErrors.length > 0;
|
| 104 | + const [currencySymbol, currencyName] = this.getCurrencyByCatalogName(this.state.catalog); |
| 105 | + |
89 | 106 | return (
|
90 | 107 | <div className="col-sm-12 form-group">
|
91 | 108 | <form className={`form-horizontal ${hasValidationErrors ? 'has-error' : ''}`} onSubmit={this.handleSubmit}>
|
@@ -129,17 +146,17 @@ class AddCatalogPriceForm extends React.Component {
|
129 | 146 | <label className="control-label col-sm-3">
|
130 | 147 | { this.props.l10n['t_price'] || 'Price' }
|
131 | 148 | </label>
|
132 |
| - <div className="col-sm-6"> |
133 |
| - <div className="row"> |
134 |
| - <div className="col-xs-6"> |
135 |
| - <input |
136 |
| - className="form-control" |
137 |
| - id="catalog-price" |
138 |
| - type="text" |
139 |
| - size="5" |
140 |
| - required="required" |
141 |
| - onChange={ this.handleChangePrice }/> |
142 |
| - </div> |
| 149 | + <div className="col-sm-3"> |
| 150 | + <div className="input-group"> |
| 151 | + <span className="input-group-addon">{ currencySymbol }</span> |
| 152 | + <input |
| 153 | + id="catalog-price" |
| 154 | + type="text" |
| 155 | + className="form-control" |
| 156 | + size="5" |
| 157 | + title={ currencyName } |
| 158 | + required="required" |
| 159 | + onChange={ this.handleChangePrice }/> |
143 | 160 | </div>
|
144 | 161 | </div>
|
145 | 162 | </div>
|
|
0 commit comments