add characters index page
This commit is contained in:
3
app/assets/stylesheets/characters.scss
Normal file
3
app/assets/stylesheets/characters.scss
Normal 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/
|
||||
3
app/assets/stylesheets/protected.scss
Normal file
3
app/assets/stylesheets/protected.scss
Normal 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/
|
||||
3
app/controllers/protected_controller.rb
Normal file
3
app/controllers/protected_controller.rb
Normal file
@@ -0,0 +1,3 @@
|
||||
class ProtectedController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
end
|
||||
5
app/controllers/wow_characters_controller.rb
Normal file
5
app/controllers/wow_characters_controller.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class WowCharactersController < ProtectedController
|
||||
def index
|
||||
@characters = current_user.wow_characters.all
|
||||
end
|
||||
end
|
||||
2
app/helpers/characters_helper.rb
Normal file
2
app/helpers/characters_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module CharactersHelper
|
||||
end
|
||||
2
app/helpers/protected_helper.rb
Normal file
2
app/helpers/protected_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module ProtectedHelper
|
||||
end
|
||||
32
app/views/wow_characters/index.html.erb
Normal file
32
app/views/wow_characters/index.html.erb
Normal 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>
|
||||
Reference in New Issue
Block a user