add characters index page

This commit is contained in:
Etienne Ischer
2021-04-23 16:27:28 +02:00
parent 9d08bc8a23
commit 5d7217f355
14 changed files with 101 additions and 5 deletions

View File

@@ -0,0 +1,3 @@
// Place all the styles related to the characters 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,3 @@
// Place all the styles related to the protected 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,3 @@
class ProtectedController < ApplicationController
before_action :authenticate_user!
end

View File

@@ -0,0 +1,5 @@
class WowCharactersController < ProtectedController
def index
@characters = current_user.wow_characters.all
end
end

View File

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

View File

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

View File

@@ -0,0 +1,32 @@
<h2>Characters list</h2>
<table class="table table-hover table-dark table-image">
<thead>
<tr>
<th scope="col"></th>
<th scope="col">Name</th>
<th scope="col">Gender</th>
<th scope="col">Realm</th>
<th scope="col">Race</th>
<th scope="col">Class</th>
<th scope="col">Faction</th>
<th scope="col">Level</th>
</tr>
</thead>
<tbody>
<% @characters.each do |character| %>
<tr>
<td><% if character.wow_character_medium %>
<img class="rounded-circle border border-white" src=<%= character.wow_character_medium.avatar %> alt="avatar">
<% end %></td>
<td><%= character.name %></td>
<td><%= character.translated_gender %></td>
<td><%= character.wow_realm.name %></td>
<td><%= %></td>
<td><%= %></td>
<td><%= character.translated_faction %></td>
<td><%= character.level %></td>
</tr>
<% end %>
</tbody>
</table>