unepwcmc/SAPI

View on GitHub
app/views/admin/taxon_concepts/_hybrid_form.html.erb

Summary

Maintainability
Test Coverage
<%= form_for [:admin, @taxon_concept], :remote => true, :namespace => 'hybrid' do |f| %>
  <%= error_messages_for(@taxon_concept) %>
  <%= f.hidden_field :name_status, value: 'H' %>

  <div class="control-group">
    <label>Taxonomy</label>
    <%= f.select :taxonomy_id,
      options_from_collection_for_select(
        @taxonomies, :id, :name, @taxon_concept && @taxon_concept.taxonomy_id
      ),
      {},
      {class: 'taxonomy-selector'}
    %>
  </div>
  <div class="control-group">
    <label>Rank</label>
    <%= f.select :rank_id,
      options_from_collection_for_select(
        @ranks, :id, :name, @taxon_concept && @taxon_concept.rank_id
      ),
      {},
      {class: 'rank-selector'}
    %>
  </div>
  <div class="control-group">
    <label class="control-label">Hybrid parents</label>
    <div class="controls">
      <%= f.text_field :hybrid_parents_ids, {
        class: 'taxon-concept-multiple-max-2',
        :'data-name-status-filter' => ['A'].to_json,
        :'data-name-status' => 'A',
        :'data-rank-scope' => 'self_and_ancestors',
        :'data-name' => TaxonConcept.where(id: @taxon_concept.hybrid_parents_ids).pluck(:full_name).to_s
      } %>
    </div>
  </div>
  <div class="control-group">
    <label>Hybrid</label>
    <%= f.text_field :scientific_name %>
  </div>
  <div class="control-group">
    <label>Tags</label>
    <%= f.select :tag_list,
      options_from_collection_for_select(
        @tags,
        :name,
        :name,
        @taxon_concept.tag_list
      ), {},
      { :multiple => true, :class => 'tags', :style => "width: 220px"}
    %>
  </div>
  <div class="control-group">
    <label>Author & year</label>
    <%= f.text_field :author_year %>
  </div>
<% end %>