From 6aad993645c09a4767bba5a46b480e90e4b6f156 Mon Sep 17 00:00:00 2001 From: aban4 Date: Wed, 12 Apr 2023 12:43:19 -0400 Subject: [PATCH] ingredients added to article schema and displayed in order summary --- app/controllers/articles_controller.rb | 2 ++ app/controllers/order_articles_controller.rb | 1 + app/views/articles/_form.html.haml | 1 + app/views/group_orders/_form.html.haml | 4 ++-- db/schema.rb | 1 + 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/controllers/articles_controller.rb b/app/controllers/articles_controller.rb index 4161e66a8..d12b5073a 100644 --- a/app/controllers/articles_controller.rb +++ b/app/controllers/articles_controller.rb @@ -37,6 +37,7 @@ def index end def new + puts 'in new article controller' @article = @supplier.articles.build(:tax => FoodsoftConfig[:tax_default]) render :layout => false end @@ -47,6 +48,7 @@ def copy end def create + puts 'in create article controller' @article = Article.new(params[:article]) if @article.valid? && @article.save render :layout => false diff --git a/app/controllers/order_articles_controller.rb b/app/controllers/order_articles_controller.rb index 0552269d0..bd3ec1ecb 100644 --- a/app/controllers/order_articles_controller.rb +++ b/app/controllers/order_articles_controller.rb @@ -10,6 +10,7 @@ def new end def create + puts 'in create oa controller' # The article may be ordered with zero units - in that case do not complain. # If order_article is ordered and a new order_article is created, an error message will be # given mentioning that the article already exists, which is desired. diff --git a/app/views/articles/_form.html.haml b/app/views/articles/_form.html.haml index 7cbd64cd8..481388dc9 100644 --- a/app/views/articles/_form.html.haml +++ b/app/views/articles/_form.html.haml @@ -11,6 +11,7 @@ = render partial: 'shared/article_fields_units', locals: {f: f} = f.input :note + = f.input :ingredients = f.association :article_category / TODO labels diff --git a/app/views/group_orders/_form.html.haml b/app/views/group_orders/_form.html.haml index fa0d5bdb0..4f42800f6 100644 --- a/app/views/group_orders/_form.html.haml +++ b/app/views/group_orders/_form.html.haml @@ -161,9 +161,9 @@ #{heading_helper Article, :note}: #{order_article.article.note} %br/ - - unless oa.article.note.blank? + - unless oa.article.ingredients.blank? %tr{id: "note_#{oa.id}", class: "note even", style: "display:none"} - %td{colspan: "6"}=h oa.article.note + %td{colspan: "6"}=h oa.article.ingredients #order-footer #info-box diff --git a/db/schema.rb b/db/schema.rb index ce812b3ff..b3a5ffbf9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -55,6 +55,7 @@ t.integer "article_category_id", default: 0, null: false t.string "unit", default: "", null: false t.string "note" + t.string "ingredients" t.boolean "availability", default: true, null: false t.string "manufacturer" t.string "origin"