aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-04 19:05:01 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-04 19:05:01 +1300
commit80c3aaf2af10c8d94b18f01a0a3d825437a5596d (patch)
tree09fab6f041d01ef26acacb12f071c3d6a503fa24
parent99d132dc78b42b6cc5833b3a7faf30d2fe56186f (diff)
downloadtrackermap-server-80c3aaf2af10c8d94b18f01a0a3d825437a5596d.tar.gz
trackermap-server-80c3aaf2af10c8d94b18f01a0a3d825437a5596d.tar.bz2
trackermap-server-80c3aaf2af10c8d94b18f01a0a3d825437a5596d.zip
Create a base edit toolbar class
-rw-r--r--web/app/view/BaseEditToolbar.js48
-rw-r--r--web/app/view/Device.js88
-rw-r--r--web/app/view/DeviceController.js4
-rw-r--r--web/app/view/User.js32
-rw-r--r--web/app/view/UserController.js4
5 files changed, 87 insertions, 89 deletions
diff --git a/web/app/view/BaseEditToolbar.js b/web/app/view/BaseEditToolbar.js
new file mode 100644
index 000000000..2eb76ef36
--- /dev/null
+++ b/web/app/view/BaseEditToolbar.js
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+
+Ext.define('Traccar.view.BaseEditToolbar', {
+ extend: 'Ext.toolbar.Toolbar',
+ xtype: 'baseEditToolbar',
+
+ initComponent: function () {
+ this.callParent(arguments);
+ this.add(0, [{
+ xtype: 'button',
+ handler: 'onAddClick',
+ reference: 'toolbarAddButton',
+ glyph: 'xf067@FontAwesome',
+ tooltip: Strings.sharedAdd,
+ tooltipType: 'title'
+ }, {
+ xtype: 'button',
+ disabled: true,
+ handler: 'onEditClick',
+ reference: 'toolbarEditButton',
+ glyph: 'xf040@FontAwesome',
+ tooltip: Strings.sharedEdit,
+ tooltipType: 'title'
+ }, {
+ xtype: 'button',
+ disabled: true,
+ handler: 'onRemoveClick',
+ reference: 'toolbarRemoveButton',
+ glyph: 'xf00d@FontAwesome',
+ tooltip: Strings.sharedRemove,
+ tooltipType: 'title'
+ }]);
+ }
+});
diff --git a/web/app/view/Device.js b/web/app/view/Device.js
index cf7e3e473..ad338c648 100644
--- a/web/app/view/Device.js
+++ b/web/app/view/Device.js
@@ -29,9 +29,8 @@ Ext.define('Traccar.view.Device', {
title: Strings.deviceTitle,
selType: 'rowmodel',
- dockedItems: [{
- xtype : 'baseEditToolbar',
- dock : "top",
+ tbar: {
+ xtype: 'baseEditToolbar',
items: [{
disabled: true,
handler: 'onCommandClick',
@@ -39,70 +38,31 @@ Ext.define('Traccar.view.Device', {
glyph: 'xf093@FontAwesome',
tooltip: Strings.deviceCommand,
tooltipType: 'title'
- }]
- }],
-
- //tbar: {
- // xtype: 'baseEditToolbar',
- /*items: [{
- disabled: true,
- handler: 'onCommandClick',
- reference: 'deviceCommandButton',
- glyph: 'xf093@FontAwesome',
- tooltip: Strings.deviceCommand,
- tooltipType: 'title'
- }]*/
- //},
-
- /*tbar: [{
- handler: 'onAddClick',
- reference: 'deviceAddButton',
- glyph: 'xf067@FontAwesome',
- tooltip: Strings.sharedAdd,
- tooltipType: 'title'
- }, {
- disabled: true,
- handler: 'onEditClick',
- reference: 'deviceEditButton',
- glyph: 'xf040@FontAwesome',
- tooltip: Strings.sharedEdit,
- tooltipType: 'title'
- }, {
- disabled: true,
- handler: 'onRemoveClick',
- reference: 'deviceRemoveButton',
- glyph: 'xf00d@FontAwesome',
- tooltip: Strings.sharedRemove,
- tooltipType: 'title'
- }, {
- disabled: true,
- handler: 'onCommandClick',
- reference: 'deviceCommandButton',
- glyph: 'xf093@FontAwesome',
- tooltip: Strings.deviceCommand,
- tooltipType: 'title'
- }, {
- xtype: 'tbfill'
- }, {
- text: Strings.settingsTitle,
- menu: [{
- text: Strings.settingsUser,
- handler: 'onUserClick'
}, {
- text: Strings.settingsServer,
- hidden: true,
- handler: 'onServerClick',
- reference: 'settingsServerButton'
+ xtype: 'tbfill'
}, {
- text: Strings.settingsUsers,
- hidden: true,
- handler: 'onUsersClick',
- reference: 'settingsUsersButton'
+ glyph: 'xf013@FontAwesome',
+ tooltip: Strings.settingsTitle,
+ tooltipType: 'title',
+ menu: [{
+ text: Strings.settingsUser,
+ handler: 'onUserClick'
+ }, {
+ text: Strings.settingsServer,
+ hidden: true,
+ handler: 'onServerClick',
+ reference: 'settingsServerButton'
+ }, {
+ text: Strings.settingsUsers,
+ hidden: true,
+ handler: 'onUsersClick',
+ reference: 'settingsUsersButton'
+ }, {
+ text: Strings.loginLogout,
+ handler: 'onLogoutClick'
+ }]
}]
- }, {
- text: Strings.loginLogout,
- handler: 'onLogoutClick'
- }],*/
+ },
listeners: {
selectionchange: 'onSelectionChange'
diff --git a/web/app/view/DeviceController.js b/web/app/view/DeviceController.js
index a2e0aaae8..c3d1d4787 100644
--- a/web/app/view/DeviceController.js
+++ b/web/app/view/DeviceController.js
@@ -97,8 +97,8 @@ Ext.define('Traccar.view.DeviceController', {
onSelectionChange: function (selected) {
var empty = selected.getCount() === 0;
- this.lookupReference('deviceEditButton').setDisabled(empty);
- this.lookupReference('deviceRemoveButton').setDisabled(empty);
+ this.lookupReference('toolbarEditButton').setDisabled(empty);
+ this.lookupReference('toolbarRemoveButton').setDisabled(empty);
this.lookupReference('deviceCommandButton').setDisabled(empty);
if (!empty) {
this.fireEvent('selectDevice', selected.getLastSelected());
diff --git a/web/app/view/User.js b/web/app/view/User.js
index b642b5518..0a833e5c9 100644
--- a/web/app/view/User.js
+++ b/web/app/view/User.js
@@ -19,7 +19,8 @@ Ext.define('Traccar.view.User', {
xtype: 'userView',
requires: [
- 'Traccar.view.UserController'
+ 'Traccar.view.UserController',
+ 'Traccar.view.BaseEditToolbar'
],
controller: 'user',
@@ -27,26 +28,15 @@ Ext.define('Traccar.view.User', {
selType: 'rowmodel',
- tbar: [{
- text: Strings.sharedAdd,
- handler: 'onAddClick',
- reference: 'deviceAddButton'
- }, {
- text: Strings.sharedEdit,
- disabled: true,
- handler: 'onEditClick',
- reference: 'userEditButton'
- }, {
- text: Strings.sharedRemove,
- disabled: true,
- handler: 'onRemoveClick',
- reference: 'userRemoveButton'
- }, {
- text: Strings.deviceTitle,
- disabled: true,
- handler: 'onDevicesClick',
- reference: 'userDevicesButton'
- }],
+ tbar: {
+ xtype: 'baseEditToolbar',
+ items: [{
+ text: Strings.deviceTitle,
+ disabled: true,
+ handler: 'onDevicesClick',
+ reference: 'userDevicesButton'
+ }]
+ },
listeners: {
selectionchange: 'onSelectionChange'
diff --git a/web/app/view/UserController.js b/web/app/view/UserController.js
index 6615c7e49..10d1ded85 100644
--- a/web/app/view/UserController.js
+++ b/web/app/view/UserController.js
@@ -78,8 +78,8 @@ Ext.define('Traccar.view.UserController', {
onSelectionChange: function (selected) {
var disabled = selected.length > 0;
- this.lookupReference('userEditButton').setDisabled(disabled);
- this.lookupReference('userRemoveButton').setDisabled(disabled);
+ this.lookupReference('toolbarEditButton').setDisabled(disabled);
+ this.lookupReference('toolbarRemoveButton').setDisabled(disabled);
this.lookupReference('userDevicesButton').setDisabled(disabled);
}