Skip to content

Commit 081333a

Browse files
committed
Merge branch 'main' of https://github.com/seq-code/registry
2 parents 8601074 + e2e609e commit 081333a

33 files changed

Lines changed: 859 additions & 643 deletions

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ gem 'pdf-reader'
3333
gem 'pg'
3434
gem 'puma', '~> 5.6'
3535
gem 'rails', '~> 6.1'
36+
gem 'rack-attack'
3637
gem 'redcarpet', '~> 3.5'
3738
gem 'redirect_safely', '~> 1.0'
3839
gem 'rexml'
@@ -43,6 +44,7 @@ gem 'serrano', '~> 1.0'
4344
# simple_form 5.3.0 introduced a bug that prevents custom inputs from being
4445
# loaded (see https://github.com/heartcombo/simple_form/issues/1824)
4546
gem 'simple_form', '~> 5.2.0'
47+
gem 'sitemap_generator'
4648
gem 'strain-code', '~> 0.3'
4749
# Turbolinks makes navigating your web application faster.
4850
# Read more: https://github.com/turbolinks/turbolinks

Gemfile.lock

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ GEM
6161
minitest (>= 5.1)
6262
tzinfo (~> 2.0)
6363
zeitwerk (~> 2.3)
64-
addressable (2.8.9)
64+
addressable (2.9.0)
6565
public_suffix (>= 2.0.2, < 8.0)
6666
afm (1.0.0)
6767
ast (2.4.3)
@@ -116,30 +116,30 @@ GEM
116116
drb (2.2.3)
117117
erb (6.0.2)
118118
erubi (1.13.1)
119-
execjs (2.10.0)
119+
execjs (2.10.1)
120120
faraday (2.14.1)
121121
faraday-net_http (>= 2.0, < 3.5)
122122
json
123123
logger
124-
faraday-follow_redirects (0.3.0)
124+
faraday-follow_redirects (0.5.0)
125125
faraday (>= 1, < 3)
126126
faraday-net_http (3.4.2)
127127
net-http (~> 0.5)
128-
ffi (1.17.3)
129-
ffi (1.17.3-x86_64-darwin)
130-
ffi (1.17.3-x86_64-linux-gnu)
128+
ffi (1.17.4)
129+
ffi (1.17.4-x86_64-darwin)
130+
ffi (1.17.4-x86_64-linux-gnu)
131131
font_awesome5_rails (1.5.0)
132132
nokogiri (>= 1.11.3)
133133
railties (>= 4.2)
134134
globalid (1.3.0)
135135
activesupport (>= 6.1)
136-
google-protobuf (4.34.0)
136+
google-protobuf (4.34.1)
137137
bigdecimal
138138
rake (~> 13.3)
139-
google-protobuf (4.34.0-x86_64-darwin)
139+
google-protobuf (4.34.1-x86_64-darwin)
140140
bigdecimal
141141
rake (~> 13.3)
142-
google-protobuf (4.34.0-x86_64-linux-gnu)
142+
google-protobuf (4.34.1-x86_64-linux-gnu)
143143
bigdecimal
144144
rake (~> 13.3)
145145
hashery (2.1.2)
@@ -168,10 +168,7 @@ GEM
168168
rails-dom-testing (>= 1, < 3)
169169
railties (>= 4.2.0)
170170
thor (>= 0.14, < 2.0)
171-
json (2.19.2)
172-
json-schema (6.2.0)
173-
addressable (~> 2.8)
174-
bigdecimal (>= 3.1, < 5)
171+
json (2.19.3)
175172
language_server-protocol (3.17.0.5)
176173
lint_roller (1.1.0)
177174
listen (3.0.8)
@@ -188,8 +185,6 @@ GEM
188185
net-pop
189186
net-smtp
190187
marcel (1.1.0)
191-
mcp (0.9.0)
192-
json-schema (>= 4.1)
193188
method_source (1.1.0)
194189
miga-base (1.4.2.1)
195190
daemons (~> 1.3)
@@ -203,7 +198,7 @@ GEM
203198
logger
204199
mini_mime (1.1.5)
205200
mini_portile2 (2.8.9)
206-
minitest (6.0.2)
201+
minitest (6.0.3)
207202
drb (~> 2.0)
208203
prism (~> 1.5)
209204
multi_json (1.19.1)
@@ -235,8 +230,8 @@ GEM
235230
openssl (3.3.2)
236231
orm_adapter (0.5.0)
237232
ostruct (0.6.3)
238-
parallel (1.27.0)
239-
parser (3.3.10.2)
233+
parallel (1.28.0)
234+
parser (3.3.11.1)
240235
ast (~> 2.4.1)
241236
racc
242237
pdf-reader (2.15.1)
@@ -260,7 +255,9 @@ GEM
260255
puma (5.6.9)
261256
nio4r (~> 2.0)
262257
racc (1.8.1)
263-
rack (2.2.22)
258+
rack (2.2.23)
259+
rack-attack (6.8.0)
260+
rack (>= 1.0, < 4)
264261
rack-proxy (0.7.7)
265262
rack
266263
rack-test (2.2.0)
@@ -306,7 +303,7 @@ GEM
306303
redirect_safely (1.0.0)
307304
activemodel
308305
redis (4.8.1)
309-
regexp_parser (2.11.3)
306+
regexp_parser (2.12.0)
310307
reline (0.6.3)
311308
io-console (~> 0.5)
312309
responders (3.1.1)
@@ -316,11 +313,10 @@ GEM
316313
roo (2.9.0)
317314
nokogiri (~> 1)
318315
rubyzip (>= 1.3.0, < 3.0.0)
319-
rubocop (1.85.1)
316+
rubocop (1.86.0)
320317
json (~> 2.3)
321318
language_server-protocol (~> 3.17.0.2)
322319
lint_roller (~> 1.1.0)
323-
mcp (~> 0.6)
324320
parallel (~> 1.10)
325321
parser (>= 3.3.0.2)
326322
rainbow (>= 2.2.2, < 4.0)
@@ -352,12 +348,12 @@ GEM
352348
rubyzip (2.4.1)
353349
sass (3.7.4)
354350
sass-listen (~> 4.0.0)
355-
sass-embedded (1.98.0)
351+
sass-embedded (1.99.0)
356352
google-protobuf (~> 4.31)
357353
rake (>= 13)
358-
sass-embedded (1.98.0-x86_64-darwin)
354+
sass-embedded (1.99.0-x86_64-darwin)
359355
google-protobuf (~> 4.31)
360-
sass-embedded (1.98.0-x86_64-linux-gnu)
356+
sass-embedded (1.99.0-x86_64-linux-gnu)
361357
google-protobuf (~> 4.31)
362358
sass-listen (4.0.0)
363359
rb-fsevent (~> 0.9, >= 0.9.4)
@@ -377,15 +373,17 @@ GEM
377373
rubyzip (>= 1.2.2, < 4.0)
378374
websocket (~> 1.0)
379375
semantic_range (3.1.1)
380-
serrano (1.6)
381-
faraday (~> 2.13, >= 2.13.1)
382-
faraday-follow_redirects (>= 0.1, < 0.4)
383-
multi_json (~> 1.15)
384-
rexml (~> 3.2, >= 3.2.5)
385-
thor (~> 1.2, >= 1.2.1)
376+
serrano (1.7)
377+
faraday (~> 2.14, >= 2.14.1)
378+
faraday-follow_redirects (~> 0.5.0)
379+
multi_json (~> 1.19, >= 1.19.1)
380+
rexml (~> 3.4, >= 3.4.4)
381+
thor (~> 1.5)
386382
simple_form (5.2.0)
387383
actionpack (>= 5.2)
388384
activemodel (>= 5.2)
385+
sitemap_generator (6.3.0)
386+
builder (~> 3.0)
389387
spring (2.1.1)
390388
spring-watcher-listen (2.0.1)
391389
listen (>= 2.7, < 4.0)
@@ -402,7 +400,7 @@ GEM
402400
mini_portile2 (~> 2.8.0)
403401
sqlite3 (2.9.2-x86_64-darwin)
404402
sqlite3 (2.9.2-x86_64-linux-gnu)
405-
strain-code (0.4.0)
403+
strain-code (0.4.2)
406404
stringio (3.2.0)
407405
thor (1.5.0)
408406
tilt (2.7.0)
@@ -486,6 +484,7 @@ DEPENDENCIES
486484
pdf-reader
487485
pg
488486
puma (~> 5.6)
487+
rack-attack
489488
rails (~> 6.1)
490489
rdoc
491490
redcarpet (~> 3.5)
@@ -501,6 +500,7 @@ DEPENDENCIES
501500
selenium-webdriver
502501
serrano (~> 1.0)
503502
simple_form (~> 5.2.0)
503+
sitemap_generator
504504
spring
505505
spring-watcher-listen (~> 2.0.0)
506506
strain-code (~> 0.3)

app/assets/javascripts/page.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ $(document).on("turbolinks:load", function() {
1111
$.get(container.data("async"), function(data) {
1212
container.find(".modal-body").html(data);
1313
t.data("loaded", true);
14+
}).fail(function(data, err) {
15+
container.find(".modal-body").html(
16+
"Request failed with status " + data.status + " " + err
17+
);
1418
});
1519
});
1620
});

app/controllers/application_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def main
4242
names: Name.all_public.order(created_at: :desc),
4343
publications: Publication.all.order(journal_date: :desc),
4444
register_lists: Register.where(validated: true).order(updated_at: :desc),
45-
genomes: Genome.all.order(created_at: :desc),
45+
genomes: Genome.all_public.order(created_at: :desc),
4646
strains: Strain.all.order(created_at: :desc)
4747
}
4848
@display = {

app/controllers/genomes_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class GenomesController < ApplicationController
1616

1717
# GET /genomes or /genomes.json
1818
def index
19-
@genomes = Genome.all.order(created_at: :desc)
19+
@genomes = Genome.all_public.order(created_at: :desc)
2020
.paginate(page: params[:page], per_page: 30)
2121
@crumbs = ['Genomes']
2222
end

app/controllers/journals_controller.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ class JournalsController < ApplicationController
22
# GET /journals
33
# GET /journals.json
44
def index
5-
@journals = Publication.where.not(journal: ['', nil])
6-
.select(:journal).reorder(:journal).distinct
7-
.paginate(page: params[:page], per_page: 100)
5+
@journals =
6+
Publication.journals.paginate(page: params[:page], per_page: 100)
87
@crumbs = ['Journals']
98
end
109

app/controllers/names_controller.rb

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
class NamesController < ApplicationController
22
before_action(:set_tutorial)
3+
before_action(:set_name_and_notifications, only: %i[show])
34
before_action(
45
:set_name,
56
only: %i[
6-
show edit update destroy network wiki
7+
edit update destroy network wiki
78
proposed_in not_validly_proposed_in emended_in assigned_in
89
corrigendum_in corrigendum_orphan corrigendum
910
edit_description edit_rank edit_notes edit_etymology edit_links edit_type
1011
edit_redirect autofill_etymology edit_parent
1112
return validate endorse claim unclaim demote temporary_editable
1213
transfer_user transfer_user_commit
13-
new_correspondence observe unobserve
14+
new_correspondence observe unobserve quality_checks
1415
]
1516
)
1617
before_action(
@@ -256,7 +257,7 @@ def network
256257

257258
# GET /names/1/wiki
258259
def wiki
259-
@crumbs = [['Names', names_path], [@name.name_html, @name], 'Wiki source']
260+
@crumbs = [['Names', names_path], [@name.abbr_name, @name], 'Wiki source']
260261
@name.check_wikispecies if current_user # Force re-check for logged users
261262
end
262263

@@ -559,20 +560,37 @@ def unobserve
559560
end
560561
end
561562

563+
# GET /names/1/quality_checks
564+
def quality_checks
565+
@crumbs = [
566+
['Names', names_path],
567+
[@name.abbr_name, @name],
568+
'Quality Checks'
569+
]
570+
render('quality_checks', layout: !params[:content].present?)
571+
end
572+
562573
private
563574

564575
# Use callbacks to share common setup or constraints between actions
576+
def set_name_and_notifications
577+
if set_name
578+
current_user
579+
&.unseen_notifications
580+
&.where(notifiable: @name)
581+
&.update(seen: true)
582+
end
583+
end
584+
565585
def set_name
566586
@name = Name.find(params[:id])
567587

568588
if @name&.can_view?(current_user, cookies[:reviewer_token])
569589
@register = @name.try(:register)
570-
current_user
571-
&.unseen_notifications
572-
&.where(notifiable: @name)
573-
&.update(seen: true)
590+
true
574591
else
575592
render 'hidden'
593+
false
576594
end
577595
end
578596

app/controllers/page_controller.rb

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
class PageController < ApplicationController
2+
include HelpTopics
3+
24
# GET /page/about
35
def about
46
end
@@ -123,38 +125,6 @@ def status
123125
# GET /page/videos
124126
def videos
125127
end
126-
127-
private
128-
129-
def help_topics
130-
{
131-
tutorial: {
132-
new_genome: 'I have a genome belonging to a novel taxon, how can I ' \
133-
'register it?'
134-
},
135-
guide: {
136-
etymology: 'How do I fill the etymology table?',
137-
dictionary: 'How do I use dictionary lookups?',
138-
exceptions: 'When and how do I request a genome quality exception?',
139-
# SOPs
140-
curation: 'How are names internally curated?'
141-
},
142-
explanation: {
143-
open_data: 'What data is publicly released and how?',
144-
authorship: 'Can I submit names I didn\'t author?'
145-
},
146-
reference: {
147-
register: 'What are Register Lists?',
148-
paths: 'What are the paths to validation?'
149-
}
150-
}
151-
end
152-
153-
def help_topic_categories
154-
Hash[
155-
*help_topics.map { |k, v| v.keys.map { |topic| [topic, k] } }.flatten
156-
]
157-
end
158128
end
159129

160130
class SeqCodeDown < Redcarpet::Render::HTML

app/helpers/application_helper.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,15 @@ def modal(title, opts = {})
252252
end
253253
end +
254254
content_tag(:div, class: opts[:body_class]) do
255-
yield if block_given?
255+
if block_given?
256+
yield
257+
elsif opts[:async]
258+
content_tag(
259+
:div,
260+
class: 'text-center w-100 p-3',
261+
style: 'font-size: 200%;'
262+
) { fa_icon(:spinner, class: 'fa-spin') + ' Loading...' }
263+
end
256264
end +
257265
if opts[:footer]
258266
content_tag(:div, opts[:footer], class: 'modal-footer')

0 commit comments

Comments
 (0)