1
0

Added action links to readouts view

This commit is contained in:
cryptogopher
2019-12-21 18:25:02 +01:00
parent b6dbf369d1
commit df15ae746c
4 changed files with 23 additions and 32 deletions

View File

@@ -1,7 +1,8 @@
module MeasurementsHelper
def format_datetime(m)
m.taken_at.getlocal
.strftime("%F <small>%R&emsp;(#{time_ago_in_words(m.taken_at)} ago)</small>").html_safe
.strftime("%F <small>%R&emsp;(~#{time_ago_in_words(m.taken_at)} ago)</small>")
.html_safe
end
def format_time(m)
@@ -40,4 +41,12 @@ module MeasurementsHelper
[s.name, s.id]
end
end
def action_links(m)
link_to(l(:button_retake), retake_measurement_path(m),
{remote: true, class: "icon icon-reload"}) +
link_to(l(:button_edit), edit_measurement_path(m),
{remote: true, class: "icon icon-edit"}) +
delete_link(measurement_path(m), {remote: true, data: {}})
end
end