<%= fields_for :routine do |routine_f| %>

<%= routine_f.select :id, options_from_collection_for_select( @project.measurement_routines, :id, :name, @routine.id), {required: true}, autocomplete: 'off', onchange: "var mr_id = $('#measurement_routine_attributes_id').val(); $.ajax({ url: '#{measurement_routine_path(id: :mr_id)}'.replace('mr_id', mr_id), dataType: 'script' }); return false;" %> <%= link_to_if l(:button_edit), '#', onclick: "var mr_id = $('#measurement_routine_attributes_id').val(); $.ajax({ url: '#{edit_measurement_routine_path(id: :mr_id)}'.replace('mr_id', mr_id), dataType: 'script' }); return false;", class: 'icon icon-edit' %> <%= link_to_if l(:button_cancel), '#', onclick: "cancel edit" %>

<% if @routine.persisted? %> <% if @routine.description? %>

<%= @routine.description %>

<% end %> <% else %>

<%= routine_f.text_field :name, required: true, style: "width: 95%;" %>

<%= ff.text_area :description, cols: 40, rows: 3, style: "width: 95%;" %>

<% end %> <% end %>