Measurement index/form running
This commit is contained in:
parent
22aeda720d
commit
a619b74dce
@ -1,2 +1,19 @@
|
||||
module MeasurementsHelper
|
||||
def quantity_options
|
||||
nested_set_options(@project.quantities.measurement) do |q|
|
||||
raw("#{' ' * q.level}#{q.name}")
|
||||
end
|
||||
end
|
||||
|
||||
def unit_options
|
||||
@project.units.map do |u|
|
||||
[u.shortname, u.id]
|
||||
end
|
||||
end
|
||||
|
||||
def source_options
|
||||
@project.sources.map do |s|
|
||||
[s.name, s.id]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -9,7 +9,7 @@
|
||||
<div class="box tabular">
|
||||
<p><%= f.text_field :name, size: 40, required: true %></p>
|
||||
<p><%= f.select :source_id, source_options, required: false, include_blank: true %></p>
|
||||
<% @measurements.readouts.each_with_index do |r, index| %>
|
||||
<% @measurement.readouts.each_with_index do |r, index| %>
|
||||
<%= f.fields_for 'readouts_attributes', r, index: '' do |ff| %>
|
||||
<p class="readout">
|
||||
<%= ff.select :quantity_id, quantity_options,
|
||||
|
@ -53,6 +53,8 @@ en:
|
||||
measurements:
|
||||
form:
|
||||
heading_new_measurement: 'New measurement'
|
||||
button_add_readout: 'Add readout'
|
||||
button_delete_readout: 'Delete'
|
||||
index:
|
||||
heading: 'Measurements'
|
||||
link_new_measurement: 'New measurement'
|
||||
|
Reference in New Issue
Block a user