1
0

Preliminary Target #new support

This commit is contained in:
cryptogopher
2020-06-27 21:52:32 +02:00
parent 1dd2e2b596
commit 0df2c6ec4f
18 changed files with 177 additions and 26 deletions

View File

@@ -32,6 +32,12 @@ module BodyTrackersHelper
options_for_select(options, disabled: 0)
end
def quantity_options(domain = :all)
nested_set_options(@project.quantities.send(domain)) do |q|
raw("#{' ' * q.level}#{q.name}")
end
end
def unit_options
@project.units.map do |u|
[u.shortname, u.id]

View File

@@ -1,10 +1,4 @@
module FoodsHelper
def quantity_options
nested_set_options(@project.quantities.diet) do |q|
raw("#{' ' * q.level}#{q.name}")
end
end
def visibility_options(selected)
options = [["visible", 1], ["hidden", 0]]
options_for_select(options, selected)

View File

@@ -5,12 +5,6 @@ module MeasurementsHelper
.html_safe
end
def quantity_options
nested_set_options(@project.quantities.measurement) do |q|
raw("#{' ' * q.level}#{q.name}")
end
end
def source_options
@project.sources.map do |s|
[s.name, s.id]

View File

@@ -0,0 +1,13 @@
module TargetsHelper
def condition_options
Target::CONDITIONS.each_with_index.to_a
end
def action_links(m)
link_to(l(:button_retake), retake_measurement_path(m, @view_params),
{remote: true, class: "icon icon-reload"}) +
link_to(l(:button_edit), edit_measurement_path(m, @view_params),
{remote: true, class: "icon icon-edit"}) +
delete_link(measurement_path(m), {remote: true, data: {}})
end
end