diff --git a/app/controllers/ingredients_controller.rb b/app/controllers/ingredients_controller.rb index 4aca11b..e98aeaf 100644 --- a/app/controllers/ingredients_controller.rb +++ b/app/controllers/ingredients_controller.rb @@ -2,7 +2,7 @@ class IngredientsController < ApplicationController before_action :set_ingredient, only: [:show, :edit, :update, :destroy] - before_action :ensure_valid_user, except: [:index] + before_action :ensure_valid_user, except: [:index, :show] # GET /ingredients # GET /ingredients.json @@ -39,7 +39,7 @@ class IngredientsController < ApplicationController respond_to do |format| if @ingredient.save format.html { redirect_to ingredients_path, notice: 'Ingredient was successfully created.' } - format.json { render :show, status: :created, location: @ingredient } + format.json { render json: { success: true }, status: :created, location: @ingredient } else format.html { render :new } format.json { render json: @ingredient.errors, status: :unprocessable_entity } @@ -58,7 +58,7 @@ class IngredientsController < ApplicationController respond_to do |format| if @ingredient.save format.html { redirect_to ingredients_path, notice: 'Ingredient was successfully updated.' } - format.json { render :show, status: :ok, location: @ingredient } + format.json { render json: { success: true }, status: :ok, location: @ingredient } else format.html { render :edit } format.json { render json: @ingredient.errors, status: :unprocessable_entity } @@ -92,9 +92,7 @@ class IngredientsController < ApplicationController @ingredient.set_usda_food(UsdaFood.find_by_ndbn(@ingredient.ndbn)) end - respond_to do |format| - format.js {} - end + render :show end def prefetch @@ -134,7 +132,7 @@ class IngredientsController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def ingredient_params - params.require(:ingredient).permit(:name, :notes, :ndbn, :density, :water, :protein, :lipids, :carbohydrates, :kcal, :fiber, :sugar, :calcium, :sodium, :vit_k, :ingredient_units_attributes => [:name, :gram_weight, :id, :_destroy]) + params.require(:ingredient).permit(:name, :notes, :ndbn, :density, :water, :protein, :lipids, :carbohydrates, :kcal, :fiber, :sugar, :calcium, :sodium, :vit_k, :ash, :iron, :magnesium, :phosphorus, :potassium, :zinc, :copper, :manganese, :vit_c, :vit_b6, :vit_b12, :vit_a, :vit_e, :vit_d, :cholesterol, :ingredient_units_attributes => [:name, :gram_weight, :id, :_destroy]) end def conversion_params diff --git a/app/controllers/recipes_controller.rb b/app/controllers/recipes_controller.rb index 875db4b..b3c765e 100644 --- a/app/controllers/recipes_controller.rb +++ b/app/controllers/recipes_controller.rb @@ -60,8 +60,6 @@ class RecipesController < ApplicationController if @recipe.update(recipe_params) render json: { success: true } else - puts '====' - puts @recipe.recipe_ingredients.map { |ri| ri.ingredient_id.class }.join("|") render json: @recipe.errors, status: :unprocessable_entity end end diff --git a/app/javascript/components/AppDateTime.vue b/app/javascript/components/AppDateTime.vue new file mode 100644 index 0000000..256f77f --- /dev/null +++ b/app/javascript/components/AppDateTime.vue @@ -0,0 +1,94 @@ + + + + + \ No newline at end of file diff --git a/app/javascript/components/AppIcon.vue b/app/javascript/components/AppIcon.vue index 3d8d972..6338437 100644 --- a/app/javascript/components/AppIcon.vue +++ b/app/javascript/components/AppIcon.vue @@ -10,9 +10,12 @@ import CaretTop from "open-iconic/svg/caret-top"; import Check from "open-iconic/svg/check"; import CircleCheck from "open-iconic/svg/circle-check.svg"; + import LinkBroken from "open-iconic/svg/link-broken"; + import LinkIntact from "open-iconic/svg/link-intact"; import LockLocked from "open-iconic/svg/lock-locked"; import LockUnlocked from "open-iconic/svg/lock-unlocked"; import Person from "open-iconic/svg/person"; + import Pencil from "open-iconic/svg/pencil"; import Star from "open-iconic/svg/star"; import X from "open-iconic/svg/x"; @@ -21,8 +24,11 @@ 'caret-top': CaretTop, check: Check, 'circle-check': CircleCheck, + 'link-broken': LinkBroken, + 'link-intact': LinkIntact, 'lock-locked': LockLocked, 'lock-unlocked': LockUnlocked, + pencil: Pencil, person: Person, star: Star, x: X @@ -85,24 +91,29 @@ fill: currentColor; &.sm { + width: 0.6em; + height: 0.6em; + } + + &.md { width: 1em; height: 1em; } - &.md { + &.lg { width: 1.33em; height: 1.33em; } - &.lg { + &.xl { width: 2em; height: 2em; } - &.xl { - width: 3em; - height: 3em; - } + /*&.xl {*/ + /*width: 3em;*/ + /*height: 3em;*/ + /*}*/ } } diff --git a/app/javascript/components/AppPager.vue b/app/javascript/components/AppPager.vue new file mode 100644 index 0000000..06f111b --- /dev/null +++ b/app/javascript/components/AppPager.vue @@ -0,0 +1,100 @@ + + + + + \ No newline at end of file diff --git a/app/javascript/components/AppTagEditor.vue b/app/javascript/components/AppTagEditor.vue new file mode 100644 index 0000000..25baae8 --- /dev/null +++ b/app/javascript/components/AppTagEditor.vue @@ -0,0 +1,64 @@ + + + \ No newline at end of file diff --git a/app/javascript/components/IngredientEdit.vue b/app/javascript/components/IngredientEdit.vue index 8eeeef7..0637a23 100644 --- a/app/javascript/components/IngredientEdit.vue +++ b/app/javascript/components/IngredientEdit.vue @@ -9,10 +9,28 @@ -
- + + +
- + +
+
+ + +
+
+
@@ -23,13 +41,6 @@
-
- Ingredient Units - - - -
-
@@ -37,31 +48,96 @@
-
- Nutrition per 100 grams +
+
+
+
+ Custom Units +
-
-
- -
-
- -
-
- -
+
+ + + + + + + + + + + + + +
NameGrams
+
+ +
+
+
+ +
+
+ +
-
+
+
+
+ NDBN Units +
+ +
+ + + + + + + + + + +
NameGrams
{{unit.description}}{{unit.gram_weight}}
+ +
+
+
+ + +
+
+ Nutrition per 100 grams +
+ +
+
+
+ +
+
+ +
+
+ +
+
+
+
+
+