Skip to content

Commit 99501f2

Browse files
committed
Replace main
1 parent 07760b5 commit 99501f2

4 files changed

Lines changed: 28 additions & 216 deletions

File tree

app/controllers/application_controller.rb

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class ApplicationController < ActionController::Base
3636
}
3737

3838
# GET /
39-
def main2
39+
def main
4040
@entries = {
4141
validly_published: Name.where(status: 15).order(validated_at: :desc),
4242
names: Name.all_public.order(created_at: :desc),
@@ -55,16 +55,6 @@ def main2
5555
}
5656
end
5757

58-
def main
59-
@publications = Publication.all.order(journal_date: :desc)
60-
@authors = Author.all.order(created_at: :desc)
61-
@names = Name.where(status: Name.public_status).order(created_at: :desc)
62-
@validated = {
63-
names: Name.where(status: 15).order(validated_at: :desc),
64-
registers: Register.where(validated: true)
65-
}
66-
end
67-
6858
def search
6959
if [:what, :q].any? { |i| params[i].nil? }
7060
render :search_query

app/views/application/main.html.erb

Lines changed: 27 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -88,17 +88,18 @@
8888
<%= render(partial: 'shared/search_bar') %>
8989
</div>
9090
<p class="small mt-4">
91-
We have identified
92-
<%= link_to(pluralize(@names.count, 'name'), names_path) %>, including
93-
<%= link_to(
94-
pluralize(@validated[:names].count, 'name'),
95-
names_path(status: 'SeqCode')
96-
)
97-
%> validly published under the SeqCode in
98-
<%= link_to(
99-
pluralize(@validated[:registers].count, 'register list'),
100-
registers_path(status: 'validated')
101-
)
91+
We have identified <%=
92+
link_to(pluralize(@entries[:names].count, 'name'), names_path)
93+
%>, including <%=
94+
link_to(
95+
pluralize(@entries[:validly_published].count, 'name'),
96+
names_path(status: 'SeqCode')
97+
)
98+
%> validly published under the SeqCode in <%=
99+
link_to(
100+
pluralize(@entries[:register_lists].count, 'register list'),
101+
registers_path(status: 'validated')
102+
)
102103
%>.
103104
</p>
104105
</div>
@@ -128,48 +129,26 @@
128129
<div class="container">
129130
<div class="row">
130131
<div class="col-lg-12 text-center mt-5">
131-
<h1>Recent entries</h1>
132+
<h2>Recent entries</h1>
132133
<hr/>
133134
</div>
134-
<div class="col-lg-4 pb-5">
135-
<div class="text-center bg-light rounded-lg border p-5 h-100 recent-entries-list">
136-
<h2>Names</h2>
137-
<% @names.first(5).each do |name| %>
138-
<%= link_to(name) do %>
139-
<div><%= name.abbr_name %></div>
135+
<% @entries.each do |k, v| %>
136+
<% title = k.to_s.gsub(/_/, ' ') %>
137+
<div class="col-lg-4 mb-4">
138+
<div class="text-center bg-light rounded-lg border p-4 h-100
139+
recent-entries-list">
140+
<h3><%= title.titleize %></h3>
141+
<% v.first(5).each do |i| %>
142+
<%= link_to(i) do %>
143+
<div><%= i.send(@display[k][0]) %></div>
144+
<% end %>
140145
<% end %>
141-
<% end %>
142-
<%= link_to(names_path(sort: :date)) do %>
143-
<div>more...</div>
144-
<% end %>
145-
</div>
146-
</div>
147-
<div class="col-lg-4 pb-5">
148-
<div class="text-center bg-light rounded-lg border p-5 h-100 recent-entries-list">
149-
<h2>Publications</h2>
150-
<% @publications.first(5).each do |publication| %>
151-
<%= link_to(publication) do %>
152-
<div><%= publication.short_citation %></div>
153-
<% end %>
154-
<% end %>
155-
<%= link_to(publications_path(sort: :date)) do %>
156-
<div>more...</div>
157-
<% end %>
158-
</div>
159-
</div>
160-
<div class="col-lg-4 pb-5">
161-
<div class="text-center bg-light rounded-lg border p-5 h-100 recent-entries-list">
162-
<h2>Validly published</h2>
163-
<% @validated[:names].first(5).each do |name| %>
164-
<%= link_to(name) do %>
165-
<div><%= name.abbr_name %></div>
146+
<%= link_to(@display[k][1], class: 'btn btn-primary mt-4') do %>
147+
All <%= title %>
166148
<% end %>
167-
<% end %>
168-
<%= link_to(names_path(sort: :date, status: :SeqCode)) do %>
169-
<div>more...</div>
170-
<% end %>
149+
</div>
171150
</div>
172-
</div>
151+
<% end %>
173152
</div>
174153
</div>
175154

app/views/application/main2.html.erb

Lines changed: 0 additions & 156 deletions
This file was deleted.

config/routes.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
resources :tags
55
# General configuration
66
root(to: 'application#main')
7-
get 'main2' => 'application#main2'
87
concern(:autocompletable) do
98
get :autocomplete, on: :collection
109
end

0 commit comments

Comments
 (0)