app/views/leagues/show.html.haml
- content_for(:title) { @league.name }
- matches = @personal_matches || @top_div_matches
/ Header
.row.no-gutters.align-items-start
.col-auto.mr-2
%h1
= @league.name
.col-auto
%h4
- if @league.hidden?
%span.badge.badge-warning Private
- elsif @league.completed?
%span.badge.badge-success Completed
/ Admin actions
- if user_can_edit_league?
.btn-toolbar.guttered.mb-2
= link_to league_matches_path(@league), class: 'btn btn-admin' do
= inline_svg_tag 'open_iconic/list.svg', class: 'icon mr-2'
Matches
= link_to league_transfers_path(@league), class: 'btn btn-admin' do
= inline_svg_tag 'open_iconic/transfer.svg', class: 'icon mr-2'
Transfers
= link_to league_rosters_path(@league), class: 'btn btn-admin' do
= inline_svg_tag 'open_iconic/people.svg', class: 'icon mr-2'
Signups
.spacer.d-none.d-md-block
= link_to edit_league_path(@league), class: 'btn btn-admin', type: 'button' do
= inline_svg_tag 'open_iconic/cog.svg', class: 'icon mr-2'
Manage
.markdown.mb-3= present(@league).description
/ Upcoming matches
- if @league.running?
.card.alert-info.mb-3
.card-header
.row.no-gutters.flex-nowrap.align-items-center
.mr-2
- if @personal_matches
Your Upcoming Matches
- else
Upcoming Matches for #{@divisions.first.name}
.spacer
= link_to league_matches_path(@league), class: 'btn btn-sm btn-info' do
All Matches
= inline_svg_tag 'open_iconic/chevron-right.svg', class: 'icon ml-2'
- if matches.empty?
%li.list-group-item
- if @personal_matches
No upcoming matches for your team #{present(@roster).link}
- else
No upcoming matches for #{@divisions.first.name}
- else
= render 'leagues/matches/matches_table', matches: matches, roster: nil
- else
= link_to league_matches_path(@league), class: 'btn btn-info mb-3' do
All Matches
/ Signup
- if user_signed_in?
- if current_user.can?(:edit, :team) && @league.signuppable?
= link_to new_league_roster_path(@league), class: 'btn btn-sm btn-success' do
= inline_svg_tag 'open_iconic/plus.svg', class: 'icon mr-2'
Sign up
- elsif @roster
= link_to team_path(@roster.team_id), class: 'btn btn-sm btn-secondary' do
View my team
= inline_svg_tag 'open_iconic/chevron-right.svg', class: 'icon ml-2'
/ League table or signups
- if @league.signuppable? || @league.hide_rosters?
%ul.list-group.list-group-flush
- if present_collection(@rosters).empty?
%li.list-group-item.text-muted
No teams registered
- else
- present_collection(@rosters).each do |roster|
%li.list-group-item
= roster.link
- else
/ Specifically include brackets here, we don't need them on every page
- content_for :head do
= javascript_include_tag 'brackets'
= stylesheet_link_tag 'brackets', media: 'all'
- tiebreakers = present_collection(@league.tiebreakers)
- @ordered_rosters.each.with_index do |(div, rosters), i|
%h3.px-3.py-2.mb-0= div.name
%table.table.mb-3.border-bottom
%tr
%th #
%th Team
%th Points
- tiebreakers.each do |tiebreaker|
%th= tiebreaker.name_with_tooltip
- rosters.each_with_index do |roster, rank|
- roster_p = present(roster)
%tr
%th{ scope: 'row' }= rank + 1
%td= roster_p.listing
%td= roster_p.points_s
- tiebreakers.each do |tiebreaker|
%th= tiebreaker.value_for(roster)
/ Render brackets
- matches = @matches[div]
- if matches.present?
= render 'leagues/divisions/bracket', division: div, rosters: rosters, matches: matches
- if i != @ordered_rosters.size - 1
%hr.mb-5