From 0e598a6232e9cd7188916e06077862d6630a255b Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 24 May 2017 23:43:22 +1200 Subject: Add new categories (fix #495) --- README.md | 2 + web/app/store/DeviceImages.js | 93 +++++++------------------------------------ web/app/view/dialog/Device.js | 2 +- web/images/boat.svg | 48 ++++++++++++++++++++++ web/images/crane.svg | 48 ++++++++++++++++++++++ web/images/helicopter.svg | 47 ++++++++++++++++++++++ web/images/offroad.svg | 48 ++++++++++++++++++++++ web/images/pickup.svg | 47 ++++++++++++++++++++++ web/images/tractor.svg | 47 ++++++++++++++++++++++ web/images/van.svg | 47 ++++++++++++++++++++++ web/l10n/en.json | 19 ++++++--- web/load.js | 16 +++----- 12 files changed, 368 insertions(+), 96 deletions(-) create mode 100644 web/images/boat.svg create mode 100644 web/images/crane.svg create mode 100644 web/images/helicopter.svg create mode 100644 web/images/offroad.svg create mode 100644 web/images/pickup.svg create mode 100644 web/images/tractor.svg create mode 100644 web/images/van.svg diff --git a/README.md b/README.md index 7fd86162..374deadb 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ Traccar is open source server for various GPS tracking devices. This repository contains web interface for the Traccar platform. For back-end checkout [main Traccar repository](https://github.com/tananaev/traccar). +Icons are generously provided by [Font Awesome](http://fontawesome.io/) and [Icons8](https://icons8.com/). + ## Team - Anton Tananaev ([anton@traccar.org](mailto:anton@traccar.org)) 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; + })() }); diff --git a/web/app/view/dialog/Device.js b/web/app/view/dialog/Device.js index bd4a1286..054931c5 100644 --- a/web/app/view/dialog/Device.js +++ b/web/app/view/dialog/Device.js @@ -75,7 +75,7 @@ Ext.define('Traccar.view.dialog.Device', { return '' + - '
' + '{[new XMLSerializer().serializeToString(Traccar.DeviceImages.getImageSvg(' + 'Traccar.Style.mapColorOnline, false, 0, values.key))]}
- {name}
'; + '{name}'; } } }] diff --git a/web/images/boat.svg b/web/images/boat.svg new file mode 100644 index 00000000..6fd77b93 --- /dev/null +++ b/web/images/boat.svg @@ -0,0 +1,48 @@ + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/web/images/crane.svg b/web/images/crane.svg new file mode 100644 index 00000000..487a2c40 --- /dev/null +++ b/web/images/crane.svg @@ -0,0 +1,48 @@ + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/web/images/helicopter.svg b/web/images/helicopter.svg new file mode 100644 index 00000000..373c7f38 --- /dev/null +++ b/web/images/helicopter.svg @@ -0,0 +1,47 @@ + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/web/images/offroad.svg b/web/images/offroad.svg new file mode 100644 index 00000000..f175ec48 --- /dev/null +++ b/web/images/offroad.svg @@ -0,0 +1,48 @@ + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/web/images/pickup.svg b/web/images/pickup.svg new file mode 100644 index 00000000..2824f502 --- /dev/null +++ b/web/images/pickup.svg @@ -0,0 +1,47 @@ + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/web/images/tractor.svg b/web/images/tractor.svg new file mode 100644 index 00000000..4d2b5ad1 --- /dev/null +++ b/web/images/tractor.svg @@ -0,0 +1,47 @@ + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/web/images/van.svg b/web/images/van.svg new file mode 100644 index 00000000..215b9d7b --- /dev/null +++ b/web/images/van.svg @@ -0,0 +1,47 @@ + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/web/l10n/en.json b/web/l10n/en.json index 754295e2..bb19a1b1 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -330,13 +330,20 @@ "statisticsGeolocation": "Geolocation Requests", "categoryArrow": "Arrow", "categoryDefault": "Default", - "categoryCar": "Car", + "categoryAnimal": "Animal", + "categoryBicycle": "Bicycle", + "categoryBoat": "Boat", "categoryBus": "Bus", - "categoryTruck": "Truck", - "categoryShip": "Ship", - "categoryPlane": "Plane", + "categoryCar": "Car", + "categoryCrane": "Crane", + "categoryHelicopter": "Helicopter", "categoryMotorcycle": "Motorcycle", - "categoryBicycle": "Bicycle", + "categoryOffroad": "Offroad", "categoryPerson": "Person", - "categoryAnimal": "Animal" + "categoryPickup": "Pickup", + "categoryPlane": "Plane", + "categoryShip": "Ship", + "categoryTractor": "Tractor", + "categoryTruck": "Truck", + "categoryVan": "Van" } diff --git a/web/load.js b/web/load.js index 88eb1cf0..f6da4e62 100644 --- a/web/load.js +++ b/web/load.js @@ -154,16 +154,10 @@ addScriptFile('//cdnjs.cloudflare.com/ajax/libs/proj4js/' + proj4jsVersion + '/proj4.js'); } - addSvgFile('images/default.svg', 'defaultSvg'); - addSvgFile('images/arrow.svg', 'arrowSvg'); - addSvgFile('images/car.svg', 'carSvg'); - addSvgFile('images/bus.svg', 'busSvg'); - addSvgFile('images/truck.svg', 'truckSvg'); - addSvgFile('images/ship.svg', 'shipSvg'); - addSvgFile('images/plane.svg', 'planeSvg'); - addSvgFile('images/motorcycle.svg', 'motorcycleSvg'); - addSvgFile('images/bicycle.svg', 'bicycleSvg'); - addSvgFile('images/person.svg', 'personSvg'); - addSvgFile('images/animal.svg', 'animalSvg'); + window.Images = ['arrow', 'default', 'animal', 'bicycle', 'boat', 'bus', 'car', 'crane', 'helicopter', + 'motorcycle', 'offroad', 'person', 'pickup', 'plane', 'ship', 'tractor', 'truck', 'van']; + for (i = 0; i < window.Images.length; i++) { + addSvgFile('images/' + window.Images[i] + '.svg', window.Images[i] + 'Svg'); + } })(); -- cgit v1.2.3