diff options
Diffstat (limited to 'web/app')
-rw-r--r-- | web/app/view/BaseEditToolbar.js | 48 | ||||
-rw-r--r-- | web/app/view/Device.js | 88 | ||||
-rw-r--r-- | web/app/view/DeviceController.js | 4 | ||||
-rw-r--r-- | web/app/view/User.js | 32 | ||||
-rw-r--r-- | web/app/view/UserController.js | 4 |
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); } |