Skip to content

Commit

Permalink
ingredients added to article schema and displayed in order summary
Browse files Browse the repository at this point in the history
  • Loading branch information
aban1 committed Apr 12, 2023
1 parent 3584d58 commit 6aad993
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/controllers/articles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions app/controllers/order_articles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions app/views/articles/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions app/views/group_orders/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 6aad993

Please sign in to comment.