Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save addicted2sounds/1f0498c30809582292e8e7d9c5bf923f to your computer and use it in GitHub Desktop.
Save addicted2sounds/1f0498c30809582292e8e7d9c5bf923f to your computer and use it in GitHub Desktop.
<% @event_users.each do |event_user| %>
<ul class="collection with-header">
<li class="collection-header">
<div class="chip right">Downloads Remaining: <span id="downloads-remaining-<%= event_user.id %>"><%= event_user.downloads_remaining %></span></div>
<h5><%= event_user.event.title %></h5>
</li>
<% if event_user.event.games_published? %>
<% if event_user.team_id.present? %>
<% event_user.event.games.for_team(event_user.team_id).each do |game| %>
<li class="collection-item clearfix">
<div class="row">
<div class="col s12 m3">
<a class="fancybox-media" href="javascript:;" data-video-url="<%= game.video %>">
<%= image_tag vimeo_api(game.video, "thumbnail_url_with_play_button"), class: 'responsive-img' %>
</a>
</div>
<div class="col s12 m9">
<span class="title"><%= game.field_name %>, <%= game.time_start.strftime("%l:%M %p") %> - <%= game.time_end.strftime("%l:%M %p") %></span><br>
<span class="title"><%= game.teams.first.title %> vs. <%= game.teams.second.title %></span>
<p>
<%= check_box_tag "game-checkbox-#{game.id}", nil, nil, class: "game-checkbox checkbox-#{event_user.id}", data: { event_user_id: event_user.id, game_id: game.id, game_text: "#{game.field_name}, #{game.time_start.strftime('%l:%M %p')} - #{game.time_end.strftime('%l:%M %p')}" } %>
<%= label_tag nil, 'Add to My Downloads', for: "game-checkbox-#{game.id}" %>
</p>
</div>
</div>
</li>
<% end %>
<%= link_to "Submit Selected Games", "#", class: 'btn games-submit', data: { event_user_id: event_user.id } %>
<%= form_for event_user, method: :post, url: add_game_dashboard_download_path(event_user), data: { event_user_id: event_user.id } do |f| %>
<div id="games-confirmation-<%= event_user.id %>" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>Are you sure you want to add the following games to your downloads?</h4>
<div id="games-confirmation-modal-content-<%= event_user.id %>"></div>
</div>
<div class="modal-footer">
<%= link_to 'Yes', '#', class: 'games-confirmed modal-action modal-close waves-effect waves-green btn-flat' %>
</div>
</div>
<%= hidden_field_tag :games, nil, class: "all-games-#{event_user.id}" %>
<% end %>
<% else %>
<li class="collection-item">
<p>Games are published! You must submit your team to continue.</p>
<%= form_for event_user, method: :post, url: submit_team_dashboard_download_path(event_user), data: { event_user_id: event_user.id } do |f| %>
<div id="team-confirmation-<%= event_user.id %>" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>Confirm your team</h4>
<p id="team-confirmation-modal-content-<%= event_user.id %>"></p>
</div>
<div class="modal-footer">
<%= link_to 'Yes', '#', class: 'team-confirmed modal-action modal-close waves-effect waves-green btn-flat' %>
</div>
</div>
<div class="input-field", id="teams-dropdown-<%= event_user.id %>">
<%= f.label :team %>
<%= f.collection_select :team_id, event_user.event.teams.uniq, :id, :title %>
</div>
<%= link_to "Submit Team", "#", class: 'btn team-submit' %>
<% end %>
</li>
<% end %>
<% else %>
<li class="collection-item"><p>Games are still being compressed and uploaded. You will be notified via email once your film is ready.</p></li>
<% end %>
</ul>
<% end %>
<% content_for :js_init do %>
EventComponent.fancybox_media_init();
MaterializeComponent.select_tag_init();
MaterializeComponent.team_submit_modal();
MaterializeComponent.add_to_downloads();
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment