add global reputations page
This commit is contained in:
3
app/assets/stylesheets/wow_reputations.scss
Normal file
3
app/assets/stylesheets/wow_reputations.scss
Normal 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/
|
||||||
9
app/controllers/wow_reputations_controller.rb
Normal file
9
app/controllers/wow_reputations_controller.rb
Normal 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
|
||||||
2
app/helpers/wow_reputations_helper.rb
Normal file
2
app/helpers/wow_reputations_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
module WowReputationsHelper
|
||||||
|
end
|
||||||
@@ -11,5 +11,6 @@ class WowReputation < ApplicationRecord
|
|||||||
validates :name, presence: true
|
validates :name, presence: true
|
||||||
validates :reputation_id, presence: true, uniqueness: 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
|
end
|
||||||
|
|||||||
@@ -5,13 +5,16 @@
|
|||||||
<% if user_signed_in? %>
|
<% if user_signed_in? %>
|
||||||
<ul class="navbar-nav mb-2 mb-lg-0">
|
<ul class="navbar-nav mb-2 mb-lg-0">
|
||||||
<li class="nav-item">
|
<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>
|
||||||
<li class="nav-item">
|
<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>
|
||||||
<li class="nav-item">
|
<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>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
|
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
|
||||||
|
|||||||
5
app/views/wow_reputations/_standing.html.erb
Normal file
5
app/views/wow_reputations/_standing.html.erb
Normal 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 %>
|
||||||
22
app/views/wow_reputations/index.html.erb
Normal file
22
app/views/wow_reputations/index.html.erb
Normal 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) %>
|
||||||
@@ -4,3 +4,4 @@ de-de:
|
|||||||
characters: "Zeichen"
|
characters: "Zeichen"
|
||||||
mounts: "Anschlüsse"
|
mounts: "Anschlüsse"
|
||||||
pets: "Maskottchen"
|
pets: "Maskottchen"
|
||||||
|
reputations: "Reputationen"
|
||||||
|
|||||||
@@ -4,3 +4,4 @@ en-gb:
|
|||||||
characters: "Characters"
|
characters: "Characters"
|
||||||
mounts: "Mounts"
|
mounts: "Mounts"
|
||||||
pets: "Pets"
|
pets: "Pets"
|
||||||
|
reputations: "Reputations"
|
||||||
|
|||||||
@@ -4,3 +4,4 @@ en-us:
|
|||||||
characters: "Characters"
|
characters: "Characters"
|
||||||
mounts: "Mounts"
|
mounts: "Mounts"
|
||||||
pets: "Pets"
|
pets: "Pets"
|
||||||
|
reputations: "Reputations"
|
||||||
|
|||||||
@@ -4,3 +4,4 @@ es-es:
|
|||||||
characters: "Caracteres"
|
characters: "Caracteres"
|
||||||
mounts: "Montajes"
|
mounts: "Montajes"
|
||||||
pets: "Mascotas"
|
pets: "Mascotas"
|
||||||
|
reputations: "Reputaciones"
|
||||||
|
|||||||
@@ -4,3 +4,4 @@ es-mx:
|
|||||||
characters: "Caracteres"
|
characters: "Caracteres"
|
||||||
mounts: "Montajes"
|
mounts: "Montajes"
|
||||||
pets: "Mascotas"
|
pets: "Mascotas"
|
||||||
|
reputations: "Reputaciones"
|
||||||
|
|||||||
@@ -3,4 +3,5 @@ fr-fr:
|
|||||||
navbar:
|
navbar:
|
||||||
characters: "Personnages"
|
characters: "Personnages"
|
||||||
mounts: "Montures"
|
mounts: "Montures"
|
||||||
pets: "Mascotte"
|
pets: "Mascottes"
|
||||||
|
reputations: "Réputations"
|
||||||
|
|||||||
@@ -3,4 +3,5 @@ it:
|
|||||||
navbar:
|
navbar:
|
||||||
characters: "Personaggi"
|
characters: "Personaggi"
|
||||||
mounts: "Monti"
|
mounts: "Monti"
|
||||||
pets: "Mascotte"
|
pets: "Mascotti"
|
||||||
|
reputations: "Reputazioni"
|
||||||
|
|||||||
@@ -4,3 +4,4 @@ ko:
|
|||||||
characters: "캐릭터"
|
characters: "캐릭터"
|
||||||
mounts: "마운트"
|
mounts: "마운트"
|
||||||
pets: "마스코트"
|
pets: "마스코트"
|
||||||
|
reputations: "평판"
|
||||||
|
|||||||
@@ -4,3 +4,4 @@ pt-br:
|
|||||||
characters: "Personagens"
|
characters: "Personagens"
|
||||||
mounts: "Montagens"
|
mounts: "Montagens"
|
||||||
pets: "Mascote"
|
pets: "Mascote"
|
||||||
|
reputations: "Reputações"
|
||||||
|
|||||||
@@ -4,3 +4,4 @@ ru-ru:
|
|||||||
characters: "Символы"
|
characters: "Символы"
|
||||||
mounts: "Крепления"
|
mounts: "Крепления"
|
||||||
pets: "Талисман"
|
pets: "Талисман"
|
||||||
|
reputations: "Репутации"
|
||||||
|
|||||||
@@ -4,3 +4,4 @@ zh-cn:
|
|||||||
characters: "人物"
|
characters: "人物"
|
||||||
mounts: "坐骑"
|
mounts: "坐骑"
|
||||||
pets: "吉祥物"
|
pets: "吉祥物"
|
||||||
|
reputations: "名声"
|
||||||
|
|||||||
@@ -4,3 +4,4 @@ zh-tw:
|
|||||||
characters: "人物"
|
characters: "人物"
|
||||||
mounts: "坐骑"
|
mounts: "坐骑"
|
||||||
pets: "吉祥物"
|
pets: "吉祥物"
|
||||||
|
reputations: "名声"
|
||||||
|
|||||||
7
config/locales/wow_reputations/de-de.yml
Normal file
7
config/locales/wow_reputations/de-de.yml
Normal 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
|
||||||
7
config/locales/wow_reputations/en-gb.yml
Normal file
7
config/locales/wow_reputations/en-gb.yml
Normal 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"
|
||||||
7
config/locales/wow_reputations/en-us.yml
Normal file
7
config/locales/wow_reputations/en-us.yml
Normal 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"
|
||||||
7
config/locales/wow_reputations/es-es.yml
Normal file
7
config/locales/wow_reputations/es-es.yml
Normal 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"
|
||||||
7
config/locales/wow_reputations/es-mx.yml
Normal file
7
config/locales/wow_reputations/es-mx.yml
Normal 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"
|
||||||
7
config/locales/wow_reputations/fr-fr.yml
Normal file
7
config/locales/wow_reputations/fr-fr.yml
Normal 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"
|
||||||
7
config/locales/wow_reputations/it.yml
Normal file
7
config/locales/wow_reputations/it.yml
Normal 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"
|
||||||
7
config/locales/wow_reputations/ko.yml
Normal file
7
config/locales/wow_reputations/ko.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
ko:
|
||||||
|
wow_reputations:
|
||||||
|
reputation_list:
|
||||||
|
name: "이름"
|
||||||
|
description: "기술"
|
||||||
|
highest_reputation_character: "평판이 가장 높은 캐릭터"
|
||||||
|
not_discovered: "발견되지 않음"
|
||||||
7
config/locales/wow_reputations/pt-br.yml
Normal file
7
config/locales/wow_reputations/pt-br.yml
Normal 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"
|
||||||
7
config/locales/wow_reputations/ru-ru.yml
Normal file
7
config/locales/wow_reputations/ru-ru.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
ru-ru:
|
||||||
|
wow_reputations:
|
||||||
|
reputation_list:
|
||||||
|
name: "Фамилия"
|
||||||
|
description: "Описание"
|
||||||
|
highest_reputation_character: "Персонаж с самой высокой репутацией"
|
||||||
|
not_discovered: "Не обнаружено"
|
||||||
7
config/locales/wow_reputations/zh-cn.yml
Normal file
7
config/locales/wow_reputations/zh-cn.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
zh-cn:
|
||||||
|
wow_reputations:
|
||||||
|
reputation_list:
|
||||||
|
name: "姓"
|
||||||
|
description: "描述"
|
||||||
|
highest_reputation_character: "声誉最高的人物"
|
||||||
|
not_discovered: "未发现"
|
||||||
7
config/locales/wow_reputations/zh-tw.yml
Normal file
7
config/locales/wow_reputations/zh-tw.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
zh-tw:
|
||||||
|
wow_reputations:
|
||||||
|
reputation_list:
|
||||||
|
name: "姓"
|
||||||
|
description: "描述"
|
||||||
|
highest_reputation_character: "声誉最高的人物"
|
||||||
|
not_discovered: "未发现"
|
||||||
@@ -13,5 +13,6 @@ Rails.application.routes.draw do
|
|||||||
resources :wow_characters, only: [:index, :show]
|
resources :wow_characters, only: [:index, :show]
|
||||||
resources :wow_mounts, only: [:index, :show]
|
resources :wow_mounts, only: [:index, :show]
|
||||||
resources :wow_pets, only: [:index, :show]
|
resources :wow_pets, only: [:index, :show]
|
||||||
|
resources :wow_reputations, only: [:index, :show]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
15
spec/helpers/wow_reputations_helper_spec.rb
Normal file
15
spec/helpers/wow_reputations_helper_spec.rb
Normal 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
|
||||||
7
spec/requests/wow_reputations_spec.rb
Normal file
7
spec/requests/wow_reputations_spec.rb
Normal 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
|
||||||
Reference in New Issue
Block a user