Instead of forcing coaches to log into the app, you can generate links for their school that you can email them to submit their lineups. Be sure to delete these after the deadline for lineup submissions.
<%= button_to "Generate School Permission Key Links", generate_school_keys_tournament_path(@tournament), method: :post, class: "btn btn-success" %> <%= button_to "Delete School Permission Key Links", delete_school_keys_tournament_path(@tournament), method: :post, class: "btn btn-danger" %>| School Name | Permission Link |
|---|---|
| <%= school.name %> | <% full_url = "#{request.base_url}/schools/#{school.id}?school_permission_key=#{school.permission_key}" %> <%= full_url %> |
If you'd like coaches to have to log into the app, you can have them create an account first then search for that account here and assign their account to a school for lineup submission. Be sure to delete these after the deadline for lineup submissions.
Search by email address to delegate a school to a user
<% if @user %>| User Email | School to delegate | |
|---|---|---|
| <%= @user.email %> | <%= form_for SchoolDelegate.new, :url => url_for(:controller => 'tournaments', :action => 'school_delegate', :method => "post") do |f| %><%= f.collection_select :school_id, @tournament.schools, :id, :name %> | <%= f.hidden_field :user_id, :value => @user.id %> <% if can? :manage, @tournament %> <%= submit_tag "Give permissions", :class=>"btn btn-success"%> <% end %> <% end %> |
| User Email | School | |
|---|---|---|
| <%= delegate.user.email %> | <%= delegate.school.name %> | <%= link_to 'Remove permissions', "/tournaments/#{@tournament.id}/#{delegate.id}/remove_school_delegate", data: { turbo_method: :delete, turbo_confirm: 'Are you sure?' }, :class=>"btn btn-danger btn-sm" %> |