commit 1fdb1970cf41aba1963c9e3efa080e3594da69c3
parent c63576d14b7ac81aea4ba4c7dcecdcc4359a01bc
Author: Felicia Hummel <felicitus@felicitus.org>
Date: Wed, 6 Jul 2016 19:42:28 +0200
Merge pull request #683 from partkeepr/PartKeepr-679
Handle items and categories differently, fixes #679
Diffstat:
3 files changed, 51 insertions(+), 20 deletions(-)
diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Footprint/FootprintTree.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Footprint/FootprintTree.js
@@ -23,15 +23,26 @@ Ext.define("PartKeepr.FootprintTree", {
"foreignModelDrop": function (records, target)
{
for (var i in records) {
- records[i].setCategory(target);
- records[i].save({
- success: function ()
- {
- if (records[i].store && records[i].store.reload) {
- records[i].store.reload();
- }
- }
- });
+ switch (Ext.getClassName(records[i])) {
+ case "PartKeepr.FootprintBundle.Entity.Footprint":
+ records[i].setCategory(target);
+ records[i].save({
+ success: function ()
+ {
+ if (records[i].store && records[i].store.reload) {
+ records[i].store.reload();
+ }
+ }
+ });
+ break;
+ case "PartKeepr.FootprintBundle.Entity.FootprintCategory":
+ records[i].callPutAction("move", {parent: target.getId()}, Ext.bind(function ()
+ {
+ this.store.load();
+ }, this));
+ break;
+
+ }
}
}
}
diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/PartCategoryTree.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Part/PartCategoryTree.js
@@ -33,8 +33,17 @@ Ext.define("PartKeepr.PartCategoryTree", {
"foreignModelDrop": function (records, target)
{
for (var i in records) {
- records[i].setCategory(target);
- records[i].save();
+ switch (Ext.getClassName(records[i])) {
+ case "PartKeepr.PartBundle.Entity.Part":
+ records[i].setCategory(target);
+ records[i].save();
+ break;
+ case "PartKeepr.PartBundle.Entity.PartCategory":
+ records[i].callPutAction("move", { parent: target.getId() }, Ext.bind(function () {
+ this.store.load();
+ }, this));
+ break;
+ }
}
}
}
diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/StorageLocation/StorageLocationTree.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/StorageLocation/StorageLocationTree.js
@@ -22,15 +22,26 @@ Ext.define("PartKeepr.StorageLocationTree", {
"foreignModelDrop": function (records, target)
{
for (var i in records) {
- records[i].setCategory(target);
- records[i].save({
- success: function ()
- {
- if (records[i].store && records[i].store.reload) {
- records[i].store.reload();
- }
- }
- });
+ switch (Ext.getClassName(records[i])) {
+ case "PartKeepr.StorageLocationBundle.Entity.StorageLocation":
+ records[i].setCategory(target);
+ records[i].save({
+ success: function ()
+ {
+ if (records[i].store && records[i].store.reload) {
+ records[i].store.reload();
+ }
+ }
+ });
+ break;
+ case "PartKeepr.StorageLocationBundle.Entity.StorageLocationCategory":
+ records[i].callPutAction("move", {parent: target.getId()}, Ext.bind(function ()
+ {
+ this.store.load();
+ }, this));
+ break;
+
+ }
}
}
}