add global reputations page

This commit is contained in:
2021-05-05 20:20:06 +02:00
parent 62cdf32593
commit 3366251172
34 changed files with 170 additions and 6 deletions

View File

@@ -5,13 +5,16 @@
<% if user_signed_in? %>
<ul class="navbar-nav mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="<%= wow_characters_path %>"><%= t('layouts.navbar.characters') %></a>
<a class="nav-link <%= 'active' if current_page?(wow_characters_path) %>" aria-current="page" href="<%= wow_characters_path %>"><%= t('layouts.navbar.characters') %></a>
</li>
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="<%= wow_mounts_path %>"><%= t('layouts.navbar.mounts') %></a>
<a class="nav-link <%= 'active' if current_page?(wow_mounts_path) %>" aria-current="page" href="<%= wow_mounts_path %>"><%= t('layouts.navbar.mounts') %></a>
</li>
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="<%= wow_pets_path %>"><%= t('layouts.navbar.pets') %></a>
<a class="nav-link <%= 'active' if current_page?(wow_pets_path) %>" aria-current="page" href="<%= wow_pets_path %>"><%= t('layouts.navbar.pets') %></a>
</li>
<li class="nav-item">
<a class="nav-link <%= 'active' if current_page?(wow_reputations_path) %>" aria-current="page" href="<%= wow_reputations_path %>"><%= t('layouts.navbar.reputations') %></a>
</li>
</ul>
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">

View File

@@ -0,0 +1,5 @@
<% if standing %>
<%= link_to standing.wow_character.name, standing.wow_character %> - <%= standing.wow_reputation.wow_reputation_tier.wow_reputation_tier_levels.find_by(order: standing.tier)&.name %>
<% else %>
<%= t('wow_reputations.reputation_list.not_discovered') %>
<% end %>

View File

@@ -0,0 +1,22 @@
<h2>Reputations list</h2>
<table class="table table-hover table-dark table-image">
<thead>
<tr>
<th scope="col"><%= t('wow_reputations.reputation_list.name') %></th>
<th scope="col"><%= t('wow_reputations.reputation_list.description') %></th>
<th scope="col"><%= t('wow_reputations.reputation_list.highest_reputation_character') %></th>
</tr>
</thead>
<tbody>
<% @wow_reputations.each do |reputation| %>
<tr>
<td><%= reputation.name %></td>
<td><%= reputation.description %></td>
<td><%= render partial: 'wow_reputations/standing', locals: { standing: reputation.wow_standings.joins(:wow_character).where(wow_character: { user: current_user }).order(raw: :desc).first } %></td>
</tr>
<% end %>
</tbody>
</table>
<%== pagy_bootstrap_nav(@pagy) %>