SpeciesFileGroup/taxonworks

View on GitHub
app/views/data_attributes/_form.html.erb

Summary

Maintainability
Test Coverage
<%= form_for(@data_attribute.metamorphosize) do |f| %>
    <%= render 'shared/errors', object: @data_attribute %>

    <p><strong><%= @data_attribute.attribute_subject.class.name %>
      :</strong> <%= object_tag(@data_attribute.attribute_subject) -%>  </p>

    <%= f.hidden_field :type, value: (@data_attribute.type.blank? ? 'InternalAttribute' : @data_attribute.type) %>
    <%= f.hidden_field :attribute_subject_type %>
    <%= f.hidden_field :attribute_subject_id %>
    <div class="field">

      <%= f.label 'Predicate' %>
      <br>

      <% if @data_attribute.type == 'InternalAttribute' || @data_attribute.type.blank? %>

      <%= render(partial: 'workbench/elements/forms/ajax_select',
                 locals: {controller:  'predicates',
                             object: 'data_attribute',
                             method: 'controlled_vocabulary_term_id',
                             tag_id: 'controlled_vocabulary_term_id_for_data_attribute',
                             display: data_attribute_predicate_tag(@data_attribute),
                            size:  40}) %>
      <% else %>
          <%= f.text_field :import_predicate %>
      <% end %>
    </div>


    <div class="field">
      <%= f.label :value %>
      <br>
      <%= f.text_area :value %>
    </div>
    <div class="actions">
      <%= f.submit %>
    </div>
<% end %>