mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-26 04:21:36 +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,9 +5,12 @@ class MatchProposalsController < ApplicationController
|
|||
end
|
||||
|
||||
def new
|
||||
mp = MatchProposal.confirmed_for_match(@match).first
|
||||
if mp
|
||||
flash[:danger] = 'Cannot create a new proposal aslong as there already is a confirmed one'
|
||||
# Don't allow creation of new proposals if there is a confirmed one already
|
||||
if MatchProposal.exists?(
|
||||
match_id: @match.id,
|
||||
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
|
||||
@proposal = MatchProposal.new
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
<dd>Sunday: <%= Time.use_zone(timezone_offset) { @contest.default_time.strftime("%H:%M %Z") } %></dd>
|
||||
</dl>
|
||||
|
||||
<%= link_to 'Scheduled Matches', confirmed_matches_path(@contest), class: 'button' %>
|
||||
|
||||
<% if cuser and cuser.admin? %>
|
||||
<%= link_to 'Edit Contest', edit_contest_path(@contest), class: 'button' %>
|
||||
<% end %>
|
||||
|
|
|
@ -23,9 +23,15 @@
|
|||
<% unless proposal.state_immutable? %>
|
||||
<%= form_for proposal, url: match_proposal_path(@match, proposal) do |f| %>
|
||||
<%= f.hidden_field :status, value: 0 %>
|
||||
<% if proposal.status_change_allowed?(cuser, MatchProposal::STATUS_CONFIRMED) %>
|
||||
<%= link_to_function icon('check'), "proposalStateSubmit(#{MatchProposal::STATUS_CONFIRMED},#{proposal.id})", title: 'Confirm' %>
|
||||
<% 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) %>
|
||||
<%= link_to_function icon('hourglass'), "proposalStateSubmit(#{MatchProposal::STATUS_DELAYED},#{proposal.id})", title: 'Delay' %>
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in a new issue