1
0

Added Ingredient#toggle and dimming hidden items

This commit is contained in:
cryptogopher
2019-10-27 22:18:00 +01:00
parent 3cec0847df
commit 67efb6c6bc
8 changed files with 54 additions and 32 deletions

View File

@@ -2,7 +2,7 @@ class IngredientsController < ApplicationController
require 'csv'
before_action :find_project_by_project_id, only: [:index, :create, :import, :nutrients]
before_action :find_ingredient, only: [:destroy]
before_action :find_ingredient, only: [:destroy, :toggle]
before_action :authorize
def index
@@ -33,6 +33,11 @@ class IngredientsController < ApplicationController
redirect_to project_ingredients_url(@project)
end
def toggle
@ingredient.update(hidden: !@ingredient.hidden)
@ingredients = @project.ingredients.includes(:ref_unit, :source)
end
def import
warnings = []