app/views/admin/taxon_listing_changes/_form.html.erb
<%= admin_new_modal({:title => "Current Listing Changes"}) { render "current_listing_changes_form" } %>
<%= nested_form_for [:admin, @taxon_concept, @designation, @listing_change] do |f| %>
<%= error_messages_for(@listing_change) %>
<%= hidden_field_tag :redirect_to_eu_reg,
request.referrer.include?("eu_regulations") ? 1 : 0
%>
<table class="listing-change">
<thead>
<tr>
<th><%= f.label :change_type_id %></th>
<th><%= f.label :species_listing_id %></th>
<th><%= f.label :effective_at, 'Effective from' %></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<%= f.select :change_type_id,
options_from_collection_for_select(@change_types, :id, :print_name, @listing_change.change_type_id)
%>
</td>
<td>
<%= f.select :species_listing_id,
options_from_collection_for_select(@species_listings, :id, :name, @listing_change.species_listing_id),
{ :selected => @listing_change.species_listing_id }
%>
</td>
<td>
<%= f.text_field :effective_at, :class => "datepicker", :value => @listing_change.effective_at_formatted %>
</td>
</tr>
</tbody>
</table>
<table class="listing-change">
<thead>
<tr>
<% unless @designation.is_cms? %>
<th>
<label>
<% if @designation.is_cites? %>
App. III or reservation Party
<% else %>
Annex C
<% end %>
</label>
</th>
<% end %>
<th><%= f.label :inclusion_scientific_name, "Inclusion in higher taxon" %></th>
</tr>
</thead>
<tbody>
<tr>
<% unless @designation.is_cms? %>
<%= f.fields_for :party_listing_distribution do |b| %>
<td>
<%= b.select :geo_entity_id,
options_from_collection_for_select(
@geo_entities,
:id,
:name_en,
@listing_change.party_listing_distribution && @listing_change.party_listing_distribution.geo_entity_id
),
{ :include_blank => true },
{:class => 'distribution', :style => 'width: 220px' }
%>
</td>
<% end %>
<% end %>
<td>
<%= f.hidden_field :inclusion_taxon_concept_id,
"data-taxon-concept-scope" => 'ancestors',
"data-taxon-concept-id" => @taxon_concept.id,
"data-taxonomy-id" => @taxon_concept.taxonomy_id,
:style => 'width: 220px',
:id => 'inclusion_taxon_concept_id',
:value => @listing_change.inclusion && "#{@listing_change.inclusion.id}:#{@listing_change.inclusion.full_name}"
%>
</td>
</tr>
</tbody>
</table>
<table class="listing-change">
<thead>
<tr>
<th><%= f.label :geo_entity_ids, "Populations to which listing applies" %></th>
<th><%= f.label :excluded_geo_entities_ids, "Excluded populations" %></th>
<th><%= f.label :excluded_taxon_concepts_ids, "Excluded taxa" %></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<%= f.select :geo_entity_ids,
options_from_collection_for_select(
@geo_entities,
:id,
:name_en,
@listing_change.geo_entities.map(&:id)
), { },
{ :multiple => true, :class => 'distribution', :style => 'width: 220px' }
%>
</td>
<td>
<%= f.select :excluded_geo_entities_ids,
options_from_collection_for_select(
@geo_entities,
:id,
:name_en,
@listing_change.excluded_geo_entities.map(&:id)
), { },
{ :multiple => true, :class => 'distribution', :style => 'width: 220px' }
%>
</td>
<td>
<%= f.hidden_field :excluded_taxon_concepts_ids,
"data-taxon-concept-scope" => 'descendants',
"data-taxon-concept-id" => @taxon_concept.id,
"data-taxonomy-id" => @taxon_concept.taxonomy_id,
:style => 'width: 220px',
:id => 'excluded_taxon_concepts_ids',
:value => @listing_change.excluded_taxon_concepts.map{|tc| "#{tc.id}:#{tc.full_name}"}.join(',')
%>
</td>
</tr>
</tbody>
</table>
<p>
<%= f.label :is_current, "Is current?", :class => 'inline'%> <%= f.check_box :is_current %><br>
<%= link_to("View Current Listing Changes", "#new-listing_change",
{
:role => "button",
:"data-toggle" => "modal",
}) %>
</p>
<div class="control-group">
<label class="control-label">Internal notes</label>
<div class="controls">
<%= f.text_area :internal_notes, :class => 'annotation', :value => @listing_change.internal_notes %>
</div>
</div>
<h4>
Annotations
<span class="formatting-info">
<a data-placement="right" data-toggle="tooltip" href="#" rel="tooltip"
data-original-title="The available formatting options are: <b>bold text</b>, <i>italicised text</i>, <p>paragraph</p>."
>
Formatting <i class="icon-info-sign"></i>
</a>
</span>
</h4>
<table class="listing-change">
<thead>
<tr>
<th><%= f.label :event_id %></th>
<th><%= f.label :hash_annotation_id %></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<%= f.select :event_id,
options_from_collection_for_select(
@events, :id, :name,
@listing_change.event_id || @listing_change.hash_annotation && @listing_change.hash_annotation.event_id
),
{ :selected => @listing_change.event_id, :include_blank => @designation.is_cites? },
{ "data-designation" => @designation.name }
%>
</td>
<td>
<%= f.select :hash_annotation_id,
options_for_select(
@hash_annotations.map do |a|
[a.full_symbol, a.id, {:class => a.event_id}]
end,
@listing_change.hash_annotation_id
),
{ :include_blank => true }
%>
</td>
</tr>
</tbody>
</table>
<%= f.fields_for :annotation do |ff| %>
<% if @designation.is_cites? %>
<% traco_locale_columns(:short_note).each do |column| %>
<%= ff.label column %>
<%= ff.text_field column, :class => :annotation %>
<% end %>
<% end %>
<% traco_locale_columns(:full_note).each do |column| %>
<%= ff.label column %>
<%= ff.text_area column, :class => :annotation %>
<% end %>
<% if @designation.is_cites? %>
<p><%= ff.label :display_in_index,
'Display FullNote in Checklist Species index',
:class => 'inline' %>
<%= ff.check_box :display_in_index %>
</p>
<p><%= ff.label :display_in_footnote,
'Display FullNote in Checklist History of Listing footnote',
:class => 'inline' %>
<%= ff.check_box :display_in_footnote %>
</p>
<% end %>
<% end %>
<div>
<%= render :partial => 'admin/shared/nomenclature_notes_form',
locals: {
f: f,
locale_columns: traco_locale_columns(:nomenclature_note)
}
%>
</div>
<p class="pull-right">
<%= link_to 'Cancel', admin_taxon_concept_designation_listing_changes_url(@taxon_concept, @designation),
:class => "btn" %>
<%= f.submit "Save", :class => "btn btn-primary save-button" %>
</p>
<% end %>