From 73caa858518cd9d2d1708177f51f64b6a741f1ab Mon Sep 17 00:00:00 2001 From: Gabe Rogan Date: Thu, 8 Dec 2016 17:25:11 -0500 Subject: [PATCH 1/5] first commit. added table view. fixed up nav. --- app/pages/food/ctrl.js | 12 +- app/pages/food/style.styl | 104 +- app/pages/food/view.html | 52 +- app/root/_header.kit | 4 +- app/root/_nav.kit | 29 +- app/root/root.styl | 46 +- assets/css/icons.css | 24 + assets/css/main.css | 145 +- assets/css/materialize.css | 6259 +++++++++++++++++++++++++++++++++++ assets/js/bundle.js | 28 +- assets/json/categories.json | 4 + assets/json/foods.json | 8 + index.html | 33 +- 13 files changed, 6585 insertions(+), 163 deletions(-) create mode 100644 assets/css/icons.css create mode 100644 assets/css/materialize.css diff --git a/app/pages/food/ctrl.js b/app/pages/food/ctrl.js index beb6a28..73b16ee 100644 --- a/app/pages/food/ctrl.js +++ b/app/pages/food/ctrl.js @@ -8,7 +8,8 @@ app.controller('FoodCtrl', ['$scope', '$http', function ($scope, $http) { $scope.rankSelection = { "green": true, "yellow": true, - "red": true + "red": true, + "gray": true }; $scope.categorySelection = { "all": true }; $scope.searchTerm = ""; @@ -29,7 +30,13 @@ app.controller('FoodCtrl', ['$scope', '$http', function ($scope, $http) { // GET list of categories $http.get("assets/json/categories.json") .then(function(response) { - $scope.categories = response.data.data; + var categories = response.data.data; + categories.forEach(function(cat){ + $scope.categories[cat.id] = cat; + }); + $scope.categories.forEach(function(c){ + $scope.categorySelection[c.id] = false; + }); // Preset category filters $scope.resetCategorySelection(); @@ -40,6 +47,7 @@ app.controller('FoodCtrl', ['$scope', '$http', function ($scope, $http) { $scope.categories.forEach(function(c){ $scope.categorySelection[c.id] = false; }); + } // Category filter function diff --git a/app/pages/food/style.styl b/app/pages/food/style.styl index 0802028..ea3dde1 100644 --- a/app/pages/food/style.styl +++ b/app/pages/food/style.styl @@ -1,3 +1,4 @@ +// Search bar .food-search padding-top: .5em i @@ -12,28 +13,42 @@ transform: translateY(-120%) .input-field.col label left: 0 - + .barcode margin: 0 + + + +// By Category .food-filter display: flex flex-flow: row no-wrap + justify-content: center width: 100% padding: 0 1em - .block + +below(600px) + flex-flow: row wrap + .by-category flex: 1 500px - padding: 0 1em - &:last-child - flex: 0 130px - nav - display: flex - align-items: center - justify-content: center - nav - background-color: lightergray a color: black + nav + background-color: lightergray + + +// Grades +.grade + padding-right: 1em + +above(600px) + padding: 0 1em + nav + display: flex + align-items: center + padding: 0 .9em 0 1.3em + label + position: relative + top: 2px .green[type="checkbox"].filled-in:checked+label:after border-color: green @@ -44,9 +59,19 @@ .red[type="checkbox"].filled-in:checked+label:after border-color: red background-color: red +.gray[type="checkbox"].filled-in:checked+label:after + border-color: gray + background-color: gray [type="checkbox"]+label padding-left: 26px + + +// Table view + + + + .foods display: flex padding: 3em @@ -63,28 +88,6 @@ transition: all .2s &:hover transform: scale(.95) - .health - width: 3em - min-width: @width - min-height: @width - height: 100% - display: flex - align-items: center - justify-content: center - background-color: gray - &.rank-green - background-color: green - &.rank-yellow - background-color: yellow - &.rank-red - background-color: red - - i - color: white - h5 - font-size: 1.4em - margin: .3em .7em - // "Add new food" button &.add background-color: blue @@ -95,12 +98,47 @@ font-size: 2.5em .health background-color: alpha(black, .27) + h5 + font-size: 1.4em + margin: .3em .7em + .health + width: 3em + min-width: @width + min-height: @width + height: 100% + display: flex + align-items: center + justify-content: center + background-color: purple + i + color: white + .rank-green + background-color: green + .rank-yellow + background-color: yellow + .rank-red + background-color: red + .rank-gray + background-color: gray + .table-rank + width: 3.5em + table + font-size: 1.2em + td, th + cursor: pointer + padding: .8em + tr.add + background-color: blue + color: white + td:first-child + background-color: alpha(black, .27) +// Modal .foodModal display: flex align-items: center diff --git a/app/pages/food/view.html b/app/pages/food/view.html index ded31ce..2b46dc1 100644 --- a/app/pages/food/view.html +++ b/app/pages/food/view.html @@ -15,7 +15,7 @@
-
+
By Category
-
+
By Grade
+
+ +
+
Table
+
- +
-
+
add
Add new food
- - -
+ +
favorite
{{food.name}}
+ + + + + + + + + + + + + + + + + + + + + + +
RankFoodCategory
Add new food
{{food.name}}{{categories[food.category_id].name}}
+
diff --git a/app/root/_header.kit b/app/root/_header.kit index 2ed1062..86bd8c6 100644 --- a/app/root/_header.kit +++ b/app/root/_header.kit @@ -5,8 +5,8 @@ - - + + diff --git a/app/root/_nav.kit b/app/root/_nav.kit index 5d5f290..cc94925 100644 --- a/app/root/_nav.kit +++ b/app/root/_nav.kit @@ -1,29 +1,30 @@