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

@@ -0,0 +1,3 @@
// Place all the styles related to the WowReputation controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: https://sass-lang.com/

View File

@@ -0,0 +1,9 @@
class WowReputationsController < ProtectedController
def index
@pagy, @wow_reputations = pagy(WowReputation.non_meta_reputations, items: 20)
end
def show
@wow_reputation = WowReputation.find(params[:id])
end
end

View File

@@ -0,0 +1,2 @@
module WowReputationsHelper
end

View File

@@ -11,5 +11,6 @@ class WowReputation < ApplicationRecord
validates :name, presence: true
validates :reputation_id, presence: true, uniqueness: true
scope :meta_reputations, -> { where(meta_wow_reputation: nil) }
scope :meta_reputations, -> { where(description: nil) }
scope :non_meta_reputations, -> { where.not(description: nil) }
end

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) %>

View File

@@ -4,3 +4,4 @@ de-de:
characters: "Zeichen"
mounts: "Anschlüsse"
pets: "Maskottchen"
reputations: "Reputationen"

View File

@@ -4,3 +4,4 @@ en-gb:
characters: "Characters"
mounts: "Mounts"
pets: "Pets"
reputations: "Reputations"

View File

@@ -4,3 +4,4 @@ en-us:
characters: "Characters"
mounts: "Mounts"
pets: "Pets"
reputations: "Reputations"

View File

@@ -4,3 +4,4 @@ es-es:
characters: "Caracteres"
mounts: "Montajes"
pets: "Mascotas"
reputations: "Reputaciones"

View File

@@ -4,3 +4,4 @@ es-mx:
characters: "Caracteres"
mounts: "Montajes"
pets: "Mascotas"
reputations: "Reputaciones"

View File

@@ -3,4 +3,5 @@ fr-fr:
navbar:
characters: "Personnages"
mounts: "Montures"
pets: "Mascotte"
pets: "Mascottes"
reputations: "Réputations"

View File

@@ -3,4 +3,5 @@ it:
navbar:
characters: "Personaggi"
mounts: "Monti"
pets: "Mascotte"
pets: "Mascotti"
reputations: "Reputazioni"

View File

@@ -4,3 +4,4 @@ ko:
characters: "캐릭터"
mounts: "마운트"
pets: "마스코트"
reputations: "평판"

View File

@@ -4,3 +4,4 @@ pt-br:
characters: "Personagens"
mounts: "Montagens"
pets: "Mascote"
reputations: "Reputações"

View File

@@ -4,3 +4,4 @@ ru-ru:
characters: "Символы"
mounts: "Крепления"
pets: "Талисман"
reputations: "Репутации"

View File

@@ -4,3 +4,4 @@ zh-cn:
characters: "人物"
mounts: "坐骑"
pets: "吉祥物"
reputations: "名声"

View File

@@ -4,3 +4,4 @@ zh-tw:
characters: "人物"
mounts: "坐骑"
pets: "吉祥物"
reputations: "名声"

View File

@@ -0,0 +1,7 @@
de-de:
wow_reputations:
reputation_list:
name: "Name"
description: "Beschreibung"
highest_reputation_character: "Charakter mit dem höchsten Ruf"
not_discovered: "Nicht entdeckt

View File

@@ -0,0 +1,7 @@
en-gb:
wow_reputations:
reputation_list:
name: "Name"
description: "Description"
highest_reputation_character: "Character with the highest reputation"
not_discovered: "Not discovered"

View File

@@ -0,0 +1,7 @@
en-us:
wow_reputations:
reputation_list:
name: "Name"
description: "Description"
highest_reputation_character: "Character with the highest reputation"
not_discovered: "Not discovered"

View File

@@ -0,0 +1,7 @@
es-es:
wow_reputations:
reputation_list:
name: "Nombre"
description: "Descripción"
highest_reputation_character: "Personaje con la más alta reputación"
not_discovered: "No descubierto"

View File

@@ -0,0 +1,7 @@
es-mx:
wow_reputations:
reputation_list:
name: "Nombre"
description: "Descripción"
highest_reputation_character: "Personaje con la más alta reputación"
not_discovered: "No descubierto"

View File

@@ -0,0 +1,7 @@
en-gb:
wow_reputations:
reputation_list:
name: "Nom"
description: "Description"
highest_reputation_character: "Personnage avec la plus haute réputation"
not_discovered: "Pas découverte"

View File

@@ -0,0 +1,7 @@
it:
wow_reputations:
reputation_list:
name: "Nome"
description: "Descrizione"
highest_reputation_character: "Personaggio con la più alta reputazione"
not_discovered: "Non scoperto"

View File

@@ -0,0 +1,7 @@
ko:
wow_reputations:
reputation_list:
name: "이름"
description: "기술"
highest_reputation_character: "평판이 가장 높은 캐릭터"
not_discovered: "발견되지 않음"

View File

@@ -0,0 +1,7 @@
pt-br:
wow_reputations:
reputation_list:
name: "Sobrenome"
description: "Descrição"
highest_reputation_character: "Personagem com a maior reputação"
not_discovered: "Não descoberto"

View File

@@ -0,0 +1,7 @@
ru-ru:
wow_reputations:
reputation_list:
name: "Фамилия"
description: "Описание"
highest_reputation_character: "Персонаж с самой высокой репутацией"
not_discovered: "Не обнаружено"

View File

@@ -0,0 +1,7 @@
zh-cn:
wow_reputations:
reputation_list:
name: "姓"
description: "描述"
highest_reputation_character: "声誉最高的人物"
not_discovered: "未发现"

View File

@@ -0,0 +1,7 @@
zh-tw:
wow_reputations:
reputation_list:
name: "姓"
description: "描述"
highest_reputation_character: "声誉最高的人物"
not_discovered: "未发现"

View File

@@ -13,5 +13,6 @@ Rails.application.routes.draw do
resources :wow_characters, only: [:index, :show]
resources :wow_mounts, only: [:index, :show]
resources :wow_pets, only: [:index, :show]
resources :wow_reputations, only: [:index, :show]
end
end

View File

@@ -0,0 +1,15 @@
require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the WowReputationHelper. For example:
#
# describe WowReputationHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
RSpec.describe WowReputationsHelper, type: :helper do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

@@ -0,0 +1,7 @@
require 'rails_helper'
RSpec.describe "WowReputations", type: :request do
describe "GET /index" do
pending "add some examples (or delete) #{__FILE__}"
end
end