1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-05 06:07:20 +00:00

Added views to delegate tournament permissions

This commit is contained in:
2016-01-07 19:55:15 +00:00
parent 216e60d2b8
commit dd9e19b43f
10 changed files with 157 additions and 10 deletions

View File

@@ -27,6 +27,8 @@
<td><%= link_to 'Show', tournament, :class=>"btn btn-default btn-sm" %>
<% if can? :manage, tournament %>
<%= link_to 'Edit', edit_tournament_path(tournament), :class=>"btn btn-primary btn-sm" %>
<% end %>
<% if can? :destroy, tournament %>
<%= link_to 'Destroy', tournament, method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-danger btn-sm" %>
<% end %>
</td>
@@ -34,7 +36,38 @@
<% end %>
</tbody>
</table>
<br>
<br>
<% if @schools.size > 0 %>
<h1>My Schools</h1>
<br>
<br>
<table class="table table-striped table-bordered table-condensed" id="tournamentList">
<thead>
<tr>
<th>Name</th>
<th>Tournament Name</th>
<th>Tournament Date</th>
<th></th>
</tr>
</thead>
<tbody>
<% @schools.each do |school| %>
<tr>
<td><%= school.name %></td>
<td><%= tournament.school.name %></td>
<td><%= tournament.school.date %></td>
<td><%= link_to 'Show', school, :class=>"btn btn-default btn-sm" %>
<% if can? :manage, school %>
<%= link_to 'Edit', edit_school_path(school), :class=>"btn btn-primary btn-sm" %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
<br>

View File

@@ -0,0 +1,65 @@
<%= link_to "Back to #{@tournament_name}", "/tournaments/#{@tournament_id}", :class=>"btn btn-default" %>
<br>
<br>
<% if @users %>
<h1>Search results</h1> <%= form_tag(tournament_delegate_path, :method => "get", id: "search-form") do %>
<%= text_field_tag :search, params[:search], placeholder: "Search users" %>
<%= submit_tag "Search" %>
<% end %>
<p>Search by email address</p>
</br>
</br>
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th>User Email</th>
<th></th>
</tr>
</thead>
<tbody>
<% @users.each do |user| %>
<tr>
<td><%= user.email %></td>
<td>
<%= form_for user, :url => url_for(:controller => 'tournaments', :action => 'delegate', :method => "patch") do |f| %>
<%= f.hidden_field :id, :value => user.id %>
<% if can? :manage, @tournament %>
<%= submit_tag "Give permissions", :class=>"btn btn-success"%>
<% end %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
<% if @users_delegates %>
<h1>Delegated users</h1> <%= form_tag(tournament_delegate_path, :method => "get", id: "search-form") do %>
<%= text_field_tag :search, params[:search], placeholder: "Search users" %>
<%= submit_tag "Search" %>
<% end %>
<p>Search by email address</p>
</br>
</br>
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th>User Email</th>
</tr>
</thead>
<tbody>
<% @users_delegates.each do |delegate| %>
<tr>
<td><%= delegate.user.email %></td>
</tr>
<% end %>
</tbody>
</table>
<% end %>

View File

@@ -31,6 +31,8 @@
<td><%= link_to 'Show', tournament, :class=>"btn btn-default btn-sm" %>
<% if can? :manage, tournament %>
<%= link_to 'Edit', edit_tournament_path(tournament), :class=>"btn btn-primary btn-sm" %>
<% end %>
<% if can? :destroy, tournament %>
<%= link_to 'Destroy', tournament, method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-danger btn-sm" %>
<% end %>
</td>