aboutsummaryrefslogtreecommitdiff
path: root/web/app/store
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-05-24 23:43:22 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2017-05-24 23:43:41 +1200
commit0e598a6232e9cd7188916e06077862d6630a255b (patch)
tree14d7a97478270b85a364d2e31d20a717c5f070e6 /web/app/store
parent4152d5749c9a2030edc4c7548a04ffa0ef851cd9 (diff)
downloadtrackermap-web-0e598a6232e9cd7188916e06077862d6630a255b.tar.gz
trackermap-web-0e598a6232e9cd7188916e06077862d6630a255b.tar.bz2
trackermap-web-0e598a6232e9cd7188916e06077862d6630a255b.zip
Add new categories (fix #495)
Diffstat (limited to 'web/app/store')
-rw-r--r--web/app/store/DeviceImages.js93
1 files changed, 15 insertions, 78 deletions
diff --git a/web/app/store/DeviceImages.js b/web/app/store/DeviceImages.js
index c1a8201d..6f8e8cfd 100644
--- a/web/app/store/DeviceImages.js
+++ b/web/app/store/DeviceImages.js
@@ -19,82 +19,19 @@ Ext.define('Traccar.store.DeviceImages', {
extend: 'Ext.data.Store',
fields: ['key', 'name', 'svg', 'fillId', 'rotateId', 'scaleId'],
- data: [{
- key: 'arrow',
- name: Strings.categoryArrow,
- svg: document.getElementById('arrowSvg').contentDocument,
- fillId: 'arrow',
- rotateId: 'arrow',
- scaleId: 'arrow'
- }, {
- key: 'default',
- name: Strings.categoryDefault,
- svg: document.getElementById('defaultSvg').contentDocument,
- fillId: 'background',
- rotateId: 'background',
- scaleId: 'layer1'
- }, {
- key: 'car',
- name: Strings.categoryCar,
- svg: document.getElementById('carSvg').contentDocument,
- fillId: 'background',
- rotateId: 'background',
- scaleId: 'layer1'
- }, {
- key: 'bus',
- name: Strings.categoryBus,
- svg: document.getElementById('busSvg').contentDocument,
- fillId: 'background',
- rotateId: 'background',
- scaleId: 'layer1'
- }, {
- key: 'truck',
- name: Strings.categoryTruck,
- svg: document.getElementById('truckSvg').contentDocument,
- fillId: 'background',
- rotateId: 'background',
- scaleId: 'layer1'
- }, {
- key: 'ship',
- name: Strings.categoryShip,
- svg: document.getElementById('shipSvg').contentDocument,
- fillId: 'background',
- rotateId: 'background',
- scaleId: 'layer1'
- }, {
- key: 'plane',
- name: Strings.categoryPlane,
- svg: document.getElementById('planeSvg').contentDocument,
- fillId: 'background',
- rotateId: 'background',
- scaleId: 'layer1'
- }, {
- key: 'motorcycle',
- name: Strings.categoryMotorcycle,
- svg: document.getElementById('motorcycleSvg').contentDocument,
- fillId: 'background',
- rotateId: 'background',
- scaleId: 'layer1'
- }, {
- key: 'bicycle',
- name: Strings.categoryBicycle,
- svg: document.getElementById('bicycleSvg').contentDocument,
- fillId: 'background',
- rotateId: 'background',
- scaleId: 'layer1'
- }, {
- key: 'person',
- name: Strings.categoryPerson,
- svg: document.getElementById('personSvg').contentDocument,
- fillId: 'background',
- rotateId: 'background',
- scaleId: 'layer1'
- }, {
- key: 'animal',
- name: Strings.categoryAnimal,
- svg: document.getElementById('animalSvg').contentDocument,
- fillId: 'background',
- rotateId: 'background',
- scaleId: 'layer1'
- }]
+ data: (function () {
+ var i, key, data = [];
+ for (i = 0; i < window.Images.length; i++) {
+ key = window.Images[i];
+ data.push({
+ key: key,
+ name: Strings['category' + key.charAt(0).toUpperCase() + key.slice(1)],
+ svg: document.getElementById(key + 'Svg').contentDocument,
+ fillId: key === 'arrow' ? 'arrow' : 'background',
+ rotateId: key === 'arrow' ? 'arrow' : 'background',
+ scaleId: key === 'arrow' ? 'arrow' : 'layer1'
+ });
+ }
+ return data;
+ })()
});