diff options
Diffstat (limited to 'web/app/view/CustomNumberField.js')
-rw-r--r-- | web/app/view/CustomNumberField.js | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/web/app/view/CustomNumberField.js b/web/app/view/CustomNumberField.js index 807bad4d..8cfac1ee 100644 --- a/web/app/view/CustomNumberField.js +++ b/web/app/view/CustomNumberField.js @@ -1,6 +1,6 @@ /* - * Copyright 2017 Anton Tananaev (anton@traccar.org) - * Copyright 2017 Andrey Kunitsyn (andrey@traccar.org) + * Copyright 2017 - 2018 Anton Tananaev (anton@traccar.org) + * Copyright 2017 - 2018 Andrey Kunitsyn (andrey@traccar.org) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -72,22 +72,32 @@ Ext.define('Traccar.view.CustomNumberField', { } }; break; + case 'hours': + config.units = {}; + config.units.getStore = function () { + return Ext.getStore('HoursUnits'); + }; + config.units.getValue = function () { + return 'h'; + }; + unitName = Strings.sharedHourAbbreviation; + break; default: break; } config.afterBodyEl = this.unitEl + unitName + '</div></div>'; config.rawToValue = function (rawValue) { if (this.units) { - return this.units.getStore().convertValue(rawValue, this.units.getValue(), true); + return this.units.getStore().convertValue(this.parseValue(rawValue), this.units.getValue(), true); } else { return this.parseValue(rawValue); } }; config.valueToRaw = function (value) { if (this.units) { - return this.units.getStore().convertValue(value, this.units.getValue(), false); + return String(this.units.getStore().convertValue(value, this.units.getValue(), false)); } else { - return this.parseValue(value); + return String(value); } }; if (config.units) { |