Add toggle button
This commit is contained in:
parent
1f14ef7747
commit
39e3f2b1c2
15 changed files with 135 additions and 44 deletions
|
@ -117,6 +117,12 @@
|
|||
|
||||
$("#contest-info").show();
|
||||
|
||||
$("#contest-info-toggle").on('click', function() {
|
||||
$.post("{{url('contest_mode_ajax')}}", function() {
|
||||
window.location.reload();
|
||||
})
|
||||
});
|
||||
|
||||
$(document).mousemove(function (e) {
|
||||
x_pos = e.screenX;
|
||||
y_pos = e.screenY;
|
||||
|
@ -190,6 +196,42 @@
|
|||
</style>
|
||||
</noscript>
|
||||
<style>
|
||||
#contest-info {
|
||||
font-size: 1.25em;
|
||||
border: 5px solid $highlight_blue;
|
||||
border-radius: 0 $widget_border_radius $widget_border_radius 0;
|
||||
z-index: 100000;
|
||||
cursor: move;
|
||||
position: fixed;
|
||||
left: 20px;
|
||||
top: 90%;
|
||||
display: none;
|
||||
}
|
||||
#contest-info-main {
|
||||
border-left: 5px dotted white;
|
||||
background: rgba(0, 0, 0, 0.77);
|
||||
padding: 10px 12px;
|
||||
color: white;
|
||||
display: inline;
|
||||
}
|
||||
#contest-info-toggle {
|
||||
display: inline;
|
||||
padding: 10px 12px;
|
||||
border-radius: 0 10px 10px 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
.contest-info-toggle-mode-on {
|
||||
background: rgba(0, 205, 0, 0.57);
|
||||
}
|
||||
.contest-info-toggle-mode-on:hover {
|
||||
background: rgba(0, 205, 0, 0.97);
|
||||
}
|
||||
.contest-info-toggle-mode-off {
|
||||
background: rgba(255, 0, 0, 0.57);
|
||||
}
|
||||
.contest-info-toggle-mode-off:hover {
|
||||
background: rgba(255, 0, 0, 0.97);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -284,18 +326,27 @@
|
|||
</nav>
|
||||
{% if request.in_contest %}
|
||||
<div id="contest-info">
|
||||
<a href="{{ url('contest_view', request.participation.contest.key) }}" style="vertical-align: middle">
|
||||
{{ request.participation.contest.name }} -
|
||||
{% if request.participation.spectate %}
|
||||
{{ _('spectating') }}
|
||||
{% elif request.participation.end_time %}
|
||||
<div id="contest-time-remaining" data-secs="{{request.participation.end_time}}">
|
||||
{{ request.participation.time_remaining|timedelta("localized") }}
|
||||
</div>
|
||||
<div id="contest-info-main">
|
||||
<a href="{{ url('contest_view', request.participation.contest.key) }}" style="vertical-align: middle; display: inline">
|
||||
{{ request.participation.contest.name }} -
|
||||
{% if request.participation.spectate %}
|
||||
{{ _('spectating') }}
|
||||
{% elif request.participation.end_time %}
|
||||
<div id="contest-time-remaining" data-secs="{{request.participation.end_time}}">
|
||||
{{ request.participation.time_remaining|timedelta("localized") }}
|
||||
</div>
|
||||
{% else %}
|
||||
{{ _('virtual') }}
|
||||
{% endif %}
|
||||
</a>
|
||||
</div>
|
||||
<div id="contest-info-toggle" class="{{'contest-info-toggle-mode-on' if request.contest_mode else 'contest-info-toggle-mode-off'}}">
|
||||
{% if request.contest_mode %}
|
||||
<i class="fa fa-toggle-on" style="color: white"></i> {{_('Compete')}}
|
||||
{% else %}
|
||||
{{ _('virtual') }}
|
||||
<i class="fa fa-toggle-off" style="color: white"></i> {{_('General')}}
|
||||
{% endif %}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div id="page-container">
|
||||
|
|
|
@ -110,7 +110,7 @@
|
|||
</div>
|
||||
|
||||
<div class="blog-sidebar">
|
||||
{% if request.in_contest and request.participation.contest.use_clarifications %}
|
||||
{% if request.in_contest_mode and request.participation.contest.use_clarifications %}
|
||||
<div class="blog-sidebox sidebox">
|
||||
<h3>{{ _('Clarifications') }}
|
||||
<i class="fa fa-question-circle"></i>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
}
|
||||
</style>
|
||||
</noscript>
|
||||
{% if not request.in_contest %}
|
||||
{% if not request.in_contest_mode %}
|
||||
<style>
|
||||
#search-org {
|
||||
width: 100%;
|
||||
|
@ -131,7 +131,7 @@
|
|||
});
|
||||
</script>
|
||||
{% endcompress %}
|
||||
{% if request.in_contest %}
|
||||
{% if request.in_contest_mode %}
|
||||
{% compress js %}
|
||||
<script src="{{ static('libs/tablesorter.js') }}" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
|
@ -184,7 +184,7 @@
|
|||
|
||||
<div id="common-content">
|
||||
{% block before_table %}{% endblock %}
|
||||
{% if not request.in_contest %}
|
||||
{% if not request.in_contest_mode %}
|
||||
<div id="content-right" class="problems">
|
||||
<div class="info-float">
|
||||
{% include "problem/search-form.html" %}
|
||||
|
@ -207,7 +207,7 @@
|
|||
<table id="problem-table" class="table striped">
|
||||
<thead>
|
||||
<tr>
|
||||
{% if request.in_contest %}
|
||||
{% if request.in_contest_mode %}
|
||||
{% if request.user.is_authenticated %}
|
||||
<th class="solved"><i class="fa fa-check"></i></th>
|
||||
{% endif %}
|
||||
|
@ -268,7 +268,7 @@
|
|||
{% if problem.id in completed_problem_ids %}
|
||||
<td solved="1">
|
||||
<a href="{{ url('user_submissions', problem.code, request.user.username) }}">
|
||||
{% if problem.is_public or request.in_contest %}
|
||||
{% if problem.is_public or request.in_contest_mode %}
|
||||
<i class="solved-problem-color fa fa-check-circle"></i>
|
||||
{% else %}
|
||||
<i class="solved-problem-color fa fa-lock"></i>
|
||||
|
@ -278,7 +278,7 @@
|
|||
{% elif problem.id in attempted_problems %}
|
||||
<td solved="0">
|
||||
<a href="{{ url('user_submissions', problem.code, request.user.username) }}">
|
||||
{% if problem.is_public or request.in_contest %}
|
||||
{% if problem.is_public or request.in_contest_mode %}
|
||||
<i class="attempted-problem-color fa fa-minus-circle"></i>
|
||||
{% else %}
|
||||
<i class="attempted-problem-color fa fa-lock"></i>
|
||||
|
@ -287,7 +287,7 @@
|
|||
</td>
|
||||
{% else %}
|
||||
<td solved="-1">
|
||||
{% if problem.is_public or request.in_contest %}
|
||||
{% if problem.is_public or request.in_contest_mode %}
|
||||
<i class="unsolved-problem-color fa fa-minus-circle"></i>
|
||||
{% else %}
|
||||
<i class="unsolved-problem-color fa fa-lock"></i>
|
||||
|
@ -312,12 +312,12 @@
|
|||
</td>
|
||||
{% endif %}
|
||||
<td class="p">{{ problem.points|floatformat }}{% if problem.partial %}p{% endif %}</td>
|
||||
{% if not request.in_contest %}
|
||||
{% if not request.in_contest_mode %}
|
||||
<td class="ac-rate">{{ problem.ac_rate|floatformat(1) }}%</td>
|
||||
{% endif %}
|
||||
<td class="users">
|
||||
<a href="{{ url('ranked_submissions', problem.code) }}">
|
||||
{% if not request.in_contest or not hide_contest_scoreboard %}
|
||||
{% if not request.in_contest_mode or not hide_contest_scoreboard %}
|
||||
{{ problem.user_count }}
|
||||
{% else %}
|
||||
???
|
||||
|
@ -335,7 +335,7 @@
|
|||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% if request.in_contest and request.participation.contest.use_clarifications %}
|
||||
{% if request.in_contest_mode and request.participation.contest.use_clarifications %}
|
||||
<br><br>
|
||||
{% if can_edit_contest %}
|
||||
<div style="float: right; font-size: 1.2em">
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block content_js_media %}
|
||||
{% if request.in_contest %}
|
||||
{% if request.in_contest_mode %}
|
||||
<script type="text/javascript">
|
||||
window.register_contest_notification("{{url('contest_clarification_ajax', request.participation.contest.key)}}");
|
||||
</script>
|
||||
|
@ -88,7 +88,7 @@
|
|||
{% if request.user.is_authenticated %}
|
||||
{% if problem.id in completed_problem_ids %}
|
||||
<a href="{{ url('user_submissions', problem.code, request.user.username) }}">
|
||||
{% if problem.is_public or request.in_contest %}
|
||||
{% if problem.is_public or request.in_contest_mode %}
|
||||
<i class="solved-problem-color title-state fa fa-check-circle"></i>
|
||||
{% else %}
|
||||
<i class="solved-problem-color title-state fa fa-lock"></i>
|
||||
|
@ -96,7 +96,7 @@
|
|||
</a>
|
||||
{% elif problem.id in attempted_problems %}
|
||||
<a href="{{ url('user_submissions', problem.code, request.user.username) }}">
|
||||
{% if problem.is_public or request.in_contest %}
|
||||
{% if problem.is_public or request.in_contest_mode %}
|
||||
<i class="attempted-problem-color title-state fa fa-minus-circle"></i>
|
||||
{% else %}
|
||||
<i class="attempted-problem-color title-state fa fa-lock"></i>
|
||||
|
@ -133,7 +133,7 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block info_float %}
|
||||
{% if request.user.is_authenticated and request.in_contest and submission_limit %}
|
||||
{% if request.user.is_authenticated and request.in_contest_mode and submission_limit %}
|
||||
{% if submissions_left > 0 %}
|
||||
<a href="{{ url('problem_submit', problem.code) }}" class="unselectable button full">
|
||||
{{ _('Submit solution') }}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{% if request.in_contest and request.participation.contest.logo_override_image %}
|
||||
{% if request.in_contest_mode and request.participation.contest.logo_override_image %}
|
||||
<img src="{{ request.participation.contest.logo_override_image|camo }}" alt="{{ SITE_NAME }}" height="44" style="border: none">
|
||||
{% elif logo_override_image is defined and logo_override_image %}
|
||||
<img src="{{ logo_override_image|camo }}" alt="{{ SITE_NAME }}" height="44" style="border: none">
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
{% block js_media %}
|
||||
<script type="text/javascript">
|
||||
{% if dynamic_update and last_msg %}
|
||||
{% if request.in_contest %}
|
||||
{% if request.in_contest_mode %}
|
||||
window.current_contest = '{{request.participation.contest.key}}';
|
||||
{% else %}
|
||||
window.current_contest = null;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<div>
|
||||
{{ link_user(submission.user) }}
|
||||
<span class="time">{{ relative_time(submission.date) }}</span>
|
||||
{% if not request.in_contest and submission.contest_object_id %}
|
||||
{% if not request.in_contest_mode and submission.contest_object_id %}
|
||||
<a href="{{ url('contest_view', submission.contest_object.key) }}"
|
||||
class="submission-contest">
|
||||
<i title="{{ submission.contest_object.name }}" class="fa fa-dot-circle-o"></i>
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<tr id="overall-row" class="case-row overall-result-{{submission.result}}">
|
||||
|
||||
<td><span class="col-title">{{_('Overall: ')}}</span>
|
||||
{% if request.in_contest and submission.contest_or_none %}
|
||||
{% if request.in_contest_mode and submission.contest_or_none %}
|
||||
{% with contest=submission.contest_or_none %}
|
||||
({{ _('%(points)s/%(total)s points', points=contest.points|roundfloat(3),
|
||||
total=contest.problem.points|floatformat(-1)) }})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue