Skip to content

Commit 6993593

Browse files
committed
task: AddCatalogPriceForm: show a currency
Fix #1388
1 parent 86959e0 commit 6993593

File tree

2 files changed

+31
-14
lines changed

2 files changed

+31
-14
lines changed

src/main/frontend/src/components/AddCatalogPriceForm.js

+30-13
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// IMPORTANT:
33
// You must update ResourceUrl.RESOURCES_VERSION each time whenever you're modified this file!
44
//
5-
// @todo #1342 AddCatalogPriceForm: show a currency
65

76
class AddCatalogPriceForm extends React.Component {
87
constructor(props) {
@@ -33,6 +32,21 @@ class AddCatalogPriceForm extends React.Component {
3332
});
3433
}
3534

35+
getCurrencyByCatalogName(catalog) {
36+
switch (catalog) {
37+
case 'michel':
38+
case 'yvert':
39+
return ['\u20AC', 'EUR'];
40+
case 'scott':
41+
return ['$', 'USD'];
42+
case 'gibbons':
43+
return ['\u00A3', 'GBP'];
44+
case 'solovyov':
45+
case 'zagorski':
46+
return ['\u20BD', 'RUB'];
47+
}
48+
}
49+
3650
handleSubmit(event) {
3751
event.preventDefault();
3852

@@ -86,6 +100,8 @@ class AddCatalogPriceForm extends React.Component {
86100
}
87101
render() {
88102
const hasValidationErrors = this.state.validationErrors.length > 0;
103+
const [currencySymbol, currencyName] = this.getCurrencyByCatalogName(this.state.catalog);
104+
89105
return (
90106
<div className="col-sm-12 form-group">
91107
<form className={`form-horizontal ${hasValidationErrors ? 'has-error' : ''}`} onSubmit={this.handleSubmit}>
@@ -128,18 +144,19 @@ class AddCatalogPriceForm extends React.Component {
128144
<div className="form-group form-group-sm">
129145
<label className="control-label col-sm-3">
130146
{ this.props.l10n['t_price'] || 'Price' }
131-
</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>
147+
</label>
148+
<div className="row">
149+
<div className="col-sm-6">
150+
<div className="col-xs-6 input-group">
151+
<span className="input-group-addon">{ currencySymbol }</span>
152+
<input
153+
type="text"
154+
className="form-control js-with-tooltip"
155+
size="5"
156+
title={ currencyName }
157+
required="required"
158+
onChange={ this.handleChangePrice }/>
159+
</div>
143160
</div>
144161
</div>
145162
</div>

src/main/java/ru/mystamps/web/feature/site/ResourceUrl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public final class ResourceUrl {
3232
public static final String STATIC_RESOURCES_URL = "https://stamps.filezz.ru";
3333

3434
// MUST be updated when any of our resources were modified
35-
public static final String RESOURCES_VERSION = "v0.4.3.2";
35+
public static final String RESOURCES_VERSION = "v0.4.3.3";
3636

3737
// CheckStyle: ignore LineLength for next 14 lines
3838
private static final String CATALOG_UTILS_JS = "/public/js/" + RESOURCES_VERSION + "/CatalogUtils.min.js";

0 commit comments

Comments
 (0)