Skip to content

Commit ea5fecf

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

File tree

2 files changed

+30
-13
lines changed

2 files changed

+30
-13
lines changed

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

+29-12
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
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
5+
// @todo #1388 AddCatalogPriceForm: consider using a tooltip for currency
66

77
class AddCatalogPriceForm extends React.Component {
88
constructor(props) {
@@ -33,6 +33,21 @@ class AddCatalogPriceForm extends React.Component {
3333
});
3434
}
3535

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+
3651
handleSubmit(event) {
3752
event.preventDefault();
3853

@@ -86,6 +101,8 @@ class AddCatalogPriceForm extends React.Component {
86101
}
87102
render() {
88103
const hasValidationErrors = this.state.validationErrors.length > 0;
104+
const [currencySymbol, currencyName] = this.getCurrencyByCatalogName(this.state.catalog);
105+
89106
return (
90107
<div className="col-sm-12 form-group">
91108
<form className={`form-horizontal ${hasValidationErrors ? 'has-error' : ''}`} onSubmit={this.handleSubmit}>
@@ -129,17 +146,17 @@ class AddCatalogPriceForm extends React.Component {
129146
<label className="control-label col-sm-3">
130147
{ this.props.l10n['t_price'] || 'Price' }
131148
</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 }/>
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)