1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-04 22:03:49 +00:00

Views for school and tournament delegates

This commit is contained in:
2016-01-07 20:18:36 +00:00
parent dd9e19b43f
commit bd5768b037
4 changed files with 103 additions and 11 deletions

View File

@@ -24,8 +24,8 @@
<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 %>
<%= form_for TournamentDelegate.new, :url => url_for(:controller => 'tournaments', :action => 'delegate', :method => "post") do |f| %>
<%= f.hidden_field :user_id, :value => user.id %>
<% if can? :manage, @tournament %>
<%= submit_tag "Give permissions", :class=>"btn btn-success"%>
<% end %>

View File

@@ -0,0 +1,70 @@
<%= link_to "Back to #{@tournament_name}", "/tournaments/#{@tournament_id}", :class=>"btn btn-default" %>
<br>
<br>
<% if @users %>
<h1>Search results</h1> <%= form_tag(school_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>School to delegate</th>
<th></th>
</tr>
</thead>
<tbody>
<% @users.each do |user| %>
<tr>
<td><%= user.email %></td>
<%= form_for SchoolDelegate.new, :url => url_for(:controller => 'tournaments', :action => 'school_delegate', :method => "post") do |f| %>
<td><%= f.collection_select :school_id, @tournament.schools, :id, :name %></td>
<td>
<%= f.hidden_field :user_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 schools</h1> <%= form_tag(school_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>School</th>
</tr>
</thead>
<tbody>
<% @users_delegates.each do |delegate| %>
<tr>
<td><%= delegate.user.email %></td>
<td><%= delegate.school.name %></td>
</tr>
<% end %>
</tbody>
</table>
<% end %>