From 1b80c527637d626096b20610631d946f038b06d5 Mon Sep 17 00:00:00 2001 From: tanshu Date: Mon, 14 Mar 2016 16:48:36 +0530 Subject: [PATCH] Fix: Recipe Ingredient autocomplete focusing and clearing properly --- brewman/static/partial/recipe-detail.html | 2 +- brewman/static/scripts/recipe.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/brewman/static/partial/recipe-detail.html b/brewman/static/partial/recipe-detail.html index 8d213ec5..04d9459a 100644 --- a/brewman/static/partial/recipe-detail.html +++ b/brewman/static/partial/recipe-detail.html @@ -32,7 +32,7 @@
- diff --git a/brewman/static/scripts/recipe.js b/brewman/static/scripts/recipe.js index 77d5a177..613cab06 100644 --- a/brewman/static/scripts/recipe.js +++ b/brewman/static/scripts/recipe.js @@ -14,6 +14,7 @@ var RecipeController = ['$scope', '$location', '$window', '$modal', 'asDateFilte recipe.ValidFrom = moment(recipe.ValidFrom, 'DD-MMM-YYYY').toDate(); recipe.ValidTo = moment(recipe.ValidTo, 'DD-MMM-YYYY').toDate(); $scope.recipe = recipe; + $scope.foIngredient = recipe.RecipeItems > 0; $scope.costPrice = 0; function getOld(productID, recipeItems) { @@ -40,7 +41,8 @@ var RecipeController = ['$scope', '$location', '$window', '$modal', 'asDateFilte } delete $scope.quantity; delete $scope.product; - $scope.foProduct = true; + $scope.searchIngredient = ''; + $scope.foIngredient = true; }; $scope.removeItem = function (item) { @@ -106,8 +108,6 @@ var RecipeController = ['$scope', '$location', '$window', '$modal', 'asDateFilte $scope.delete(); }); }; - $scope.foName = true; - $scope.products = function ($viewValue, options) { return Product.autocomplete(angular.extend({term: $viewValue, count: 20, a: true, e: true}, options)).$promise; };