1
0

Added Target create action

This commit is contained in:
cryptogopher
2020-07-25 16:28:55 +02:00
parent 5b83860ed7
commit ffcc9553d5
12 changed files with 154 additions and 66 deletions

View File

@@ -33,8 +33,13 @@ module BodyTrackersHelper
end
def quantity_options(domain = :all)
nested_set_options(@project.quantities.send(domain)) do |q|
raw("#{' ' * q.level}#{q.name}")
Quantity.each_with_ancestors(@project.quantities.send(domain)).map do |ancestors|
quantity = ancestors.last
[
raw("#{' ' * (ancestors.length-2)}#{quantity.name}"),
quantity.id,
{'data-path' => ancestors[1..-2].reduce('::') { |m, q| "#{m}#{q.try(:name)}::" }}
]
end
end
@@ -44,6 +49,7 @@ module BodyTrackersHelper
end
end
# TODO: rename to quantities_table_header
def table_header_spec(quantities)
# spec: table of rows (tr), where each row is a hash of cells (td) (hash keeps items
# ordered the way they were added). Hash values determine cell property:

View File

@@ -1,6 +1,6 @@
module TargetsHelper
def condition_options
Target::CONDITIONS.each_with_index.to_a
Target::CONDITIONS
end
def action_links(m)