From 0b166ca5fc20f7b857b214209df2ce8c23eb168c Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 3 Feb 2015 12:11:21 +1300 Subject: Use static Ext classes --- web/Application.js | 2 ++ web/DeviceView.js | 2 +- web/Login.js | 12 ++++++------ web/MainView.js | 2 +- web/MapView.js | 12 ++++++------ web/Strings.js | 5 +++-- web/Styles.js | 5 +++-- web/index.html | 2 -- 8 files changed, 22 insertions(+), 20 deletions(-) diff --git a/web/Application.js b/web/Application.js index 12ece2e51..a1794770a 100644 --- a/web/Application.js +++ b/web/Application.js @@ -17,6 +17,8 @@ Ext.application({ name: 'Traccar', requires: [ + 'Strings', + 'Styles', 'Login', 'MainView' ], diff --git a/web/DeviceView.js b/web/DeviceView.js index cf5502418..6d475e406 100644 --- a/web/DeviceView.js +++ b/web/DeviceView.js @@ -18,5 +18,5 @@ Ext.define('DeviceView', { extend: 'Ext.form.Panel', xtype: 'device-view', - title: strings.device_title + title: Strings.device_title }); diff --git a/web/Login.js b/web/Login.js index d06506480..6c42d7ddb 100644 --- a/web/Login.js +++ b/web/Login.js @@ -19,31 +19,31 @@ Ext.define('LoginForm', { xtype: 'login-form', defaultType: 'textfield', - bodyPadding: styles.panel_padding, + bodyPadding: Styles.panel_padding, defaults: { anchor: '100%' }, items: [{ allowBlank: false, - fieldLabel: strings.login_user, + fieldLabel: Strings.login_user, name: 'user' }, { allowBlank: false, - fieldLabel: strings.login_password, + fieldLabel: Strings.login_password, name: 'password', inputType: 'password' }], buttons: [ - { text: strings.login_register }, - { text: strings.login_login } + { text: Strings.login_register }, + { text: Strings.login_login } ] }); Ext.define('Login', { extend: 'Ext.window.Window', - title: strings.login_title, + title: Strings.login_title, items: [{ xtype: 'login-form' }] }); diff --git a/web/MainView.js b/web/MainView.js index 3aaeb1ef4..e736b82b8 100644 --- a/web/MainView.js +++ b/web/MainView.js @@ -32,7 +32,7 @@ Ext.define('MainView', { items: [{ region:'west', xtype: 'device-view', - width: styles.device_width + width: Styles.device_width }, { region: 'center', xtype: 'map-view', diff --git a/web/MapView.js b/web/MapView.js index 4cc809860..6e9ca0325 100644 --- a/web/MapView.js +++ b/web/MapView.js @@ -18,24 +18,24 @@ Ext.define('MapView', { extend: 'Ext.form.Panel', xtype: 'map-view', - title: strings.map_title, + title: Strings.map_title, layout: 'fit', listeners: { afterrender: function() { - /*var layer = new ol.layer.Tile({source: new ol.source.BingMaps({ + /*var layer = new ol.layer.Tile({ source: new ol.source.BingMaps({ key: 'AseEs0DLJhLlTNoxbNXu7DGsnnH4UoWuGue7-irwKkE3fffaClwc9q_Mr6AyHY8F', imagerySet: 'Road' })});*/ - var layer = new ol.layer.Tile({source: new ol.source.OSM({ + var layer = new ol.layer.Tile({ source: new ol.source.OSM({ })}); var view = new ol.View({ - center: ol.proj.transform(styles.map_center, 'EPSG:4326', 'EPSG:3857'), - zoom: styles.map_zoom, - maxZoom: styles.map_max_zoom + center: ol.proj.transform(Styles.map_center, 'EPSG:4326', 'EPSG:3857'), + zoom: Styles.map_zoom, + maxZoom: Styles.map_max_zoom }); this.map = new ol.Map({ diff --git a/web/Strings.js b/web/Strings.js index a08791973..5d310fb4c 100644 --- a/web/Strings.js +++ b/web/Strings.js @@ -14,7 +14,8 @@ * limitations under the License. */ -var strings = { +Ext.define('Strings', { + singleton: true, login_title: 'Login', login_user: 'User', @@ -26,4 +27,4 @@ var strings = { map_title: 'Map' -}; +}); diff --git a/web/Styles.js b/web/Styles.js index 3feca2700..ea154ba2e 100644 --- a/web/Styles.js +++ b/web/Styles.js @@ -14,7 +14,8 @@ * limitations under the License. */ -var styles = { +Ext.define('Styles', { + singleton: true, panel_padding: 10, @@ -24,4 +25,4 @@ var styles = { map_zoom: 6, map_max_zoom: 16 -}; +}); diff --git a/web/index.html b/web/index.html index ef4900bfb..82c6b2660 100644 --- a/web/index.html +++ b/web/index.html @@ -7,8 +7,6 @@ - - -- cgit v1.2.3