Skip to content

Commit 222dd31

Browse files
committed
Prenotification stub
1 parent 82cac4c commit 222dd31

5 files changed

Lines changed: 81 additions & 4 deletions

File tree

app/controllers/registers_controller.rb

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ class RegistersController < ApplicationController
33
:set_register,
44
only: %i[
55
show table list certificate_image cite edit update destroy tree
6-
submit return return_commit endorse notify notify_commit
7-
validate editorial_checks publish publish_commit new_correspondence
6+
submit return return_commit endorse prenotify prenotify_commit
7+
notify notify_commit validate
8+
editorial_checks publish publish_commit new_correspondence
89
internal_notes nomenclature_review genomics_review snooze_curation
910
observe unobserve merge merge_commit sample_map
1011
reviewer_token reviewer_token_create reviewer_token_delete
@@ -36,11 +37,12 @@ class RegistersController < ApplicationController
3637
before_action(
3738
:authenticate_can_edit!,
3839
only: %i[
39-
edit update destroy submit notify notify_commit merge merge_commit
40-
reviewer_token_create reviewer_token_delete
40+
edit update destroy submit prenotify prenotify_commit notify notify_commit
41+
merge merge_commit reviewer_token_create reviewer_token_delete
4142
]
4243
)
4344
before_action(:authenticate_user!, only: %i[observe unobserve])
45+
before_action(:check_pending_genomes!, only: %i[notify notify_commit])
4446

4547
# GET /registers or /registers.json
4648
def index(status = :validated)
@@ -200,6 +202,16 @@ def endorse
200202
)
201203
end
202204

205+
# GET /registers/r:abc/prenotify
206+
def prenotify
207+
@genomes = @register.names.map(&:type_genome).compact.select(&:pending?)
208+
redirect_to(notify_register_path(@register)) if @genomes.empty?
209+
end
210+
211+
# POST /registers/r:abc/prenotify
212+
def prenotify_commit
213+
end
214+
203215
# GET /registers/r:abc/notify
204216
def notify
205217
@register.title ||= @register.propose_title
@@ -527,6 +539,12 @@ def ensure_valid!
527539
@register&.validated?
528540
end
529541

542+
def check_pending_genomes!
543+
if @register.pending_genomes?
544+
redirect_to(prenotify_register_path(@register))
545+
end
546+
end
547+
530548
def add_automatic_correspondence(message)
531549
RegisterCorrespondence.new(
532550
message: message, notify: '0', automatic: true,

app/models/register.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,10 @@ def wikispecies_issues?
416416
names.any? { |n| n.wikispecies_issues.any? }
417417
end
418418

419+
def pending_genomes?
420+
names.any? { |n| n.type_genome.try(:pending?) }
421+
end
422+
419423
private
420424

421425
def assign_accession

app/views/registers/notify.html.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
html: { multipart: true }
3030
) do |f| %>
3131
<br/>
32+
3233
<h2>Register List</h2>
3334
<%= render(partial: 'edit_title_abstract', locals: { f: f }) %>
3435

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<h1>
2+
Notification of Effective Publication
3+
</h1>
4+
<hr/>
5+
6+
<p class="lead">
7+
Before reporting the effective publication associated to this register list,
8+
you must report the accession numbers of all pending genomes serving as
9+
nomenclatural types in the list.
10+
</p>
11+
12+
<%= simple_form_for(
13+
@register, url: prenotify_register_url(@register), method: :post
14+
) do |f| %>
15+
<br/>
16+
17+
<h2>Pending genomes</h2>
18+
<table class="table table-hover table-responsive">
19+
<thead>
20+
<tr>
21+
<th scope=col>Name</th>
22+
<th scope=col>Temporary designation</th>
23+
<th scope=col>Database</th>
24+
<th scope=col>Accession</th>
25+
</tr>
26+
</thead>
27+
<tbody>
28+
<% @genomes.each do |genome| %>
29+
<tr>
30+
<td><%= display_link(genome.name) %></td>
31+
<td><%= genome.accession %></td>
32+
<td></td>
33+
<td></td>
34+
</tr>
35+
<% end %>
36+
</tbody>
37+
</table>
38+
<%=
39+
f.input(
40+
:publication_pdf, label: 'Publication PDF', required: true,
41+
hint: 'Published manuscript in PDF: the preferred PDF is the final ' \
42+
'typeset version, but the author accepted manuscript version ' \
43+
'is also acceptable'
44+
)
45+
%>
46+
47+
<br/>
48+
<%= f.button(:submit, 'Submit list for validation') %>
49+
<%= link_to('Cancel', @register, class: 'btn btn-secondary') %>
50+
<br/><br/>
51+
<% end %>
52+

config/routes.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@
157157
post :endorse
158158
get :notify
159159
post :notify, action: :notify_commit
160+
get :prenotify
161+
post :prenotify, action: :prenotify_commit
160162
post :validate
161163
get :editorial_checks
162164
get :publish

0 commit comments

Comments
 (0)