Skip to content

Commit

Permalink
Update navigation links and add badge counts
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew committed Jan 23, 2024
1 parent d7e222b commit 03a96a8
Show file tree
Hide file tree
Showing 12 changed files with 83 additions and 40 deletions.
24 changes: 24 additions & 0 deletions app/views/audit/_nav.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
<ul class="nav nav-tabs my-3">
<li class="nav-item">
<a class="nav-link" href='/'>
Collectives
<span class="badge text-bg-secondary">
<%= number_with_delimiter Collective.all.count %>
</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href='/projects'>
Projects
<span class="badge text-bg-secondary">
<%= number_with_delimiter Project.with_repository.active.count %>
</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link active" href='/audit'>
Audit
</a>
</li>
</ul>

<ul class="nav nav-tabs my-3">
<li class="nav-item">
<a class="nav-link <%= 'active' if params[:action] == 'user_owners' %>" href='/audit/user_owners'>User owners</a>
Expand Down
2 changes: 0 additions & 2 deletions app/views/audit/archived.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<div class="container-md">
<h2>Audit</h2>

<%= render 'nav' %>

<% @collectives.each do |collective| %>
Expand Down
2 changes: 0 additions & 2 deletions app/views/audit/duplicates.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<div class="container-md">
<h2>Audit</h2>

<%= render 'nav' %>

<% @collectives.each do |collective| %>
Expand Down
2 changes: 0 additions & 2 deletions app/views/audit/inactive.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<div class="container-md">
<h2>Audit</h2>

<%= render 'nav' %>

<% @collectives.each do |collective| %>
Expand Down
2 changes: 0 additions & 2 deletions app/views/audit/missing_s.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<div class="container-md">
<h2>Audit</h2>

<%= render 'nav' %>

<% @collectives.each do |collective| %>
Expand Down
2 changes: 0 additions & 2 deletions app/views/audit/no_funding.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<div class="container-md">
<h2>Audit</h2>

<%= render 'nav' %>

<% @collectives.each do |collective| %>
Expand Down
2 changes: 0 additions & 2 deletions app/views/audit/no_license.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<div class="container-md">
<h2>Audit</h2>

<%= render 'nav' %>

<% @collectives.each do |collective| %>
Expand Down
2 changes: 0 additions & 2 deletions app/views/audit/no_projects.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<div class="container-md">
<h2>Audit</h2>

<%= render 'nav' %>

<% @collectives.each do |collective| %>
Expand Down
2 changes: 0 additions & 2 deletions app/views/audit/user_owners.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<div class="container-md">
<h2>Audit</h2>

<%= render 'nav' %>

<% @collectives.each do |collective| %>
Expand Down
31 changes: 24 additions & 7 deletions app/views/collectives/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
<div class="container-md">
<h2>
<%= number_with_delimiter @pagy.count %>
<% if params[:topic] %>
"<%= params[:topic] %>"
<% end %>
Collective<%= 's' if @pagy.count > 1 %>
</h2>

<ul class="nav nav-tabs my-3">
<li class="nav-item">
<a class="nav-link active" href='/'>
Collectives
<span class="badge text-bg-secondary">
<%= number_with_delimiter @pagy.count %>
</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href='/projects'>
Projects
<span class="badge text-bg-secondary">
<%= number_with_delimiter Project.with_repository.active.count %>
</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href='/audit'>
Audit
</a>
</li>
</ul>

<%= form_with url: request.path, method: :get do |form| %>
<%= form.label :range, 'Select range:' %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/projects/_project.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


<p class="card-subtitle mb-2 text-muted"><i><small>
Stars: <%= project.stars %>
Stars: <%= number_with_delimiter project.stars %>
<% if project.last_synced_at %>
- Last synced: <%= project.last_synced_at.strftime("%d %b %Y") %>
<% end %>
Expand Down
50 changes: 34 additions & 16 deletions app/views/projects/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,21 +1,39 @@
<div class="container-md">

<ul class="nav nav-tabs my-3">
<li class="nav-item">
<h2>Accepted Projects</h2>
</li>
<li class="nav-item ms-auto">
<div class="dropdown">
<button class="btn btn-light dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
Sort
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item <%= 'active' if params[:sort] == 'last_synced_at' %>" href="<%= url_for(sort: 'last_synced_at', order: 'desc') %>">Recently synced</a></li>
<li><a class="dropdown-item <%= 'active' if params[:sort] == 'score' %>" href="<%= url_for(sort: 'score', order: 'desc') %>">Ranking</a></li>
</ul>
</div>
</li>
</ul>
<ul class="nav nav-tabs my-3">
<li class="nav-item">
<a class="nav-link" href='/'>
Collectives
<span class="badge text-bg-secondary">
<%= number_with_delimiter Collective.all.count %>
</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link active" href='/projects'>
Projects
<span class="badge text-bg-secondary">
<%= number_with_delimiter @pagy.count %>
</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href='/audit'>
Audit
</a>
</li>
<li class="nav-item ms-auto">
<div class="dropdown">
<button class="btn btn-light dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
Sort
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item <%= 'active' if params[:sort] == 'last_synced_at' %>" href="<%= url_for(sort: 'last_synced_at', order: 'desc') %>">Recently synced</a></li>
<li><a class="dropdown-item <%= 'active' if params[:stars] == 'stars' %>" href="<%= url_for(sort: 'stars', order: 'desc') %>">Stars</a></li>
</ul>
</div>
</li>
</ul>

<%= render @projects %>
<%== pagy_bootstrap_nav(@pagy) if @pagy.pages > 1 %>
Expand Down

0 comments on commit 03a96a8

Please sign in to comment.