Preliminary Target #new support
This commit is contained in:
@@ -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]
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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]
|
||||
|
||||
13
app/helpers/targets_helper.rb
Normal file
13
app/helpers/targets_helper.rb
Normal 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
|
||||
Reference in New Issue
Block a user