aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-03 21:21:26 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-03 21:21:26 +1300
commit04e63f9b42991008843f3f9d1788fa6933bd57b3 (patch)
tree7e57e37dbe0e08da7cc10311b0d5f5556d151e5c
parent086faa072ddd3e16c28c2ceaceaa90f32a05f7f9 (diff)
downloadtrackermap-server-04e63f9b42991008843f3f9d1788fa6933bd57b3.tar.gz
trackermap-server-04e63f9b42991008843f3f9d1788fa6933bd57b3.tar.bz2
trackermap-server-04e63f9b42991008843f3f9d1788fa6933bd57b3.zip
Change global styles class
-rw-r--r--web/app/AttributeFormatter.js2
-rw-r--r--web/app/Resources.js50
-rw-r--r--web/app/Style.js53
-rw-r--r--web/app/view/BaseDialog.js2
-rw-r--r--web/app/view/DeviceController.js4
-rw-r--r--web/app/view/Main.js4
-rw-r--r--web/app/view/Map.js8
-rw-r--r--web/app/view/MapController.js16
-rw-r--r--web/app/view/Report.js12
-rw-r--r--web/app/view/UserController.js4
10 files changed, 79 insertions, 76 deletions
diff --git a/web/app/AttributeFormatter.js b/web/app/AttributeFormatter.js
index fe50e0d99..3f8f346c0 100644
--- a/web/app/AttributeFormatter.js
+++ b/web/app/AttributeFormatter.js
@@ -42,7 +42,7 @@
} else if (typeof value === 'boolean') {
return value ? Ext.Msg.buttonText.yes : Ext.Msg.buttonText.no;
} else if (value instanceof Date) {
- return Ext.Date.format(value, styles.dateTimeFormat);
+ return Ext.Date.format(value, Traccar.Style.dateTimeFormat);
}
return value;
},
diff --git a/web/app/Resources.js b/web/app/Resources.js
deleted file mode 100644
index 3454ab579..000000000
--- a/web/app/Resources.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var styles = {
- panelPadding: 10,
-
- windowWidth: 640,
- windowHeight: 480,
-
- dateTimeFormat: 'Y-m-d H:i:s',
- timeFormat: 'H:i',
- weekStartDay: 1,
-
- deviceWidth: 350,
-
- reportHeight: 250,
- reportTime: 100,
-
- mapDefaultLat: 51.507222,
- mapDefaultLon: -0.1275,
- mapDefaultZoom: 6,
-
- mapMaxZoom: 19,
- mapSelectColor: 'rgba(0, 255, 0, 1.0)',
- mapSelectRadius: 10,
- mapReportColor: 'rgba(0, 0, 255, 1.0)',
- mapReportRadius: 5,
- mapLiveColor: 'rgba(255, 0, 0, 1.0)',
- mapLiveRadius: 7,
- mapStrokeColor: 'rgba(50, 50, 50, 1.0)',
- mapRouteWidth: 5,
- mapMarkerStroke: 2,
- mapDelay: 500
-};
-
-Ext.define('Traccar.Resources', {
-});
diff --git a/web/app/Style.js b/web/app/Style.js
new file mode 100644
index 000000000..b2a2474bd
--- /dev/null
+++ b/web/app/Style.js
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+(function () {
+ 'use strict';
+
+ Ext.define('Traccar.Style', {
+ singleton: true,
+
+ panelPadding: 10,
+
+ windowWidth: 640,
+ windowHeight: 480,
+
+ dateTimeFormat: 'Y-m-d H:i:s',
+ timeFormat: 'H:i',
+ weekStartDay: 1,
+
+ deviceWidth: 350,
+
+ reportHeight: 250,
+ reportTime: 100,
+
+ mapDefaultLat: 51.507222,
+ mapDefaultLon: -0.1275,
+ mapDefaultZoom: 6,
+
+ mapMaxZoom: 19,
+ mapSelectColor: 'rgba(0, 255, 0, 1.0)',
+ mapSelectRadius: 10,
+ mapReportColor: 'rgba(0, 0, 255, 1.0)',
+ mapReportRadius: 5,
+ mapLiveColor: 'rgba(255, 0, 0, 1.0)',
+ mapLiveRadius: 7,
+ mapStrokeColor: 'rgba(50, 50, 50, 1.0)',
+ mapRouteWidth: 5,
+ mapMarkerStroke: 2,
+ mapDelay: 500
+ });
+
+})();
diff --git a/web/app/view/BaseDialog.js b/web/app/view/BaseDialog.js
index 2a8084698..f5cb8ca1d 100644
--- a/web/app/view/BaseDialog.js
+++ b/web/app/view/BaseDialog.js
@@ -19,7 +19,7 @@
Ext.define('Traccar.view.BaseDialog', {
extend: 'Ext.window.Window',
- bodyPadding: styles.panelPadding,
+ bodyPadding: Traccar.Style.panelPadding,
resizable: false,
modal: true
});
diff --git a/web/app/view/DeviceController.js b/web/app/view/DeviceController.js
index 1d0ebc545..045ac426f 100644
--- a/web/app/view/DeviceController.js
+++ b/web/app/view/DeviceController.js
@@ -122,8 +122,8 @@
onUsersClick: function () {
Ext.create('Ext.window.Window', {
title: strings.settingsUsers,
- width: styles.windowWidth,
- height: styles.windowHeight,
+ width: Traccar.Style.windowWidth,
+ height: Traccar.Style.windowHeight,
layout: 'fit',
modal: true,
items: {
diff --git a/web/app/view/Main.js b/web/app/view/Main.js
index 1ad61d73f..04ad5ea48 100644
--- a/web/app/view/Main.js
+++ b/web/app/view/Main.js
@@ -38,7 +38,7 @@
items: [{
region: 'west',
layout: 'border',
- width: styles.deviceWidth,
+ width: Traccar.Style.deviceWidth,
defaults: {
split: true,
@@ -55,7 +55,7 @@
}, {
region: 'south',
xtype: 'reportView',
- height: styles.reportHeight
+ height: Traccar.Style.reportHeight
}, {
region: 'center',
xtype: 'mapView',
diff --git a/web/app/view/Map.js b/web/app/view/Map.js
index e356c4678..92cab1421 100644
--- a/web/app/view/Map.js
+++ b/web/app/view/Map.js
@@ -70,14 +70,14 @@
source: this.vectorSource
});
- var lat = user.get('latitude') || server.get('latitude') || styles.mapDefaultLat;
- var lon = user.get('longitude') || server.get('longitude') || styles.mapDefaultLon;
- var zoom = user.get('zoom') || server.get('zoom') || styles.mapDefaultZoom;
+ var lat = user.get('latitude') || server.get('latitude') || Traccar.Style.mapDefaultLat;
+ var lon = user.get('longitude') || server.get('longitude') || Traccar.Style.mapDefaultLon;
+ var zoom = user.get('zoom') || server.get('zoom') || Traccar.Style.mapDefaultZoom;
this.mapView = new ol.View({
center: ol.proj.fromLonLat([lon, lat]),
zoom: zoom,
- maxZoom: styles.mapMaxZoom
+ maxZoom: Traccar.Style.mapMaxZoom
});
this.map = new ol.Map({
diff --git a/web/app/view/MapController.js b/web/app/view/MapController.js
index 7ce61e794..7bb878241 100644
--- a/web/app/view/MapController.js
+++ b/web/app/view/MapController.js
@@ -68,7 +68,7 @@
if (data[i].deviceId in this.liveData) {
this.liveData[data[i].deviceId].setGeometry(geometry);
} else {
- var style = this.getMarkerStyle(styles.mapLiveRadius, styles.mapLiveColor);
+ var style = this.getMarkerStyle(Traccar.Style.mapLiveRadius, Traccar.Style.mapLiveColor);
var marker = new ol.Feature({
geometry: geometry,
originalStyle: style
@@ -90,8 +90,8 @@
getLineStyle: function () {
return new ol.style.Style({
stroke: new ol.style.Stroke({
- color: styles.mapStrokeColor,
- width: styles.mapRouteWidth
+ color: Traccar.Style.mapStrokeColor,
+ width: Traccar.Style.mapRouteWidth
})
});
},
@@ -118,8 +118,8 @@
color: color
}),
stroke: new ol.style.Stroke({
- color: styles.mapStrokeColor,
- width: styles.mapMarkerStroke
+ color: Traccar.Style.mapStrokeColor,
+ width: Traccar.Style.mapMarkerStroke
})
})
});
@@ -143,7 +143,7 @@
]);
positions.push(point);
- var style = this.getMarkerStyle(styles.mapReportRadius, styles.mapReportColor);
+ var style = this.getMarkerStyle(Traccar.Style.mapReportRadius, Traccar.Style.mapReportColor);
var feature = new ol.Feature({
geometry: new ol.geom.Point(positions[index]),
originalStyle: style
@@ -189,10 +189,10 @@
}
if (feature !== undefined) {
- feature.setStyle(this.getMarkerStyle(styles.mapSelectRadius, styles.mapSelectColor));
+ feature.setStyle(this.getMarkerStyle(Traccar.Style.mapSelectRadius, Traccar.Style.mapSelectColor));
var pan = ol.animation.pan({
- duration: styles.mapDelay,
+ duration: Traccar.Style.mapDelay,
source: this.getView().mapView.getCenter()
});
this.getView().map.beforeRender(pan);
diff --git a/web/app/view/Report.js b/web/app/view/Report.js
index 73ba6e12b..b930dd3b0 100644
--- a/web/app/view/Report.js
+++ b/web/app/view/Report.js
@@ -46,13 +46,13 @@
}, {
xtype: 'datefield',
reference: 'fromDateField',
- startDay: styles.weekStartDay,
+ startDay: Traccar.Style.weekStartDay,
value: new Date(new Date().getTime() - 30 * 60 * 1000)
}, {
xtype: 'timefield',
reference: 'fromTimeField',
- maxWidth: styles.reportTime,
- format: styles.timeFormat,
+ maxWidth: Traccar.Style.reportTime,
+ format: Traccar.Style.timeFormat,
value: new Date(new Date().getTime() - 30 * 60 * 1000)
}, '-', {
xtype: 'tbtext',
@@ -60,13 +60,13 @@
}, {
xtype: 'datefield',
reference: 'toDateField',
- startDay: styles.weekStartDay,
+ startDay: Traccar.Style.weekStartDay,
value: new Date()
}, {
xtype: 'timefield',
reference: 'toTimeField',
- maxWidth: styles.reportTime,
- format: styles.timeFormat,
+ maxWidth: Traccar.Style.reportTime,
+ format: Traccar.Style.timeFormat,
value: new Date()
}, '-', {
text: strings.reportShow,
diff --git a/web/app/view/UserController.js b/web/app/view/UserController.js
index 670565dcb..cd0a4bd0b 100644
--- a/web/app/view/UserController.js
+++ b/web/app/view/UserController.js
@@ -66,8 +66,8 @@
// TODO show devices
/*Ext.create('Ext.window.Window', {
title: strings.settingsUsers,
- width: styles.windowWidth,
- height: styles.windowHeight,
+ width: Traccar.Style.windowWidth,
+ height: Traccar.Style.windowHeight,
layout: 'fit',
modal: true,
items: {