app/views/leagues/matches/_match_form.html.haml
- no_team_fields = false if local_assigns[:no_team_fields].nil?
.card.mb-3
.card-header Match Settings
.card-body
- unless no_team_fields
/ TODO: Properly handle errors here.
/ Currently there's a discreptency between using :home_team and :home_team_id
/ :home_team displays errors properly, :home_team_id works with the controller
= f.collection_select :home_team_id, div.rosters.active, :id, :name,
include_blank: false, label: 'Home Team'
= f.errors_on :home_team
= f.collection_select :away_team_id, div.rosters.active, :id, :name,
include_blank: 'BYE', label: 'Away Team'
= f.errors_on :away_team
.form-group
%label Options
= f.check_box :has_winner, label: 'Has a Distinct Winner', label_class: 'pl-1'
= f.check_box :allow_round_draws, label: 'Allow set draws', label_class: 'pl-1'
= f.number_field :round_number, label: 'Round Number (Used for ordering)'
= f.text_field :round_name, label: 'Round Name (Display Name)'
= f.markdown_editor :notice, id: dom_id(div), rows: 6, no_escape: true
.card.mb-3
.card-header
.row.no-gutters.flex-nowrap.align-items-center
.mr-2 Picks & Bans
.spacer
= link_to_add_association f, :pick_bans, class: 'btn btn-sm btn-success',
render_options: { locals: { league: div.league } },
'data-association-insertion-node' => "##{div.id}_pick_bans" do
= inline_svg_tag 'open_iconic/plus.svg', class: 'icon mr-2'
Add Pick / Ban
- if f.object.pending?
%ul.list-group.list-group-flush.list-dynamic-add.form-inline
= f.fields_for :pick_bans do |pick_bans_f|
= render 'pick_ban_fields', f: pick_bans_f
%div{ id: "#{div.id}_pick_bans" }
- else
.card-body Can't edit picks & bans unless scores are pending
.card.mb-3
.card-header
.row.no-gutters.flex-nowrap.align-items-center
.mr-2 Sets
.spacer
= link_to_add_association f, :rounds, class: 'btn btn-sm btn-success',
render_options: { locals: { league: div.league } },
'data-association-insertion-node' => "##{div.id}_rounds" do
= inline_svg_tag 'open_iconic/plus.svg', class: 'icon mr-2'
Add Set
- if f.object.pending?
%ul.list-group.list-group-flush.list-dynamic-add.form-inline
= f.fields_for :rounds do |rounds_f|
= render 'round_fields', f: rounds_f, league: div.league
%div{ id: "#{div.id}_rounds" }
- else
.card-body Can't edit rounds unless scores are pending