partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit 5a5d707a8ada6be9c83e4e9158f60d494acee99a
parent 3ea01e89d1d731369fd7ac98fb6e3efe7579d585
Author: Felicitus <felicitus@felicitus.org>
Date:   Sun, 25 Dec 2011 11:48:59 +0100

Added part view button

Diffstat:
Msrc/frontend/js/Components/Part/PartsManager.js | 1+
Msrc/frontend/js/Components/Project/ProjectPartGrid.js | 26++++++++++++++++++++++++--
2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/frontend/js/Components/Part/PartsManager.js b/src/frontend/js/Components/Part/PartsManager.js @@ -8,6 +8,7 @@ Ext.define('PartKeepr.PartManager', { extend: 'Ext.panel.Panel', alias: 'widget.PartManager', layout: 'border', + id: 'partkeepr-partmanager', border: false, padding: 5, initComponent: function () { diff --git a/src/frontend/js/Components/Project/ProjectPartGrid.js b/src/frontend/js/Components/Project/ProjectPartGrid.js @@ -42,7 +42,7 @@ Ext.define('PartKeepr.ProjectPartGrid', { this.plugins = [ this.editing ]; this.deleteButton = Ext.create("Ext.button.Button", { - text: 'Delete', + text: i18n('Delete'), disabled: true, itemId: 'delete', scope: this, @@ -50,6 +50,15 @@ Ext.define('PartKeepr.ProjectPartGrid', { handler: this.onDeleteClick }); + this.viewButton = Ext.create("Ext.button.Button", { + text: i18n('View Part'), + disabled: true, + itemId: 'view', + scope: this, + icon: 'resources/silkicons/brick_go.png', + handler: this.onViewClick + }); + this.dockedItems = [{ xtype: 'toolbar', items: [{ @@ -57,7 +66,10 @@ Ext.define('PartKeepr.ProjectPartGrid', { scope: this, icon: 'resources/silkicons/brick_add.png', handler: this.onAddClick - }, this.deleteButton] + }, + this.deleteButton, + this.viewButton + ] }]; this.callParent(); @@ -88,9 +100,19 @@ Ext.define('PartKeepr.ProjectPartGrid', { } }, /** + * Removes the currently selected row + */ + onViewClick: function () { + var selection = this.getView().getSelectionModel().getSelection()[0]; + if (selection) { + Ext.getCmp("partkeepr-partmanager").onEditPart(selection.get("part_id")); + } + }, + /** * Enables or disables the delete button, depending on the row selection */ onSelectChange: function(selModel, selections){ this.deleteButton.setDisabled(selections.length === 0); + this.viewButton.setDisabled(selections.length === 0); } }); \ No newline at end of file