1
0

WIP: Targets configurable with Quantities

This commit is contained in:
cryptogopher
2021-02-07 11:02:41 +01:00
parent 316005bf1f
commit 8b17b33603
23 changed files with 218 additions and 108 deletions

View File

@@ -36,17 +36,18 @@ module BodyTrackersHelper
options_for_select(options, disabled: 0)
end
def quantity_options(domain = :all)
def quantity_options(domain = :except_targets)
Quantity.each_with_ancestors(@project.quantities.send(domain)).map do |ancestors|
quantity = ancestors.last
[
raw("#{' ' * (ancestors.length-2)}#{quantity.name}"),
raw(' '*(ancestors.length-2) + quantity.name),
quantity.id,
{'data-path' => ancestors[1..-2].reduce('::') { |m, q| "#{m}#{q.try(:name)}::" }}
]
end
end
# TODO: replace with collection_select and remove
def unit_options
@project.units.map do |u|
[u.shortname, u.id]

View File

@@ -1,8 +1,4 @@
module TargetsHelper
def condition_options
Target::CONDITIONS
end
def action_links(d)
link_to(l(:button_reapply), reapply_project_targets_path(@project, d, @view_params),
{remote: true, class: "icon icon-reload"}) +