From 96a7135b765553deb085580aa15b10cdec5ca893 Mon Sep 17 00:00:00 2001 From: Ari Timonen Date: Sun, 19 Apr 2020 04:59:39 +0300 Subject: [PATCH] Fix match proposals and reorder contest page --- app/assets/javascripts/local.js | 34 ++++++++++----------- app/views/contests/show.html.erb | 52 ++++++++++++++++---------------- 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/app/assets/javascripts/local.js b/app/assets/javascripts/local.js index 52a384f..80c3cf0 100644 --- a/app/assets/javascripts/local.js +++ b/app/assets/javascripts/local.js @@ -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 diff --git a/app/views/contests/show.html.erb b/app/views/contests/show.html.erb index 9d4070e..874c66f 100644 --- a/app/views/contests/show.html.erb +++ b/app/views/contests/show.html.erb @@ -64,6 +64,32 @@
+ <% if @contest.matches.unfinished.ordered.count > 0 %> +

+ Matches to be played +

+ + + + + + + + <% @contest.matches.unfinished.ordered.reverse_each do |match| %> + + + + + <% end %> +
TeamsDate
+ <%= namelink match.contester1.team if match.contester1 %> + vs + <%= namelink match.contester2.team if match.contester2 %> + + <%= link_to shorttime(match.match_time), match %> +
+ <% end %> +

Matches Played

@@ -141,32 +167,6 @@ <% end %> <% end %> - - <% if @contest.matches.unfinished.ordered.count > 0 %> -

- Matches to be played -

- - - - - - - - <% @contest.matches.unfinished.ordered.reverse_each do |match| %> - - - - - <% end %> -
TeamsDate
- <%= namelink match.contester1.team if match.contester1 %> - vs - <%= namelink match.contester2.team if match.contester2 %> - - <%= link_to shorttime(match.match_time), match %> -
- <% end %>