diff --git a/app/helpers/measurements_helper.rb b/app/helpers/measurements_helper.rb
index 33cc015..f509984 100644
--- a/app/helpers/measurements_helper.rb
+++ b/app/helpers/measurements_helper.rb
@@ -1,7 +1,8 @@
module MeasurementsHelper
def format_datetime(m)
m.taken_at.getlocal
- .strftime("%F %R (#{time_ago_in_words(m.taken_at)} ago)").html_safe
+ .strftime("%F %R (~#{time_ago_in_words(m.taken_at)} ago)")
+ .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
diff --git a/app/views/measurements/_index.html.erb b/app/views/measurements/_index.html.erb
index eb8c1e8..f4487be 100644
--- a/app/views/measurements/_index.html.erb
+++ b/app/views/measurements/_index.html.erb
@@ -23,15 +23,7 @@
<%= m.source.name if m.source.present? %> |
- <%= 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: {}} %>
+ <%= action_links(m) %>
|
<% end %>
diff --git a/app/views/measurements/_options.html.erb b/app/views/measurements/_options.html.erb
index d6e4ff3..e9c8b89 100644
--- a/app/views/measurements/_options.html.erb
+++ b/app/views/measurements/_options.html.erb
@@ -8,28 +8,10 @@
|
-
- <%= select_tag 'quantity_id', toggle_column_options %>
- |
-
- <%= submit_tag l(:button_add) %>
- |
+ <%= select_tag 'quantity_id', toggle_column_options %> |
+ <%= submit_tag l(:button_add) %> |
<% end %>
-
-
-
- <% total_width = 3 + @quantities.length %>
- |
- <% @quantities.each do |q| %>
-
- <%= link_to l(:button_hide),
- toggle_column_measurement_path(@measurement, quantity_id: q.id),
- {class: "icon icon-close", method: :post, remote: true} %>
- |
- <% end %>
-
-
diff --git a/app/views/measurements/_readouts.html.erb b/app/views/measurements/_readouts.html.erb
index fa92dab..a83e1fe 100644
--- a/app/views/measurements/_readouts.html.erb
+++ b/app/views/measurements/_readouts.html.erb
@@ -5,10 +5,16 @@
<% total_width = 3 + @quantities.length %>
- <%= l(:field_taken_at_date) %> |
+ <%= l(:field_taken_at_date) %> |
<% @quantities.each do |q| %>
- <%= q.name %> |
+ <%= q.name %>
+
+ <%= link_to '', toggle_column_measurement_path(@measurement, quantity_id: q.id),
+ {class: "icon icon-close", method: :post, remote: true} %>
+
+ |
<% end %>
+ <%= l(:field_action) %> |
@@ -21,6 +27,7 @@
<% @requested_r[index].each do |*, value| %>
<%= format_value(value) %> |
<% end %>
+ <%= action_links(m) %> |
@@ -38,6 +45,7 @@
<%= format_value(value) %>
<% end %>
+ <%= action_links(m) %> |
<% next unless @quantities.length > 0 %>