1
0
This repository has been archived on 2023-12-07. You can view files and clone it, but cannot push or open issues or pull requests.
body_tracking/app/helpers/meals_helper.rb
2020-04-18 18:29:53 +02:00

19 lines
509 B
Ruby

module MealsHelper
def meal_links(m)
link_to(l(:button_edit), edit_meal_path(m),
{remote: true, class: "icon icon-edit"}) +
delete_link(meal_path(m), {remote: true, data: {}})
end
def adjust_ingredient_links(i)
[-10, -1, 0, 1, 10].map do |v|
if v != 0
link_to "%+d" % v, adjust_ingredient_path(i, adjustment: v),
{remote: true, method: :post, class: "button #{v>0 ? 'green' : 'red'}"}
else
yield.to_s
end
end.reduce(:+)
end
end