ensl.org/app/views/match_proposals/index.html.erb

40 lines
1.5 KiB
Text
Raw Normal View History

2017-05-05 15:17:00 +00:00
<h1>Proposals</h1>
<%= link_to 'Back', match_path(@match), class: 'button' %>
<% if @match.match_proposals.empty? %>
<h4>There are no proposals yet</h4>
<% else %>
<table id="proposals" class="striped">
<tr>
<th>Team</th>
<th>Time</th>
<th>Status</th>
2017-06-11 13:09:30 +00:00
<% if @match.can_make_proposal?(cuser) %>
2017-05-05 15:17:00 +00:00
<th>Actions</th>
2017-06-11 13:09:30 +00:00
<% end %>
2017-05-05 15:17:00 +00:00
</tr>
<% @match.match_proposals.each do |proposal| %>
<tr class="<%=cycle('even', 'odd') %>">
<td><%= proposal.team.name %></td>
<td><%= longtime proposal.proposed_time %> </td>
<td><%= proposal.status_strings[proposal.status] %></td>
2017-06-11 13:09:30 +00:00
<% if @match.can_make_proposal?(cuser) %>
<td>
<%= form_for proposal, url: match_proposal_path(@match, proposal) do |f| %>
<%= f.hidden_field :status, value: 0 %>
<%= link_to_function icon('check'), "proposalStateSubmit(#{MatchProposal::STATUS_CONFIRMED},#{proposal.id})" %>
<%= link_to_function icon('times'), "proposalStateSubmit(#{MatchProposal::STATUS_REJECTED},#{proposal.id})" %>
<% end %>
</td>
<% end %>
2017-05-05 15:17:00 +00:00
</tr>
<% end %>
</table>
2017-06-11 13:09:30 +00:00
<script type="text/javascript">
function proposalStateSubmit(newState, formID) {
2017-06-11 14:36:10 +00:00
var form = $('#edit_match_proposal_' + formID);
form.children("input[type='hidden']").val(newState);
form.submit();
2017-06-11 13:09:30 +00:00
}
</script>
<% end %>
2017-05-05 15:17:00 +00:00
<%= link_to 'Back', match_path(@match), class: 'button' %><%= link_to 'Propose match time', new_match_proposal_path(@match), class: 'button' %>