Skip to content

Commit

Permalink
Introduce ICN valid publication
Browse files Browse the repository at this point in the history
  • Loading branch information
lmrodriguezr committed Dec 1, 2023
1 parent ed8fe0d commit 3e13107
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 8 deletions.
5 changes: 3 additions & 2 deletions app/controllers/names_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,10 @@ def return

# POST /names/1/validate
def validate
if params[:code] == 'icnp'
if params[:code] == 'icnp' || params[:code] == 'icn'
par = {
status: 20, validated_by: current_user, validated_at: Time.now
status: params[:code] == 'icnp' ? 20 : 25,
validated_by: current_user, validated_at: Time.now
}
if @name.validated?
flash[:alert] = 'Name status is incompatible with validation'
Expand Down
14 changes: 11 additions & 3 deletions app/models/name.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,14 @@ def status_hash
This name has been validly published under the rules of the ICNP
and has priority in the scientific record
TXT
},
25 => {
symbol: :icn, name: 'Valid (ICN)',
public: true, valid: true,
help: <<~TXT
This name has been validly published under the rules of the ICN
and has priority in the scientific record
TXT
}
}
end
Expand Down Expand Up @@ -244,7 +252,7 @@ def abbr_name(name = nil, assume_valid = false)
elsif (assume_valid || validated?) || inferred_rank == 'domain'
"<i>#{name}</i>".html_safe +
if rank == 'species' && parent&.type_accession&.==(id.to_s)
" <sup>T#{'s' unless icnp?}</sup>".html_safe
" <sup>T#{'s' unless icnp? || icn?}</sup>".html_safe
else
''
end
Expand All @@ -262,7 +270,7 @@ def abbr_name_raw(name = nil, assume_valid = false)
elsif (assume_valid || validated?) || inferred_rank == 'domain'
"#{name}" +
if rank == 'species' && parent&.type_accession&.==(id.to_s)
" (T#{'s' unless icnp?})"
" (T#{'s' unless icnp? || icn?})"
else
''
end
Expand All @@ -280,7 +288,7 @@ def name_html(name = nil, assume_valid = false)
elsif (assume_valid || validated?) || inferred_rank == 'domain'
"<i>#{name}</i>".html_safe +
if rank == 'species' && parent&.type_accession&.==(id.to_s)
"<sup>T#{'s' unless icnp?}</sup>".html_safe
"<sup>T#{'s' unless icnp? || icn?}</sup>".html_safe
end
else
"&#8220;#{name}&#8221;".html_safe
Expand Down
4 changes: 3 additions & 1 deletion app/models/name/etymology.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ def full_etymology(html = false)
end

def partial_etymology(component, html = false)
pre = [etymology(component, :lang), etymology(component, :grammar)].compact.join(' ')
pre = [
etymology(component, :lang), etymology(component, :grammar)
].compact.join(' ')
pre = nil if pre.empty?
par = etymology(component, :particle)
des = etymology(component, :description)
Expand Down
4 changes: 2 additions & 2 deletions app/models/name/quality_checks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,8 @@ class QcWarning
# - Rule 22 [Checklist-N]
# TODO: An automated test could be included, but it would rely on the
# preferred taxonomy and would require estimates of priority dates
# for ICNP names. This would be very useful as the number of taxa
# grows larger.
# for ICNP and ICN names. This would be very useful as the number
# of taxa grows larger.
later_taxon_as_type: {
checklist: :nomenclature,
message: 'The nomenclatural type must be the earliest legitimate taxon',
Expand Down
11 changes: 11 additions & 0 deletions app/views/names/_curator.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@
&raquo; Indicate that this name has already been validly published under
the ICNP
<hr/>
<%= link_to(
validate_name_url(@name, code: :icn),
method: :post,
class: 'btn btn-primary btn-sm',
data: { confirm: 'Are you sure? This action cannot be undone' }
) do %>
<%= fa_icon('stamp') %> Report valid under ICN
<% end %>
&raquo; Indicate that this name has been validly published under
the ICN (Botanical Code)
<hr/>
<% if @name.after_submission? %>
<%= link_to(
return_name_url(@name),
Expand Down

0 comments on commit 3e13107

Please sign in to comment.