mirror of
https://github.com/ENSL/ensl.org.git
synced 2025-01-12 21:00:58 +00:00
Fix match proposals and reorder contest page
This commit is contained in:
parent
1057403f6c
commit
96a7135b76
2 changed files with 43 additions and 43 deletions
|
@ -99,6 +99,23 @@ $(function() {
|
|||
// Poll page
|
||||
$("a#option").click(function() {
|
||||
});
|
||||
|
||||
// Match proposal
|
||||
|
||||
$("form.edit_match_proposal a").on('click', function() {
|
||||
var form = $(this).closest('form.edit_match_proposal');
|
||||
form.children("input#match_proposal_status").val($(this).data('id'));
|
||||
$.post(form.attr('action'),form.serialize(), function(data) {
|
||||
tr = form.closest('tr');
|
||||
tr.children('td').eq(2).text(data.status);
|
||||
if(data.status === 'Revoked' || data.status === 'Rejected') tr.children('td').eq(3).empty();
|
||||
}, 'json')
|
||||
.error(function (err) {
|
||||
errjson = JSON.parse(err.responseText);
|
||||
alert(errjson.error.message);
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
// User search
|
||||
|
@ -125,23 +142,6 @@ function QuoteText(id, type) {
|
|||
});
|
||||
}
|
||||
|
||||
// Match proposal
|
||||
|
||||
$("form.edit_match_proposal a").on('click', function() {
|
||||
var form = $(this).closest('form.edit_match_proposal');
|
||||
form.children("input#match_proposal_status").val($(this).dataset.id);
|
||||
$.post(form.attr('action'),form.serialize(), function(data) {
|
||||
tr = form.closest('tr');
|
||||
tr.children('td').eq(2).text(data.status);
|
||||
if(data.status === 'Revoked' || data.status === 'Rejected') tr.children('td').eq(3).empty();
|
||||
}, 'json')
|
||||
.error(function (err) {
|
||||
errjson = JSON.parse(err.responseText);
|
||||
alert(errjson.error.message);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
// Tooltip to help admin
|
||||
|
||||
// Fields removing and adding dynamically
|
||||
|
|
|
@ -64,6 +64,32 @@
|
|||
|
||||
<div class="tabbed-contents">
|
||||
<div class="tab" id="results">
|
||||
<% if @contest.matches.unfinished.ordered.count > 0 %>
|
||||
<h3>
|
||||
Matches to be played
|
||||
</h3>
|
||||
|
||||
<table class="striped matches">
|
||||
<tr>
|
||||
<th class="team">Teams</th>
|
||||
<th class="date">Date</th>
|
||||
</tr>
|
||||
|
||||
<% @contest.matches.unfinished.ordered.reverse_each do |match| %>
|
||||
<tr>
|
||||
<td>
|
||||
<%= namelink match.contester1.team if match.contester1 %>
|
||||
vs
|
||||
<%= namelink match.contester2.team if match.contester2 %>
|
||||
</td>
|
||||
<td class="date">
|
||||
<%= link_to shorttime(match.match_time), match %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
<% end %>
|
||||
|
||||
<h3>
|
||||
Matches Played
|
||||
</h3>
|
||||
|
@ -141,32 +167,6 @@
|
|||
<% end %>
|
||||
</table>
|
||||
<% end %>
|
||||
|
||||
<% if @contest.matches.unfinished.ordered.count > 0 %>
|
||||
<h3>
|
||||
Matches to be played
|
||||
</h3>
|
||||
|
||||
<table class="striped matches">
|
||||
<tr>
|
||||
<th class="team">Teams</th>
|
||||
<th class="date">Date</th>
|
||||
</tr>
|
||||
|
||||
<% @contest.matches.unfinished.ordered.reverse_each do |match| %>
|
||||
<tr>
|
||||
<td>
|
||||
<%= namelink match.contester1.team if match.contester1 %>
|
||||
vs
|
||||
<%= namelink match.contester2.team if match.contester2 %>
|
||||
</td>
|
||||
<td class="date">
|
||||
<%= link_to shorttime(match.match_time), match %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="tab" id="predictions">
|
||||
|
|
Loading…
Reference in a new issue