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-24 15:36:16 +02:00

19 lines
540 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 adjustment_buttons(i)
{'- -' => -10, '-' => -1, '+' => 1, '++' => 10}.map do |text, value|
link_to text, adjust_ingredient_path(i, adjustment: value),
{remote: true, method: :post, class: "button #{value>0 ? 'green' : 'red'}"}
end.reduce(&:+)
end
def notes(m)
content_tag(:span, m.notes)
end
end