mirror of
https://github.com/ENSL/ensl.org.git
synced 2025-01-13 21:31:28 +00:00
Adding link to scheduled matches on contest page and bug fixing
This commit is contained in:
parent
52e0d9ad71
commit
a065db9159
3 changed files with 18 additions and 7 deletions
|
@ -5,10 +5,13 @@ class MatchProposalsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
mp = MatchProposal.confirmed_for_match(@match).first
|
# Don't allow creation of new proposals if there is a confirmed one already
|
||||||
if mp
|
if MatchProposal.exists?(
|
||||||
flash[:danger] = 'Cannot create a new proposal aslong as there already is a confirmed one'
|
match_id: @match.id,
|
||||||
redirect_to(match_proposals_path(@match)) && return
|
status: MatchProposal::STATUS_CONFIRMED
|
||||||
|
)
|
||||||
|
flash[:error] = 'Cannot create a new proposal if there is already a confirmed one'
|
||||||
|
redirect_to(match_proposals_path(@match)) && return
|
||||||
end
|
end
|
||||||
@proposal = MatchProposal.new
|
@proposal = MatchProposal.new
|
||||||
@proposal.match = @match
|
@proposal.match = @match
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
<dd>Sunday: <%= Time.use_zone(timezone_offset) { @contest.default_time.strftime("%H:%M %Z") } %></dd>
|
<dd>Sunday: <%= Time.use_zone(timezone_offset) { @contest.default_time.strftime("%H:%M %Z") } %></dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
|
<%= link_to 'Scheduled Matches', confirmed_matches_path(@contest), class: 'button' %>
|
||||||
|
|
||||||
<% if cuser and cuser.admin? %>
|
<% if cuser and cuser.admin? %>
|
||||||
<%= link_to 'Edit Contest', edit_contest_path(@contest), class: 'button' %>
|
<%= link_to 'Edit Contest', edit_contest_path(@contest), class: 'button' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -23,9 +23,15 @@
|
||||||
<% unless proposal.state_immutable? %>
|
<% unless proposal.state_immutable? %>
|
||||||
<%= form_for proposal, url: match_proposal_path(@match, proposal) do |f| %>
|
<%= form_for proposal, url: match_proposal_path(@match, proposal) do |f| %>
|
||||||
<%= f.hidden_field :status, value: 0 %>
|
<%= f.hidden_field :status, value: 0 %>
|
||||||
<%= link_to_function icon('check'), "proposalStateSubmit(#{MatchProposal::STATUS_CONFIRMED},#{proposal.id})", title: 'Confirm' %>
|
<% if proposal.status_change_allowed?(cuser, MatchProposal::STATUS_CONFIRMED) %>
|
||||||
<%= link_to_function icon('times'), "proposalStateSubmit(#{MatchProposal::STATUS_REJECTED},#{proposal.id})", title: 'Reject' %>
|
<%= link_to_function icon('check'), "proposalStateSubmit(#{MatchProposal::STATUS_CONFIRMED},#{proposal.id})", title: 'Confirm' %>
|
||||||
<%= link_to_function icon('undo'), "proposalStateSubmit(#{MatchProposal::STATUS_REVOKED},#{proposal.id})", title: 'Revoke' %>
|
<% end %>
|
||||||
|
<% if proposal.status_change_allowed?(cuser, MatchProposal::STATUS_REJECTED) %>
|
||||||
|
<%= link_to_function icon('times'), "proposalStateSubmit(#{MatchProposal::STATUS_REJECTED},#{proposal.id})", title: 'Reject' %>
|
||||||
|
<% end %>
|
||||||
|
<% if proposal.status_change_allowed?(cuser, MatchProposal::STATUS_REVOKED) %>
|
||||||
|
<%= link_to_function icon('undo'), "proposalStateSubmit(#{MatchProposal::STATUS_REVOKED},#{proposal.id})", title: 'Revoke' %>
|
||||||
|
<% end %>
|
||||||
<% if proposal.status_change_allowed?(cuser, MatchProposal::STATUS_DELAYED) %>
|
<% if proposal.status_change_allowed?(cuser, MatchProposal::STATUS_DELAYED) %>
|
||||||
<%= link_to_function icon('hourglass'), "proposalStateSubmit(#{MatchProposal::STATUS_DELAYED},#{proposal.id})", title: 'Delay' %>
|
<%= link_to_function icon('hourglass'), "proposalStateSubmit(#{MatchProposal::STATUS_DELAYED},#{proposal.id})", title: 'Delay' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Loading…
Reference in a new issue