diff --git a/app/pages/food/ctrl.js b/app/pages/food/ctrl.js index 199a701..7aa5094 100644 --- a/app/pages/food/ctrl.js +++ b/app/pages/food/ctrl.js @@ -1,7 +1,31 @@ -app.controller('FoodCtrl', ['$scope', function ($scope) { +app.controller('FoodCtrl', ['$scope', '$http', function ($scope, $http) { + $http.get("assets/json/data.json") + .then(function(response) { + $scope.foods = response.data.data; + }); + $scope.page.title = 'Food'; $scope.page.id = 'food'; - $scope.page.yourVar = "globalStuff"; - $scope.var2 = "localStuff"; + $scope.editMode = false; + $scope.createMode = false; + + $scope.foodCRUD = {} + + $scope.edit = function (foodToEdit) { + $scope.editMode = true; + $scope.foodCRUD = foodToEdit; + $scope.foodCRUD.rank_mode = "0"; //TODO: remove this when API implements it + }; + + $scope.create = function () { + $scope.createMode = true; + $scope.foodCRUD = {} + $scope.foodCRUD.rank_mode = "0"; + }; + + $scope.cancel = function () { + $scope.editMode = false; + $scope.createMode = false; + }; }]); diff --git a/app/pages/food/style.styl b/app/pages/food/style.styl index a07d8f3..d4664d6 100644 --- a/app/pages/food/style.styl +++ b/app/pages/food/style.styl @@ -51,6 +51,7 @@ flex-wrap: wrap .card-panel + background: lightergray flex-grow: 1 display: flex padding: 0 @@ -61,7 +62,6 @@ &:hover transform: scale(.95) .health - background-color: green width: 3em min-width: @width min-height: @width @@ -69,6 +69,14 @@ display: flex align-items: center justify-content: center + background-color: gray + &.rank-1 + background-color: green + &.rank-2 + background-color: yellow + &.rank-3 + background-color: red + i color: white h5 @@ -88,48 +96,13 @@ -.food-crud - font-size: 1.1em - padding: 1em - border: 1px solid lightgray - my-box-shadow() - background: white - [type="radio"]:not(:checked)+label, [type="radio"]:checked+label - padding-left: 1.7em - padding-right: 1em - .grade - margin-bottom: 2em - h4 - margin: 5px 0 25px 0 - p - font-size: 1.1em - font-weight: 500 - color: #BBB - margin-bottom: 5px - a.btn - width: 48% - .orange - float: right - - .nutrition - margin-bottom: 1.5em - td - padding: .5em 5px - td:first-child - font-weight: 500 - width: 50% - -.modal_ .editContent - display: none -.modal_.editMode .editContent - display: inline -.modal_ +.foodModal + display: flex align-items: center justify-content: center - display: none; /* Hidden by default */ position: fixed; /* Stay in place */ z-index: 1; /* Sit on top */ left: 0; @@ -139,3 +112,34 @@ overflow: auto; /* Enable scroll if needed */ background-color: rgb(0,0,0); /* Fallback color */ background-color: rgba(0,0,0,0.4); /* Black w/ opacity */ + + .CRUD + font-size: 1.1em + padding: 1em + border: 1px solid lightgray + my-box-shadow() + background: white + [type="radio"]:not(:checked)+label, [type="radio"]:checked+label + padding-left: 1.7em + padding-right: 1em + .grade + margin-bottom: 2em + h4 + margin: 5px 0 25px 0 + p + font-size: 1.1em + font-weight: 500 + color: #BBB + margin-bottom: 5px + a.btn + width: 48% + .orange + float: right + + .nutrition + margin-bottom: 1.5em + td + padding: .5em 5px + td:first-child + font-weight: 500 + width: 50% diff --git a/app/pages/food/view.html b/app/pages/food/view.html index b81a390..aac25c4 100644 --- a/app/pages/food/view.html +++ b/app/pages/food/view.html @@ -1,3 +1,4 @@ + + +
@@ -57,42 +60,41 @@
By Grade
+ +
-
-
- add -
+
+
add
Add new food
-
-
- favorite -
-
{{n}}
+
+
favorite
+
{{food.name}}
+ -