1
0

Added Targets index

This commit is contained in:
cryptogopher
2020-08-06 21:52:33 +02:00
parent ffcc9553d5
commit cf3bbb205d
15 changed files with 245 additions and 45 deletions

View File

@@ -14,11 +14,15 @@ module BodyTrackersHelper
end
end
def format_time(t)
t.strftime("%R") if t
def format_date(d)
d&.strftime("%F")
end
def toggle_exposure_options(enabled, domain)
def format_time(t)
t&.strftime("%R")
end
def toggle_exposure_options(enabled, domain = :all)
enabled = enabled.map { |q| [q.name, q.id] }
enabled_ids = enabled.map(&:last)
@@ -49,8 +53,7 @@ module BodyTrackersHelper
end
end
# TODO: rename to quantities_table_header
def table_header_spec(quantities)
def quantities_table_header(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:
# * int > 0 - quantity name-labelled cell with 'int' size colspan

View File

@@ -3,11 +3,11 @@ module TargetsHelper
Target::CONDITIONS
end
def action_links(m)
link_to(l(:button_retake), retake_measurement_path(m, @view_params),
def action_links(d)
link_to(l(:button_reapply), reapply_project_targets_path(@project, d, @view_params),
{remote: true, class: "icon icon-reload"}) +
link_to(l(:button_edit), edit_measurement_path(m, @view_params),
link_to(l(:button_edit), edit_target_path(@project, d, @view_params),
{remote: true, class: "icon icon-edit"}) +
delete_link(measurement_path(m), {remote: true, data: {}})
delete_link(target_path(d), {remote: true, data: {}})
end
end