mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-01 03:55:44 +00:00
Added my tournaments page
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
class StaticPagesController < ApplicationController
|
||||
|
||||
|
||||
def my_tournaments
|
||||
@tournaments = current_user.tournaments
|
||||
end
|
||||
|
||||
def not_allowed
|
||||
end
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
<li><%= link_to "About", "/static_pages/about" %></li>
|
||||
<% if user_signed_in? %>
|
||||
<li><%=link_to "Log out", destroy_user_session_url ,:method => 'delete' %></li>
|
||||
<li><%=link_to "Edit user", edit_user_registration_path %></li>
|
||||
<li><%=link_to "Edit user", edit_user_registration_path %></li>
|
||||
<li><%=link_to "My tournaments","/static_pages/my_tournaments" %></li>
|
||||
<% else %>
|
||||
<li><%= link_to "Log In" , new_user_session_path %></li>
|
||||
<% end %>
|
||||
|
||||
38
app/views/static_pages/my_tournaments.html.erb
Normal file
38
app/views/static_pages/my_tournaments.html.erb
Normal file
@@ -0,0 +1,38 @@
|
||||
<h1>My Tournaments</h1>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#tournamentList').dataTable();
|
||||
pagingType: "bootstrap";
|
||||
} );
|
||||
</script>
|
||||
<% if user_signed_in? %>
|
||||
<%= link_to 'New Tournament', new_tournament_path, :class=>"btn btn-success" %>
|
||||
<% end %>
|
||||
</br>
|
||||
</br>
|
||||
<table class="display compact cell-border" id="tournamentList">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @tournaments.each do |tournament| %>
|
||||
<tr>
|
||||
<td><%= tournament.name %></td>
|
||||
<td><%= link_to 'Show', tournament, :class=>"btn btn-default" %>
|
||||
<% if tournament_permissions(tournament) %>
|
||||
<%= link_to 'Edit', edit_tournament_path(tournament), :class=>"btn btn-primary" %>
|
||||
<%= link_to 'Destroy', tournament, method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-danger" %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user