partkeepr

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

commit 85bfb7877604abf613f4880325ed4656b12dd6bc
parent 70fffef00f67d452086c70d497c62de07023c602
Author: Felicitus <felicitus@felicitus.org>
Date:   Sat, 25 Jul 2015 00:26:23 +0200

Implemented virtual root node to get rid of hardcoded root category. Note that ExtJS cannot replace the ID of a tree's root node when loading via AJAX, so that's why we wrap our PHP category root node one level deeper.

Diffstat:
Msrc/PartKeepr/FrontendBundle/Resources/public/js/Components/CategoryEditor/CategoryEditorTree.js | 11+++++------
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/CategoryEditor/CategoryEditorTree.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/CategoryEditor/CategoryEditorTree.js @@ -42,15 +42,14 @@ Ext.define("PartKeepr.CategoryEditorTree", { this.fireEvent("foreignModelDrop", draggedRecord, droppedOn); } }, - onCategoryDrop: function (node, data, overModel, dropPosition, eOpts) + onCategoryDrop: function (node, data, overModel, dropPosition) { var draggedRecord = data.records[0]; - var droppedOn = this.getView().getRecord(node); if (!(draggedRecord instanceof PartKeepr.data.HydraTreeModel)) { return; } else { - + var targetRecord; if (dropPosition === "after" || dropPosition === "before") { targetRecord = overModel.parentNode; @@ -153,11 +152,11 @@ Ext.define("PartKeepr.CategoryEditorTree", { }, _onExpandClick: function () { - this.getRootNode().expand(true); + this.getRootNode().firstChild.expand(true); }, _onCollapseClick: function () { - this.getRootNode().collapse(true); + this.getRootNode().firstChild.collapse(true); }, confirmCategoryDelete: function () { @@ -191,7 +190,7 @@ Ext.define("PartKeepr.CategoryEditorTree", { j.show(); }, - onUpdateRecord: function (record) + onUpdateRecord: function () { this.store.load(); },