From dd51f5de6c9b23d919d04ae3835ebc993eed4442 Mon Sep 17 00:00:00 2001 From: Oskar Wiksten Date: Wed, 27 Mar 2013 19:35:56 +0100 Subject: [PATCH] Updates to content editor * Do not reset store prices on items when changing between manual and automatic pricing. * Correct urls on import/export pages to where the files are placed. * Show indications in item table editor on effects that cause actor conditions. --- AndorsTrailEdit/js/controllers/item.js | 18 +++++++++++------- AndorsTrailEdit/partials/edit_item.html | 2 +- AndorsTrailEdit/partials/export.html | 2 +- AndorsTrailEdit/partials/import.html | 2 +- AndorsTrailEdit/partials/table_item.html | 21 +++++++++++++++++---- 5 files changed, 31 insertions(+), 14 deletions(-) diff --git a/AndorsTrailEdit/js/controllers/item.js b/AndorsTrailEdit/js/controllers/item.js index 2f055edfe..1d71d08fe 100644 --- a/AndorsTrailEdit/js/controllers/item.js +++ b/AndorsTrailEdit/js/controllers/item.js @@ -6,6 +6,14 @@ var ATEditor = (function(ATEditor, model, importExport, settings, ATModelFunctio } } + function setItemPriceSuggestion(item) { + if (item.hasManualPrice == 1) { + item.baseMarketCost = ATModelFunctions.itemFunctions.calculateItemCost(item); + } else { + item.baseMarketCost = 0; + } + } + function ItemController($scope, $routeParams) { $scope.obj = model.items.findById($routeParams.id) || {}; $scope.itemCategories = model.itemCategories.items; @@ -24,10 +32,8 @@ var ATEditor = (function(ATEditor, model, importExport, settings, ATModelFunctio $scope.obj.hasKillEffect = false; } }); - $scope.$watch('obj.hasManualPrice', function(hasManualPrice) { - $scope.obj.baseMarketCost = hasManualPrice ? ATModelFunctions.itemFunctions.calculateItemCost($scope.obj) : 0; - }); + $scope.updateCost = setItemPriceSuggestion; $scope.getItemCost = ATModelFunctions.itemFunctions.getItemCost; $scope.getItemSellingCost = ATModelFunctions.itemFunctions.getItemSellingCost; $scope.getItemBuyingCost = ATModelFunctions.itemFunctions.getItemBuyingCost; @@ -49,16 +55,14 @@ var ATEditor = (function(ATEditor, model, importExport, settings, ATModelFunctio _.each($scope.items, function(item) { setCategoryToObject(item, model.itemCategories); }); - $scope.getItemCost = ATModelFunctions.itemFunctions.getItemCost; $scope.edit = function(item) { window.location = "#/" + section.id + "/edit/" + item.id; }; $scope.addObj = function() { importExport.prepareObjectsForEditor(section, [ section.addNew() ]); }; - $scope.updateCost = function(item) { - item.baseMarketCost = ATModelFunctions.itemFunctions.getItemCost(item); - }; + $scope.updateCost = setItemPriceSuggestion; + $scope.getItemCost = ATModelFunctions.itemFunctions.getItemCost; if (!settings.itemTableEditorVisibleColumns) { settings.itemTableEditorVisibleColumns = { diff --git a/AndorsTrailEdit/partials/edit_item.html b/AndorsTrailEdit/partials/edit_item.html index 13be5266b..0412ab051 100644 --- a/AndorsTrailEdit/partials/edit_item.html +++ b/AndorsTrailEdit/partials/edit_item.html @@ -51,7 +51,7 @@
Price
- +
diff --git a/AndorsTrailEdit/partials/export.html b/AndorsTrailEdit/partials/export.html index a67560800..ffaea5610 100644 --- a/AndorsTrailEdit/partials/export.html +++ b/AndorsTrailEdit/partials/export.html @@ -11,6 +11,6 @@


-

Exported data should be placed in the files named res/raw/*.json in the source code.

+

Exported data should be placed in the files named res/raw/*.json in the source code.

diff --git a/AndorsTrailEdit/partials/import.html b/AndorsTrailEdit/partials/import.html index 934ccde9a..5264d260a 100644 --- a/AndorsTrailEdit/partials/import.html +++ b/AndorsTrailEdit/partials/import.html @@ -1,6 +1,6 @@

Import

-

Data to import can be found in the files named res/raw/*.json in the source code.

+

Data to import can be found in the files named res/raw/*.json in the source code.

Import as diff --git a/AndorsTrailEdit/partials/table_item.html b/AndorsTrailEdit/partials/table_item.html index cdafebc48..5663ae2a5 100644 --- a/AndorsTrailEdit/partials/table_item.html +++ b/AndorsTrailEdit/partials/table_item.html @@ -136,7 +136,10 @@ - + + + * + @@ -154,7 +157,10 @@ - + + + * + - @@ -166,7 +172,11 @@ - + + + S + T + - @@ -178,7 +188,10 @@ - + + + * + -