SpeciesFileGroup/taxonworks

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

Summary

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

  <div class="field">
    <%= f.label :subject_taxon_name %>
    <br>
    <%= render :partial => 'workbench/elements/forms/ajax_select',
      :locals => {:controller => 'taxon_names',
                  :object => 'taxon_name_relationship',
                  :method => 'subject_taxon_name_id',
                  :tag_id => 'subject_taxon_name_id_for_taxon_name_relationship',
                  :display => (@taxon_name_relationship.subject_taxon_name.cached if @taxon_name_relationship.subject_taxon_name),
                  :size => 40} %>
              </div>


  <div class="field">
    <%= f.label :type %><br>
    <%= f.select :type, options_for_select(TAXON_NAME_RELATIONSHIPS_SUBJECT_SELECT, @taxon_name_relationship.type)  %>
  </div>

  <div class="field">
    <%= f.label :object_taxon_name %>
    <br>
    <%= render :partial => 'workbench/elements/forms/ajax_select',
      :locals => {:controller => 'taxon_names',
                  :object => 'taxon_name_relationship',
                  :method => 'object_taxon_name_id',
                  :tag_id => 'object_taxon_name_id_for_taxon_name_relationship',
                  :display => (@taxon_name_relationship.object_taxon_name.cached if @taxon_name_relationship.object_taxon_name),
                  :size => 40} %>
              </div>


    <%= f.fields_for :origin_citation, @taxon_name_relationship.origin_citation do |s| -%>
      <div class="field">
        <%= s.label :source %>
        <br>
        <%= render( partial: 'workbench/elements/forms/ajax_select', locals:
                   {controller: 'sources',
                    related_object: @taxon_name_relationship.source,
                    object: 'taxon_name_relationship[origin_citation_attributes]',
                    method: 'source_id',
                    tag_id: 'source_id_for_original_citation_taxon_name',
                    size: '50%',
                    display: source_tag(@taxon_name_relationship.source)}) 
                  %>
    </div>
  <% end %>



  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>