|
@@ -3,6 +3,7 @@
|
|
|
<t:template>
|
|
<t:template>
|
|
|
<jsp:attribute name="title">Add Recipe</jsp:attribute>
|
|
<jsp:attribute name="title">Add Recipe</jsp:attribute>
|
|
|
<jsp:attribute name="head">
|
|
<jsp:attribute name="head">
|
|
|
|
|
+ <script type="text/javascript" src="static/ieat-ui.js"></script>
|
|
|
<script type="text/javascript" src="static/ndbDatabase.js"></script>
|
|
<script type="text/javascript" src="static/ndbDatabase.js"></script>
|
|
|
<script type="text/javascript" src="static/basicFoodEditor.js"></script>
|
|
<script type="text/javascript" src="static/basicFoodEditor.js"></script>
|
|
|
<script type="text/javascript" src="static/Food.js"></script>
|
|
<script type="text/javascript" src="static/Food.js"></script>
|
|
@@ -10,19 +11,8 @@
|
|
|
<script type="text/javascript" src="static/searchBar.js"></script>
|
|
<script type="text/javascript" src="static/searchBar.js"></script>
|
|
|
<script type="text/javascript">
|
|
<script type="text/javascript">
|
|
|
var app = angular.module('recipe',
|
|
var app = angular.module('recipe',
|
|
|
- ['ui.bootstrap', 'Food', 'ieat.ui.editors']);
|
|
|
|
|
- app.directive('myOnEnter', function () {
|
|
|
|
|
- return function (scope, element, attrs) {
|
|
|
|
|
- element.bind("keydown keypress", function (event) {
|
|
|
|
|
- if(event.which === 13) {
|
|
|
|
|
- scope.$apply(function (){
|
|
|
|
|
- scope.$eval(attrs.myOnEnter);
|
|
|
|
|
- });
|
|
|
|
|
- event.preventDefault();
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- };
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ ['ui.bootstrap', 'Food', 'ieat.ui',
|
|
|
|
|
+ 'ieat.ui.editors']);
|
|
|
app.controller('SearchController',
|
|
app.controller('SearchController',
|
|
|
['$scope', '$uibModal', 'Food', 'Recipe', 'Unit',
|
|
['$scope', '$uibModal', 'Food', 'Recipe', 'Unit',
|
|
|
function($scope, $uibModal, Food, Recipe, Unit) {
|
|
function($scope, $uibModal, Food, Recipe, Unit) {
|
|
@@ -44,7 +34,7 @@
|
|
|
var newIngredientCtrl = [
|
|
var newIngredientCtrl = [
|
|
|
'$scope', '$uibModalInstance', 'food', 'units',
|
|
'$scope', '$uibModalInstance', 'food', 'units',
|
|
|
function($scope, $uibModalInstance, food, units) {
|
|
function($scope, $uibModalInstance, food, units) {
|
|
|
- $scope.food = food.name;
|
|
|
|
|
|
|
+ $scope.food = food;
|
|
|
$scope.units = units;
|
|
$scope.units = units;
|
|
|
$scope.unit = primeUnits[food.unit_type];
|
|
$scope.unit = primeUnits[food.unit_type];
|
|
|
$scope.submit = $uibModalInstance.close;
|
|
$scope.submit = $uibModalInstance.close;
|
|
@@ -112,7 +102,7 @@
|
|
|
<td style="width: 50%;" colspan="2">
|
|
<td style="width: 50%;" colspan="2">
|
|
|
<ul>
|
|
<ul>
|
|
|
<li data-ng-repeat="ingredient in recipe.ingredients">
|
|
<li data-ng-repeat="ingredient in recipe.ingredients">
|
|
|
- {{::ingredient.amount}}
|
|
|
|
|
|
|
+ {{::ingredient.amount | number:0}}
|
|
|
{{primeUnits[ingredient.item.unit_type].symbol}}
|
|
{{primeUnits[ingredient.item.unit_type].symbol}}
|
|
|
{{::ingredient.item.name}}
|
|
{{::ingredient.item.name}}
|
|
|
<span class="glyphicon glyphicon-remove"
|
|
<span class="glyphicon glyphicon-remove"
|
|
@@ -149,7 +139,7 @@
|
|
|
</table>
|
|
</table>
|
|
|
<script type="text/ng-template" id="newIngredient">
|
|
<script type="text/ng-template" id="newIngredient">
|
|
|
<div style="width: 100%; text-align: center; padding: 0 1em 1em 0;">
|
|
<div style="width: 100%; text-align: center; padding: 0 1em 1em 0;">
|
|
|
- <span style="font-weight: bold;">{{::food}}: </span>
|
|
|
|
|
|
|
+ <span style="font-weight: bold;">{{::food.name}}: </span>
|
|
|
<input type="number" min="0" required="required"
|
|
<input type="number" min="0" required="required"
|
|
|
data-ng-model="amount" />
|
|
data-ng-model="amount" />
|
|
|
<select required="required" data-ng-model="unit"
|
|
<select required="required" data-ng-model="unit"
|
|
@@ -157,7 +147,9 @@
|
|
|
</select>
|
|
</select>
|
|
|
<button type="button"
|
|
<button type="button"
|
|
|
class="btn btn-success"
|
|
class="btn btn-success"
|
|
|
- data-ng-click="submit(unit.normalize(amount));">Submit</button>
|
|
|
|
|
|
|
+ data-ng-click="submit(unit.normalize(food, amount));">
|
|
|
|
|
+ Submit
|
|
|
|
|
+ </button>
|
|
|
<button type="button" class="btn" data-ng-click="dismiss();">
|
|
<button type="button" class="btn" data-ng-click="dismiss();">
|
|
|
Cancel
|
|
Cancel
|
|
|
</button>
|
|
</button>
|