Merge branch 'hotfix/3.5.3'

This commit is contained in:
yuri
2015-08-03 11:12:34 +03:00
4 changed files with 11 additions and 23 deletions
@@ -44,12 +44,15 @@
"Computer": "Computer",
"Education": "Education",
"Electronics": "Electronics",
"Energy": "Energy",
"Entertainment & Leisure": "Entertainment & Leisure",
"Finance": "Finance",
"Food & Beverage": "Food & Beverage",
"Grocery": "Grocery",
"Healthcare": "Healthcare",
"Insurance": "Insurance",
"Legal": "Legal",
"Manufacturing": "Manufacturing",
"Publishing": "Publishing",
"Real Estate": "Real Estate",
"Service": "Service",
@@ -33,12 +33,15 @@
"Computer",
"Education",
"Electronics",
"Energy",
"Entertainment & Leisure",
"Finance",
"Food & Beverage",
"Grocery",
"Healthcare",
"Insurance",
"Legal",
"Manufacturing",
"Publishing",
"Real Estate",
"Service",
@@ -2,7 +2,8 @@
<input type="text" class="main-element form-control" name="{{name}}" value="{{value}}" autocomplete="off" pattern="[\-]?[0-9,.]*" {{#if params.maxLength}} maxlength="{{params.maxLength}}"{{/if}}>
<span class="input-group-btn">
<select name="{{currencyFieldName}}" class="form-control">
{{{currencyOptions}}}
{{{options currencyList currencyValue}}}
</select>
</span>
</div>
+3 -22
View File
@@ -34,43 +34,24 @@ Espo.define('Views.Fields.Currency', 'Views.Fields.Float', function (Dep) {
data: function () {
return _.extend({
currencyFieldName: this.currencyFieldName,
currencyValue: this.currencyValue,
currencyValue: this.model.get(this.currencyFieldName),
currencyOptions: this.currencyOptions,
currencyList: this.currencyList
}, Dep.prototype.data.call(this));
},
setup: function () {
Dep.prototype.setup.call(this);
this.currencyFieldName = this.name + 'Currency';
this.currencyList = this.getConfig().get('currencyList') || ['USD', 'EUR'];
var currencyValue = this.currencyValue = this.model.get(this.currencyFieldName) || this.getConfig().get('defaultCurrency');
this.listenTo(this.model, 'change:' + this.currencyFieldName, function () {
this.currencyValue = this.model.get(this.currencyFieldName);
this.updateCurrency();
}.bind(this));
if (this.mode == 'edit' || this.mode == 'detail') {
this.updateCurrency();
}
},
updateCurrency: function () {
this.currencyList = this.getConfig().get('currencyList') || ['USD', 'EUR'];
var currencyOptions = '';
this.currencyList.forEach(function (code) {
currencyOptions += '<option value="' + code + '"' + ((this.currencyValue == code) ? ' selected' : '') + '>' + code + '</option>';
}, this);
this.currencyOptions = currencyOptions;
},
afterRender: function () {
Dep.prototype.afterRender.call(this);
if (this.mode == 'edit') {
this.$currency = this.$el.find('[name="' + this.currencyFieldName + '"]');
this.$currency.on('change', function () {
this.trigger('change');
}.bind(this));
}
},