diff --git a/app/controllers/measurements_controller.rb b/app/controllers/measurements_controller.rb
index 0523f84..01b1466 100644
--- a/app/controllers/measurements_controller.rb
+++ b/app/controllers/measurements_controller.rb
@@ -47,7 +47,9 @@ class MeasurementsController < ApplicationController
end
def retake
+ @measurement = @measurement.dup
prepare_measurements
+ redirect_to project_measurements_path(@project)
end
private
diff --git a/app/views/measurements/_index.html.erb b/app/views/measurements/_index.html.erb
index dbef6f0..e40c4e0 100644
--- a/app/views/measurements/_index.html.erb
+++ b/app/views/measurements/_index.html.erb
@@ -14,8 +14,10 @@
<%= m.taken_at.strftime("%F %R") %> |
- <%= m.name %>
- <%= " (#{m.readouts.size} readouts)" %>
+ <%= m.name %>
+
+ <%= " (#{pluralize(m.readouts.size, 'readout')})" %>
+
|
<%= m.source.name if m.source.present? %> |
diff --git a/app/views/measurements/index.html.erb b/app/views/measurements/index.html.erb
index 141275b..8e8786e 100644
--- a/app/views/measurements/index.html.erb
+++ b/app/views/measurements/index.html.erb
@@ -5,11 +5,13 @@
<% if User.current.allowed_to?(:manage_common, @project) %>
<%= link_to t(".link_new_measurement"), '#', class: 'icon icon-add',
- onclick: '$("#add-measurement").show(); $("#measurement_name").focus(); return false;' %>
+ onclick: '$("#add-measurement").toggle(); $("#measurement_name").focus(); return false;'
+ %>
<% end %>
->
+<% hide_add_form = @measurement.errors.empty? && (action_name != "retake") %>
+ >
<%= t ".heading_new_measurement" %>
<%= labelled_form_for @measurement,
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 462e382..b932913 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -59,12 +59,12 @@ en:
confirm_defaults: 'This will load default quantities and units. Continue?'
measurements:
form:
- heading_new_measurement: 'New measurement'
button_add_readout: 'Add readout'
button_delete_readout: 'Delete'
null_source: '- unspecified -'
index:
heading: 'Measurements'
+ heading_new_measurement: 'New measurement'
link_new_measurement: 'New measurement'
ingredients:
contextual:
|