Reformat html files

This commit is contained in:
cuom1999 2023-01-27 17:11:10 -06:00
parent 9a208ca108
commit 52f1e77fe1
205 changed files with 11096 additions and 11086 deletions

9
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,9 @@
repos:
- repo: https://github.com/rtts/djhtml
rev: 'main' # replace with the latest tag on GitHub
hooks:
- id: djhtml
entry: djhtml -i -t 2
files: templates/.
- id: djcss
types: [scss]

View file

@ -42,3 +42,4 @@ bleach
pymdown-extensions pymdown-extensions
mdx-breakless-lists mdx-breakless-lists
beautifulsoup4 beautifulsoup4
pre-commit

View file

@ -1,19 +1,19 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block body %} {% block body %}
{% if request.organization %} {% if request.organization %}
{% cache 3600 'organization_html' request.organization.id MATH_ENGINE %} {% cache 3600 'organization_html' request.organization.id MATH_ENGINE %}
{{ request.organization.about|markdown|reference|str|safe }} {{ request.organization.about|markdown|reference|str|safe }}
{% endcache %} {% endcache %}
{% else %} {% else %}
<h4> <h4>
<a target="_blank" href="">LQDOJ (Le Quy Don Online Judge)</a> là một trang web chấm bài tự động được phát triển dựa trên nền tảng mã nguồn mở <a target="_blank" href="https://dmoj.ca/">DMOJ</a>. Được xây dựng với mục đích ban đầu là tạo ra một môi trường học tập cho học sinh khối chuyên Tin <a target="_blank" href="http://thpt-lequydon-danang.edu.vn/">trường THPT chuyên Lê Quý Đôn (TP Đà Nẵng)</a>, hiện nay LQDOJ đã cho phép đăng ký tự do để trở thành một sân chơi rộng mở cho toàn bộ cộng đồng học sinh yêu Tin học. Trang web cung cấp lượng bài luyện tập đồ sộ từ các kỳ thi HSG Quốc Gia, ACM ICPC, Olympic Duyên Hải Bắc Bộ, etc. cho đến các contest định kỳ để xếp loại khả năng (rating) giúp các bạn có thêm động lực cạnh tranh và khí thế phấn đấu rèn luyện nâng cao trình độ lập trình. Các bạn có thể tham khảo mã nguồn của trang web tại <a target="_blank" href="https://github.com/LQDJudge/online-judge">Github repo chính thức</a>. Mọi ý kiến đóng góp và thắc mắc xin gửi về: <a target="_blank" href="">LQDOJ (Le Quy Don Online Judge)</a> là một trang web chấm bài tự động được phát triển dựa trên nền tảng mã nguồn mở <a target="_blank" href="https://dmoj.ca/">DMOJ</a>. Được xây dựng với mục đích ban đầu là tạo ra một môi trường học tập cho học sinh khối chuyên Tin <a target="_blank" href="http://thpt-lequydon-danang.edu.vn/">trường THPT chuyên Lê Quý Đôn (TP Đà Nẵng)</a>, hiện nay LQDOJ đã cho phép đăng ký tự do để trở thành một sân chơi rộng mở cho toàn bộ cộng đồng học sinh yêu Tin học. Trang web cung cấp lượng bài luyện tập đồ sộ từ các kỳ thi HSG Quốc Gia, ACM ICPC, Olympic Duyên Hải Bắc Bộ, etc. cho đến các contest định kỳ để xếp loại khả năng (rating) giúp các bạn có thêm động lực cạnh tranh và khí thế phấn đấu rèn luyện nâng cao trình độ lập trình. Các bạn có thể tham khảo mã nguồn của trang web tại <a target="_blank" href="https://github.com/LQDJudge/online-judge">Github repo chính thức</a>. Mọi ý kiến đóng góp và thắc mắc xin gửi về:
<ul> <ul>
<li>Thầy <a target="_blank" href="https://www.facebook.com/dovannho">Đỗ Văn Nhỏ</a> (handle: <span class="rating rate-none user"><a target="_blank" href="../user/Small">Small</a></span>), giáo viên Tin học trường THPT chuyên Lê Quý Đôn, email: <a href="mailto:admin@lqdoj.edu.vn">admin@lqdoj.edu.vn</a></li> <li>Thầy <a target="_blank" href="https://www.facebook.com/dovannho">Đỗ Văn Nhỏ</a> (handle: <span class="rating rate-none user"><a target="_blank" href="../user/Small">Small</a></span>), giáo viên Tin học trường THPT chuyên Lê Quý Đôn, email: <a href="mailto:admin@lqdoj.edu.vn">admin@lqdoj.edu.vn</a></li>
<li><a target="_blank" href="https://www.facebook.com/floweronstone">Nguyễn Đức Thuận</a> (handle: <span class="rating rate-master user"><a target="_blank" href="../user/Flower_On_Stone">Flower_On_Stone</a></span>), email: <a href="mailto:thuanbn03@gmail.com">thuanbn03@gmail.com</a></li> <li><a target="_blank" href="https://www.facebook.com/floweronstone">Nguyễn Đức Thuận</a> (handle: <span class="rating rate-master user"><a target="_blank" href="../user/Flower_On_Stone">Flower_On_Stone</a></span>), email: <a href="mailto:thuanbn03@gmail.com">thuanbn03@gmail.com</a></li>
<li><a target="_blank" href="https://www.facebook.com/profile.php?id=100011662657075">Lê Phước Định</a> (handle: <span class="rating rate-grandmaster user"><a target="_blank" href="../user/cuom1999">cuom1999</a></span>), email: <a href="mailto:dinh@lqdoj.edu.vn">dinh@lqdoj.edu.vn</a></li> <li><a target="_blank" href="https://www.facebook.com/profile.php?id=100011662657075">Lê Phước Định</a> (handle: <span class="rating rate-grandmaster user"><a target="_blank" href="../user/cuom1999">cuom1999</a></span>), email: <a href="mailto:dinh@lqdoj.edu.vn">dinh@lqdoj.edu.vn</a></li>
<li><a target="_blank" href="https://www.facebook.com/doannguyenthanhluong">Đoàn Nguyễn Thành Lương</a> (handle: <span class="rating rate-master user"><a target="_blank" href="../user/CaiWinDao">CaiWinDao</a></span>), email: <a href="mailto:luong@lqdoj.edu.vn">luong@lqdoj.edu.vn</a></li> <li><a target="_blank" href="https://www.facebook.com/doannguyenthanhluong">Đoàn Nguyễn Thành Lương</a> (handle: <span class="rating rate-master user"><a target="_blank" href="../user/CaiWinDao">CaiWinDao</a></span>), email: <a href="mailto:luong@lqdoj.edu.vn">luong@lqdoj.edu.vn</a></li>
</ul> </ul>
</h4> </h4>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View file

@ -1,62 +1,62 @@
{% extends "common-content.html" %} {% extends "common-content.html" %}
{% block description %} {% block description %}
<style> <style>
article { article {
padding: 2.5em 3.5em; padding: 2.5em 3.5em;
font-size: 1.1em; font-size: 1.1em;
} }
li { li {
padding: 0.2em; padding: 0.2em;
} }
#content-right { #content-right {
display: none; display: none;
} }
</style> </style>
<article id="py"> <article id="py">
<h2>1. Custom checker (PY)</h2> <h2>1. Custom checker (PY)</h2>
<hr> <hr>
<p> <p>
Đây là checker mặc định của website, cho phép người dùng cập nhật được nhiều thông tin nhất (chi tiết xem ở bên dưới). Chúng ta cần hoàn thành hàm check dưới đây: Đây là checker mặc định của website, cho phép người dùng cập nhật được nhiều thông tin nhất (chi tiết xem ở bên dưới). Chúng ta cần hoàn thành hàm check dưới đây:
</p> </p>
{{ {{
""" """
def check(process_output, judge_output, **kwargs): def check(process_output, judge_output, **kwargs):
# return True/False # return True/False
"""|highlight('py')}} """|highlight('py')}}
<p> <p>
Trong đó, <code>**kwargs</code> có thể chứa các biến sau: Trong đó, <code>**kwargs</code> có thể chứa các biến sau:
</p> </p>
<ul> <ul>
<li><code>process_output:</code> output</li> <li><code>process_output:</code> output</li>
<li><code>judge_output:</code> đáp án</li> <li><code>judge_output:</code> đáp án</li>
<li><code>submission_source</code>: Code bài nộp</li> <li><code>submission_source</code>: Code bài nộp</li>
<li><code>judge_input</code>: input</li> <li><code>judge_input</code>: input</li>
<li><code>point_value:</code> điểm của test đang chấm</li> <li><code>point_value:</code> điểm của test đang chấm</li>
<li><code>case_position:</code> thứ tự của test</li> <li><code>case_position:</code> thứ tự của test</li>
<li><code>submission_language:</code> ngôn ngữ của bài nộp</li> <li><code>submission_language:</code> ngôn ngữ của bài nộp</li>
<li><code>execution_time:</code> thời gian chạy</li> <li><code>execution_time:</code> thời gian chạy</li>
</ul> </ul>
<h2>Return: </h2> <h2>Return: </h2>
<ul> <ul>
<li>Cách 1: Trả về True/False</li> <li>Cách 1: Trả về True/False</li>
<li>Cách 2: Trả về một object <code>CheckerResult</code> có thể được gọi như sau <pre class="code2">CheckerResult(case_passed_bool, points_awarded, feedback='')</pre></li> <li>Cách 2: Trả về một object <code>CheckerResult</code> có thể được gọi như sau <pre class="code2">CheckerResult(case_passed_bool, points_awarded, feedback='')</pre></li>
</ul> </ul>
<h2>Ví dụ: </h2> <h2>Ví dụ: </h2>
<p>Dưới đây là ví dụ cho bài toán: Input gồm 1 số nguyên n. In ra 2 số nguyên a, b sao cho a + b = n. <p>Dưới đây là ví dụ cho bài toán: Input gồm 1 số nguyên n. In ra 2 số nguyên a, b sao cho a + b = n.
</p> </p>
{{ {{
""" """
from dmoj.result import CheckerResult from dmoj.result import CheckerResult
def wa(feedback): def wa(feedback):
return CheckerResult(False, 0, feedback) return CheckerResult(False, 0, feedback)
def check(process_output, judge_output, judge_input, **kwargs): def check(process_output, judge_output, judge_input, **kwargs):
# process the input # process the input
input_arr = judge_input.split() input_arr = judge_input.split()
assert(len(input_arr) == 1) assert(len(input_arr) == 1)
@ -66,143 +66,143 @@ def check(process_output, judge_output, judge_input, **kwargs):
output_arr = process_output.split() output_arr = process_output.split()
if (len(output_arr) != 2): if (len(output_arr) != 2):
return wa('Wrong output format') return wa('Wrong output format')
try: try:
a, b = int(output_arr[0]), int(output_arr[1]) a, b = int(output_arr[0]), int(output_arr[1])
except: except:
return wa('Wrong output format') return wa('Wrong output format')
if (n == a + b): if (n == a + b):
return True return True
return wa('a + b != n') return wa('a + b != n')
"""| highlight('py')}} """| highlight('py')}}
</article> </article>
<article id="cpp"> <article id="cpp">
<h2>2. Custom validator (CPP)</h2> <h2>2. Custom validator (CPP)</h2>
<hr> <hr>
<p> <p>
Để sử dụng chức năng này, cần viết một chương trình C++ pass vào 3 arguments theo thứ tự <code>input_file</code>, <code>output_file</code>, <code>ans_file</code> tương ứng với các file input, output, đáp án. Để sử dụng chức năng này, cần viết một chương trình C++ pass vào 3 arguments theo thứ tự <code>input_file</code>, <code>output_file</code>, <code>ans_file</code> tương ứng với các file input, output, đáp án.
</p> </p>
<p> <p>
Để test chương trình trên máy tính, có thể dùng lệnh như sau (Windows): Để test chương trình trên máy tính, có thể dùng lệnh như sau (Windows):
<pre class="code2"> <pre class="code2">
main.exe [input_file] [output_file] [ans_file]</pre> main.exe [input_file] [output_file] [ans_file]</pre>
hoặc thay bằng <code>./main</code> trên Linux/MacOS. hoặc thay bằng <code>./main</code> trên Linux/MacOS.
</p> </p>
<h2>Return: </h2> <h2>Return: </h2>
<p> <p>
Chương trình trả về giá trị: Chương trình trả về giá trị:
<ul> <ul>
<li> 0 nếu AC (100% điểm)</li> <li> 0 nếu AC (100% điểm)</li>
<li> 1 nếu WA (0 điểm)</li> <li> 1 nếu WA (0 điểm)</li>
<li> 2 nếu điểm thành phần. Khi đó cần in ra stderr một số thực trong đoạn [0, 1] thể hiện cho tỷ lệ điểm. Nếu điểm < 1 thì hiển thị WA, điểm = 1 thì hiển thị AC. </li> <li> 2 nếu điểm thành phần. Khi đó cần in ra stderr một số thực trong đoạn [0, 1] thể hiện cho tỷ lệ điểm. Nếu điểm < 1 thì hiển thị WA, điểm = 1 thì hiển thị AC. </li>
</ul> </ul>
Những thông tin được viết ra stdout (bằng cout) sẽ được in ra màn hình cho người nộp bài(feedback) Những thông tin được viết ra stdout (bằng cout) sẽ được in ra màn hình cho người nộp bài(feedback)
</p> </p>
<h2>Ví dụ: </h2> <h2>Ví dụ: </h2>
<p>Chương trình sau dùng để chấm bài toán: Cho n là một số nguyên dương. In ra hai số tự nhiên a, b sao cho a + b = n. </p> <p>Chương trình sau dùng để chấm bài toán: Cho n là một số nguyên dương. In ra hai số tự nhiên a, b sao cho a + b = n. </p>
<p>Nếu in ra a + b = n và a, b >= 0 thì được 100% số điểm, nếu a + b = n nhưng một trong 2 số a, b âm thì được 50% số điểm. </p> <p>Nếu in ra a + b = n và a, b >= 0 thì được 100% số điểm, nếu a + b = n nhưng một trong 2 số a, b âm thì được 50% số điểm. </p>
{{ {{
""" """
#include <bits/stdc++.h> #include <bits/stdc++.h>
using namespace std; using namespace std;
int main(int argc, char** argv) { int main(int argc, char** argv) {
ifstream inp(argv[1]); ifstream inp(argv[1]);
ifstream out(argv[2]); ifstream out(argv[2]);
ifstream ans(argv[3]); ifstream ans(argv[3]);
int n, a, b, c, d; int n, a, b, c, d;
inp >> n; inp >> n;
out >> a >> b; out >> a >> b;
ans >> c >> d; ans >> c >> d;
if (a + b == c + d) { if (a + b == c + d) {
cout << a << \" + \" << b << \" = \" << c << \" + \" << d << endl; cout << a << \" + \" << b << \" = \" << c << \" + \" << d << endl;
if (a >= 0 && b >= 0) { if (a >= 0 && b >= 0) {
return 0; // AC return 0; // AC
} }
else { else {
cerr << 0.5; cerr << 0.5;
return 2; // PARTIAL return 2; // PARTIAL
} }
} }
else { else {
cout << \"a + b = \" << a + b << \" != \" << n << endl; cout << \"a + b = \" << a + b << \" != \" << n << endl;
return 1; // WA return 1; // WA
} }
} }
""" | highlight('cpp')}} """ | highlight('cpp')}}
</article> </article>
<article id="interactive"> <article id="interactive">
<h2>3. Interactive (CPP)</h2> <h2>3. Interactive (CPP)</h2>
<hr> <hr>
<p> <p>
Để sử dụng chức năng này, cần viết một chương trình C++ pass vào 2 arguments <code>input_file</code> <code>answer_file</code> tương ứng file input và đáp án (nếu cần thiết). Để sử dụng chức năng này, cần viết một chương trình C++ pass vào 2 arguments <code>input_file</code> <code>answer_file</code> tương ứng file input và đáp án (nếu cần thiết).
</p> </p>
<p> <p>
Để test chương trình trên máy tính với tư cách thí sinh, có thể dùng lệnh như sau (Windows): Để test chương trình trên máy tính với tư cách thí sinh, có thể dùng lệnh như sau (Windows):
<pre class="code2"> <pre class="code2">
main.exe [input_file] [answer_file]</pre> main.exe [input_file] [answer_file]</pre>
hoặc thay bằng <code>./main</code> trên Linux/MacOS. hoặc thay bằng <code>./main</code> trên Linux/MacOS.
</p> </p>
<h2>Return: </h2> <h2>Return: </h2>
<p> <p>
Chương trình trả về giá trị: Chương trình trả về giá trị:
<ul> <ul>
<li> 0 nếu AC (100% điểm)</li> <li> 0 nếu AC (100% điểm)</li>
<li> 1 nếu WA (0 điểm)</li> <li> 1 nếu WA (0 điểm)</li>
<li> 2 nếu điểm thành phần. Khi đó cần in ra stderr một số thực trong đoạn [0, 1] thể hiện cho tỷ lệ điểm. Nếu điểm < 1 thì hiển thị WA, điểm = 1 thì hiển thị AC. </li> <li> 2 nếu điểm thành phần. Khi đó cần in ra stderr một số thực trong đoạn [0, 1] thể hiện cho tỷ lệ điểm. Nếu điểm < 1 thì hiển thị WA, điểm = 1 thì hiển thị AC. </li>
</ul> </ul>
Thông tin được in ra trong stderr (bằng cerr) sẽ là feedback hiển thị cho người dùng. Thông tin được in ra trong stderr (bằng cerr) sẽ là feedback hiển thị cho người dùng.
</p> </p>
<h2>Ví dụ: </h2> <h2>Ví dụ: </h2>
<p>Chương trình sau dùng để chấm bài toán guessgame: Người chơi phải tìm 1 số bí mật n (n chứa trong file input). Mỗi lần họ được hỏi một số x, và chương trình sẽ trả về "SMALLER", "BIGGER" hoặc "HOLA" dựa trên giá trị của n và x. Cần tìm ra n sau không quá 31 câu hỏi. </p> <p>Chương trình sau dùng để chấm bài toán guessgame: Người chơi phải tìm 1 số bí mật n (n chứa trong file input). Mỗi lần họ được hỏi một số x, và chương trình sẽ trả về "SMALLER", "BIGGER" hoặc "HOLA" dựa trên giá trị của n và x. Cần tìm ra n sau không quá 31 câu hỏi. </p>
{{ {{
""" """
#include <bits/stdc++.h> #include <bits/stdc++.h>
using namespace std; using namespace std;
void quit(string reason) { void quit(string reason) {
cerr << reason << endl; cerr << reason << endl;
exit(1); exit(1);
} }
void read(long long& guess) { void read(long long& guess) {
if (!(cin >> guess)) exit(1); // Nếu không có dòng này, chương trình sẽ chờ vô hạn if (!(cin >> guess)) exit(1); // Nếu không có dòng này, chương trình sẽ chờ vô hạn
if (guess < 1 || guess > 2e9) exit(1); if (guess < 1 || guess > 2e9) exit(1);
} }
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
ifstream inp(argv[1]); ifstream inp(argv[1]);
int N, guesses = 0; int N, guesses = 0;
long long guess; long long guess;
inp >> N; inp >> N;
while (guess != N && guesses <= 31) { while (guess != N && guesses <= 31) {
read(guess); read(guess);
if (guess == N) { if (guess == N) {
cout << \"HOLA\" << endl; cout << \"HOLA\" << endl;
} else if (guess > N) { } else if (guess > N) {
cout << \"SMALLER\" << endl; cout << \"SMALLER\" << endl;
} else { } else {
cout << \"BIGGER\" << endl; cout << \"BIGGER\" << endl;
} }
guesses++; guesses++;
} }
cerr << \"Number of used guesses: \" << guesses << endl; cerr << \"Number of used guesses: \" << guesses << endl;
if (guesses <= 31) if (guesses <= 31)
return 0; // AC return 0; // AC
else { else {
cerr << \"Used too many guesses\" << endl; cerr << \"Used too many guesses\" << endl;
return 1; // WA return 1; // WA
} }
} }
""" | highlight('cpp')}} """ | highlight('cpp')}}
</article> </article>
{% endblock %} {% endblock %}

View file

@ -1,51 +1,51 @@
{% set logged_in = request.user.is_authenticated %} {% set logged_in = request.user.is_authenticated %}
{% set profile = request.profile if logged_in else None %} {% set profile = request.profile if logged_in else None %}
{% if logged_in %} {% if logged_in %}
{% if include_hr %}<hr>{% endif %} {% if include_hr %}<hr>{% endif %}
<div class="page-vote actionbar"> <div class="page-vote actionbar">
<span class="actionbar-block" style="justify-content: flex-start;"> <span class="actionbar-block" style="justify-content: flex-start;">
<span id="like-button-{{pagevote.id}}" <span id="like-button-{{pagevote.id}}"
class="like-button actionbar-button {% if pagevote.vote_score(request.profile) == 1 %}voted{% endif %}" class="like-button actionbar-button {% if pagevote.vote_score(request.profile) == 1 %}voted{% endif %}"
onclick="javascript:pagevote_upvote({{ pagevote.id }})" onclick="javascript:pagevote_upvote({{ pagevote.id }})"
> >
<span class="pagevote-score" id="pagevote-score-{{pagevote.id}}">{{ pagevote.score }}</span> <span class="pagevote-score" id="pagevote-score-{{pagevote.id}}">{{ pagevote.score }}</span>
<i class="fa fa-thumbs-o-up" style="font-size: large;"></i> <i class="fa fa-thumbs-o-up" style="font-size: large;"></i>
<span class="actionbar-text">{{_("Like")}}</span> <span class="actionbar-text">{{_("Like")}}</span>
</span> </span>
<span id="dislike-button-{{pagevote.id}}" class="dislike-button actionbar-button {% if pagevote.vote_score(request.profile) == -1 %}voted{% endif %}" onclick="javascript:pagevote_downvote({{ pagevote.id }})"> <span id="dislike-button-{{pagevote.id}}" class="dislike-button actionbar-button {% if pagevote.vote_score(request.profile) == -1 %}voted{% endif %}" onclick="javascript:pagevote_downvote({{ pagevote.id }})">
<i class="fa fa-thumbs-o-down" style="font-size: large;"></i> <i class="fa fa-thumbs-o-down" style="font-size: large;"></i>
</span> </span>
</span> </span>
{% if not hide_actionbar_comment %} {% if not hide_actionbar_comment %}
<span class="actionbar-block"> <span class="actionbar-block">
<span class="actionbar-button actionbar-comment"> <span class="actionbar-button actionbar-comment">
<i class="fa fa-comment-o" style="font-size: large;"></i> <i class="fa fa-comment-o" style="font-size: large;"></i>
<span class="actionbar-text">{{_("Comment")}} {% if comment_list.count() %} ({{comment_list.count()}}) {% endif %}</span> <span class="actionbar-text">{{_("Comment")}} {% if comment_list.count() %} ({{comment_list.count()}}) {% endif %}</span>
</span> </span>
</span> </span>
{% endif %} {% endif %}
<span class="actionbar-block"> <span class="actionbar-block">
<span id="bookmark-button-{{bookmark.id}}" <span id="bookmark-button-{{bookmark.id}}"
class="bookmark-button actionbar-button {% if bookmark.get_bookmark(request.profile) == True %} bookmarked {% endif %}" class="bookmark-button actionbar-button {% if bookmark.get_bookmark(request.profile) == True %} bookmarked {% endif %}"
onclick="javascript:bookmark({{ bookmark.id }})" onclick="javascript:bookmark({{ bookmark.id }})"
> >
<i class="fa fa-bookmark-o" style="font-size: large;"></i> <i class="fa fa-bookmark-o" style="font-size: large;"></i>
<span class="actionbar-text">{{_("Bookmark")}}</span> <span class="actionbar-text">{{_("Bookmark")}}</span>
</span> </span>
</span> </span>
<span class="actionbar-block" > <span class="actionbar-block" >
<span class="actionbar-button actionbar-share" style="position: relative" {{"share-url=" + share_url if share_url else ""}}> <span class="actionbar-button actionbar-share" style="position: relative" {{"share-url=" + share_url if share_url else ""}}>
<i class="fa fa-share" style="font-size: large;"></i> <i class="fa fa-share" style="font-size: large;"></i>
<span class="actionbar-text">{{_("Share")}}</span> <span class="actionbar-text">{{_("Share")}}</span>
</span> </span>
</span> </span>
{% if actionbar_report_url %} {% if actionbar_report_url %}
<span class="actionbar-block"> <span class="actionbar-block">
<a class="actionbar-button black" href="{{actionbar_report_url}}"> <a class="actionbar-button black" href="{{actionbar_report_url}}">
<i class="fa fa-flag-o" style="font-size: large;"></i> <i class="fa fa-flag-o" style="font-size: large;"></i>
<span class="actionbar-text">{{_("Report")}}</span> <span class="actionbar-text">{{_("Report")}}</span>
</a> </a>
</span> </span>
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}

View file

@ -1,7 +1,7 @@
<style> <style>
@media (max-width: 799px) { @media (max-width: 799px) {
.actionbar-text { .actionbar-text {
display: none; display: none;
}
} }
}
</style> </style>

View file

@ -1,124 +1,124 @@
{% compress js %} {% compress js %}
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function () { $(document).ready(function () {
function ajax_vote(url, id, delta, on_success) { function ajax_vote(url, id, delta, on_success) {
return $.ajax({ return $.ajax({
url: url, url: url,
type: 'POST', type: 'POST',
data: { data: {
id: id id: id
}, },
success: function (data, textStatus, jqXHR) { success: function (data, textStatus, jqXHR) {
var score = $('#pagevote-score-' + id); var score = $('#pagevote-score-' + id);
score.text(parseInt(score.text()) + delta); score.text(parseInt(score.text()) + delta);
if (typeof on_success !== 'undefined') if (typeof on_success !== 'undefined')
on_success(); on_success();
}, },
error: function (data, textStatus, jqXHR) { error: function (data, textStatus, jqXHR) {
alert('Could not vote: ' + data.responseText); alert('Could not vote: ' + data.responseText);
} }
});
}
function ajax_bookmark(url, id, on_success) {
return $.ajax({
url: url,
type: 'POST',
data: {
id: id
},
success: function (data, textStatus, jqXHR) {
if (typeof on_success !== 'undefined')
on_success();
},
error: function (data, textStatus, jqXHR) {
alert('Could not bookmark: ' + data.responseText);
}
});
}
window.bookmark = function(id) {
var $bookmark = $('#bookmark-button-' + id);
if ($bookmark.hasClass('bookmarked')) {
ajax_bookmark('{{ url('undobookmark') }}', id, function () {
$bookmark.removeClass('bookmarked');
});
} else {
ajax_bookmark('{{ url('dobookmark') }}', id, function () {
if ($bookmark.hasClass('bookmarked'))
$bookmark.removeClass('bookmarked');
$bookmark.addClass('bookmarked');
});
}
}
var get_$votes = function (id) {
var $post = $('#page-vote-' + id);
return {
upvote: $('#like-button-' + id),
downvote: $('#dislike-button-' + id),
};
};
window.pagevote_upvote = function (id) {
var $votes = get_$votes(id);
if ($votes.upvote.hasClass('voted')) {
ajax_vote('{{ url('pagevote_downvote') }}', id, -1, function () {
$votes.upvote.removeClass('voted');
});
}
else {
var delta = 1;
if ($votes.downvote.hasClass('voted')) {
delta = 2;
}
for (let i = 0; i < delta; i++) {
ajax_vote('{{ url('pagevote_upvote') }}', id, 1, function () {
if ($votes.downvote.hasClass('voted'))
$votes.downvote.removeClass('voted');
$votes.upvote.addClass('voted');
});
}
}
};
window.pagevote_downvote = function (id) {
var $votes = get_$votes(id);
if ($votes.downvote.hasClass('voted')) {
ajax_vote('{{ url('pagevote_upvote') }}', id, 1, function () {
$votes.downvote.removeClass('voted');
});
}
else {
var delta = -1;
if ($votes.upvote.hasClass('voted')) {
delta = -2;
}
for (let i = 0; i > delta; i--) {
ajax_vote('{{ url('pagevote_downvote') }}', id, -1, function () {
if ($votes.upvote.hasClass('voted'))
$votes.upvote.removeClass('voted');
$votes.downvote.addClass('voted');
});
}
}
};
$(".actionbar-share").click( function() {
link = $(this).attr("share-url") || window.location.href;
navigator.clipboard
.writeText(link)
.then(() => {
showTooltip(this, "Copied link", 'n');
});
});
$('.actionbar-comment').on('click', function() {
if ($('#comment-announcement').length) {
$('#comment-announcement').click();
}
$('#write-comment').click();
})
}); });
</script> }
function ajax_bookmark(url, id, on_success) {
return $.ajax({
url: url,
type: 'POST',
data: {
id: id
},
success: function (data, textStatus, jqXHR) {
if (typeof on_success !== 'undefined')
on_success();
},
error: function (data, textStatus, jqXHR) {
alert('Could not bookmark: ' + data.responseText);
}
});
}
window.bookmark = function(id) {
var $bookmark = $('#bookmark-button-' + id);
if ($bookmark.hasClass('bookmarked')) {
ajax_bookmark('{{ url('undobookmark') }}', id, function () {
$bookmark.removeClass('bookmarked');
});
} else {
ajax_bookmark('{{ url('dobookmark') }}', id, function () {
if ($bookmark.hasClass('bookmarked'))
$bookmark.removeClass('bookmarked');
$bookmark.addClass('bookmarked');
});
}
}
var get_$votes = function (id) {
var $post = $('#page-vote-' + id);
return {
upvote: $('#like-button-' + id),
downvote: $('#dislike-button-' + id),
};
};
window.pagevote_upvote = function (id) {
var $votes = get_$votes(id);
if ($votes.upvote.hasClass('voted')) {
ajax_vote('{{ url('pagevote_downvote') }}', id, -1, function () {
$votes.upvote.removeClass('voted');
});
}
else {
var delta = 1;
if ($votes.downvote.hasClass('voted')) {
delta = 2;
}
for (let i = 0; i < delta; i++) {
ajax_vote('{{ url('pagevote_upvote') }}', id, 1, function () {
if ($votes.downvote.hasClass('voted'))
$votes.downvote.removeClass('voted');
$votes.upvote.addClass('voted');
});
}
}
};
window.pagevote_downvote = function (id) {
var $votes = get_$votes(id);
if ($votes.downvote.hasClass('voted')) {
ajax_vote('{{ url('pagevote_upvote') }}', id, 1, function () {
$votes.downvote.removeClass('voted');
});
}
else {
var delta = -1;
if ($votes.upvote.hasClass('voted')) {
delta = -2;
}
for (let i = 0; i > delta; i--) {
ajax_vote('{{ url('pagevote_downvote') }}', id, -1, function () {
if ($votes.upvote.hasClass('voted'))
$votes.upvote.removeClass('voted');
$votes.downvote.addClass('voted');
});
}
}
};
$(".actionbar-share").click( function() {
link = $(this).attr("share-url") || window.location.href;
navigator.clipboard
.writeText(link)
.then(() => {
showTooltip(this, "Copied link", 'n');
});
});
$('.actionbar-comment').on('click', function() {
if ($('#comment-announcement').length) {
$('#comment-announcement').click();
}
$('#write-comment').click();
})
});
</script>
{% endcompress %} {% endcompress %}

View file

@ -2,19 +2,19 @@
{% load i18n %} {% load i18n %}
{% block extrahead %}{{ block.super }} {% block extrahead %}{{ block.super }}
<script> <script>
django.jQuery(function ($) { django.jQuery(function ($) {
$('.profilelink').appendTo('div#bottombar').show(); $('.profilelink').appendTo('div#bottombar').show();
}); });
</script> </script>
{% endblock extrahead %} {% endblock extrahead %}
{% block after_field_sets %}{{ block.super }} {% block after_field_sets %}{{ block.super }}
{% if original %} {% if original %}
<a style="display: none" title="{% trans "Edit profile" %}" href="{% url 'admin:judge_profile_change' original.profile.pk %}" <a style="display: none" title="{% trans "Edit profile" %}" href="{% url 'admin:judge_profile_change' original.profile.pk %}"
class="button profilelink"> class="button profilelink">
<i class="fa fa-lg fa-user-plus"></i> <i class="fa fa-lg fa-user-plus"></i>
<span class="text">{% trans "Edit profile" %}</span> <span class="text">{% trans "Edit profile" %}</span>
</a> </a>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View file

@ -2,22 +2,22 @@
{% load i18n %} {% load i18n %}
{% block extrahead %}{{ block.super }} {% block extrahead %}{{ block.super }}
<script> <script>
django.jQuery(function ($) { django.jQuery(function ($) {
$('.rerate-link').appendTo('div#bottombar').show(); $('.rerate-link').appendTo('div#bottombar').show();
$('.rejudge-link').click(function () { $('.rejudge-link').click(function () {
return confirm('{{ _('Are you sure you want to rejudge ALL the submissions?') }}'); return confirm('{{ _('Are you sure you want to rejudge ALL the submissions?') }}');
}); });
}); });
</script> </script>
{% endblock extrahead %} {% endblock extrahead %}
{% block after_field_sets %}{{ block.super }} {% block after_field_sets %}{{ block.super }}
{% if original and original.is_rated and original.ended and perms.judge.contest_rating %} {% if original and original.is_rated and original.ended and perms.judge.contest_rating %}
<a style="display: none" title="{% trans "Rate" %}" href="{% url 'admin:judge_contest_rate' original.pk %}" <a style="display: none" title="{% trans "Rate" %}" href="{% url 'admin:judge_contest_rate' original.pk %}"
class="button rerate-link"> class="button rerate-link">
<i class="fa fa-lg fa-signal"></i> <i class="fa fa-lg fa-signal"></i>
<span class="text">{% trans "Rate" %}</span> <span class="text">{% trans "Rate" %}</span>
</a> </a>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View file

@ -2,12 +2,12 @@
{% load i18n %} {% load i18n %}
{% block object-tools-items %} {% block object-tools-items %}
{{ block.super }} {{ block.super }}
{% if not is_popup and perms.judge.contest_rating %} {% if not is_popup and perms.judge.contest_rating %}
<li> <li>
<a href="{% url 'admin:judge_contest_rate_all' %}" class="ratealllink"> <a href="{% url 'admin:judge_contest_rate_all' %}" class="ratealllink">
<i class="fa fa-signal"></i> {% trans "Rate all ratable contests" %} <i class="fa fa-signal"></i> {% trans "Rate all ratable contests" %}
</a> </a>
</li> </li>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View file

@ -2,25 +2,25 @@
{% load i18n %} {% load i18n %}
{% block extrahead %}{{ block.super }} {% block extrahead %}{{ block.super }}
<script> <script>
django.jQuery(function ($) { django.jQuery(function ($) {
$('.disconnect-link').appendTo('div#bottombar').show(); $('.disconnect-link').appendTo('div#bottombar').show();
$('.terminate-link').appendTo('div#bottombar').show(); $('.terminate-link').appendTo('div#bottombar').show();
}); });
</script> </script>
{% endblock extrahead %} {% endblock extrahead %}
{% block after_field_sets %}{{ block.super }} {% block after_field_sets %}{{ block.super }}
{% if original %} {% if original %}
<a style="display: none" title="{% trans "Disconnect" %}" href="{% url 'admin:judge_judge_disconnect' original.pk %}" <a style="display: none" title="{% trans "Disconnect" %}" href="{% url 'admin:judge_judge_disconnect' original.pk %}"
class="button disconnect-link"> class="button disconnect-link">
<i class="fa fa-lg fa-power-off"></i> <i class="fa fa-lg fa-power-off"></i>
<span class="text">{% trans "Disconnect" %}</span> <span class="text">{% trans "Disconnect" %}</span>
</a> </a>
<a style="display: none" title="{% trans "Terminate" %}" href="{% url 'admin:judge_judge_terminate' original.pk %}" <a style="display: none" title="{% trans "Terminate" %}" href="{% url 'admin:judge_judge_terminate' original.pk %}"
class="button terminate-link"> class="button terminate-link">
<i class="fa fa-lg fa-plug"></i> <i class="fa fa-lg fa-plug"></i>
<span class="text">{% trans "Terminate" %}</span> <span class="text">{% trans "Terminate" %}</span>
</a> </a>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View file

@ -2,24 +2,24 @@
{% load i18n %} {% load i18n %}
{% block extrahead %}{{ block.super }} {% block extrahead %}{{ block.super }}
<script> <script>
django.jQuery(function ($) { django.jQuery(function ($) {
$('.submissions-link').appendTo('div#bottombar').show(); $('.submissions-link').appendTo('div#bottombar').show();
$('.votes-link').appendTo('div#bottombar').show(); $('.votes-link').appendTo('div#bottombar').show();
}); });
</script> </script>
{% endblock extrahead %} {% endblock extrahead %}
{% block after_field_sets %}{{ block.super }} {% block after_field_sets %}{{ block.super }}
{% if original %} {% if original %}
<a style="display: none" title="{% trans "View Submissions" %}" class="button submissions-link" <a style="display: none" title="{% trans "View Submissions" %}" class="button submissions-link"
href="{% url 'admin:judge_submission_changelist' %}?problem__code={{ original.code }}"> href="{% url 'admin:judge_submission_changelist' %}?problem__code={{ original.code }}">
<i class="fa fa-lg fa-search-plus"></i> <i class="fa fa-lg fa-search-plus"></i>
<span class="text">{% trans "View submissions" %}</span> <span class="text">{% trans "View submissions" %}</span>
<a style="display: none" title="{{ _('View votes') }}" class="button votes-link" <a style="display: none" title="{{ _('View votes') }}" class="button votes-link"
href="{% url 'admin:judge_problempointsvote_changelist' %}?problem__code={{ original.code }}"> href="{% url 'admin:judge_problempointsvote_changelist' %}?problem__code={{ original.code }}">
<i class="fa fa-lg fa-envelope"></i> <i class="fa fa-lg fa-envelope"></i>
<span class="text">{{ _('View votes') }}</span> <span class="text">{{ _('View votes') }}</span>
</a> </a>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View file

@ -2,19 +2,19 @@
{% load i18n %} {% load i18n %}
{% block extrahead %}{{ block.super }} {% block extrahead %}{{ block.super }}
<script> <script>
django.jQuery(function ($) { django.jQuery(function ($) {
$('.userlink').appendTo('div#bottombar').show(); $('.userlink').appendTo('div#bottombar').show();
}); });
</script> </script>
{% endblock extrahead %} {% endblock extrahead %}
{% block after_field_sets %}{{ block.super }} {% block after_field_sets %}{{ block.super }}
{% if original %} {% if original %}
<a style="display: none" title="{% trans "Edit user" %}" href="{% url 'admin:auth_user_change' original.user.pk %}" <a style="display: none" title="{% trans "Edit user" %}" href="{% url 'admin:auth_user_change' original.user.pk %}"
class="button userlink"> class="button userlink">
<i class="fa fa-lg fa-user"></i> <i class="fa fa-lg fa-user"></i>
<span class="text">{% trans "Edit user" %}</span> <span class="text">{% trans "Edit user" %}</span>
</a> </a>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View file

@ -2,19 +2,19 @@
{% load i18n %} {% load i18n %}
{% block extrahead %}{{ block.super }} {% block extrahead %}{{ block.super }}
<script> <script>
django.jQuery(function ($) { django.jQuery(function ($) {
$('.rejudgelink').appendTo('div#bottombar').show(); $('.rejudgelink').appendTo('div#bottombar').show();
}); });
</script> </script>
{% endblock extrahead %} {% endblock extrahead %}
{% block after_field_sets %}{{ block.super }} {% block after_field_sets %}{{ block.super }}
{% if original %} {% if original %}
<a style="display: none" title="{% trans "Rejudge" %}" href="{% url 'admin:judge_submission_rejudge' original.pk %}" <a style="display: none" title="{% trans "Rejudge" %}" href="{% url 'admin:judge_submission_rejudge' original.pk %}"
class="button rejudgelink"> class="button rejudgelink">
<i class="fa fa-lg fa-refresh"></i> <i class="fa fa-lg fa-refresh"></i>
<span class="text">{% trans "Rejudge" %}</span> <span class="text">{% trans "Rejudge" %}</span>
</a> </a>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View file

@ -1,13 +1,13 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="{{ LANGUAGE_CODE }}"> <html lang="{{ LANGUAGE_CODE }}">
<head> <head>
<title>{% block title %}{{ title }} - {{ SITE_LONG_NAME }}{% endblock %}</title> <title>{% block title %}{{ title }} - {{ SITE_LONG_NAME }}{% endblock %}</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
{% if misc_config.meta_keywords %} {% if misc_config.meta_keywords %}
<meta name="keywords" content="{{ misc_config.meta_keywords }}"> <meta name="keywords" content="{{ misc_config.meta_keywords }}">
{% endif %} {% endif %}
{% if meta_description %} {% if meta_description %}
<meta name="description" content="{{ meta_description }}"> <meta name="description" content="{{ meta_description }}">
{% endif %} {% endif %}
<meta id="viewport" name="viewport" content="width=device-width, initial-scale=1"> <meta id="viewport" name="viewport" content="width=device-width, initial-scale=1">
<!-- Favicons--> <!-- Favicons-->
@ -30,14 +30,14 @@
{# Chrome 39 for Android colour #} {# Chrome 39 for Android colour #}
<meta name="theme-color" content="#FFBB33"> <meta name="theme-color" content="#FFBB33">
{% if og_image %} {% if og_image %}
<meta property="og:image" content="{{ request.build_absolute_uri(og_image) }}"> <meta property="og:image" content="{{ request.build_absolute_uri(og_image) }}">
{% endif %} {% endif %}
{% block og_title %}{% endblock %} {% block og_title %}{% endblock %}
<meta property="og:site_name" content="{{ SITE_LONG_NAME }}"> <meta property="og:site_name" content="{{ SITE_LONG_NAME }}">
<meta property="og:url" <meta property="og:url"
content="{{ DMOJ_SCHEME }}://{{ DMOJ_CANONICAL|default(site.domain) }}{{ request.get_full_path() }}"> content="{{ DMOJ_SCHEME }}://{{ DMOJ_CANONICAL|default(site.domain) }}{{ request.get_full_path() }}">
{% if meta_description %} {% if meta_description %}
<meta property="og:description" content="{{ meta_description }}"> <meta property="og:description" content="{{ meta_description }}">
{% endif %} {% endif %}
<!--[if lt IE 9]> <!--[if lt IE 9]>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
@ -45,337 +45,337 @@
<![endif]--> <![endif]-->
{% block meta %}{% endblock %} {% block meta %}{% endblock %}
{% if not INLINE_FONTAWESOME %} {% if not INLINE_FONTAWESOME %}
<link rel="stylesheet" href="{{ FONTAWESOME_CSS }}"> <link rel="stylesheet" href="{{ FONTAWESOME_CSS }}">
{% endif %} {% endif %}
<link rel="stylesheet" type="text/css" href="{{ static('markdown.css') }}"> <link rel="stylesheet" type="text/css" href="{{ static('markdown.css') }}">
{% compress css %} {% compress css %}
<link rel="stylesheet" href="{{ static('style.css') }}"> <link rel="stylesheet" href="{{ static('style.css') }}">
{% if PYGMENT_THEME %} {% if PYGMENT_THEME %}
<link rel="stylesheet" href="{{ static(PYGMENT_THEME) }}"> <link rel="stylesheet" href="{{ static(PYGMENT_THEME) }}">
{% endif %}{% if INLINE_FONTAWESOME %} {% endif %}{% if INLINE_FONTAWESOME %}
<link rel="stylesheet" href="{{ static('libs/fontawesome/font-awesome.css') }}">{% endif %} <link rel="stylesheet" href="{{ static('libs/fontawesome/font-awesome.css') }}">{% endif %}
<link rel="stylesheet" type="text/css" href="{{ static('libs/featherlight/featherlight.min.css') }}"> <link rel="stylesheet" type="text/css" href="{{ static('libs/featherlight/featherlight.min.css') }}">
<link rel="stylesheet" type="text/css" href="{{ static('libs/clipboard/tooltip.css') }}"> <link rel="stylesheet" type="text/css" href="{{ static('libs/clipboard/tooltip.css') }}">
<link rel="stylesheet" type="text/css" href="{{ static('libs/select2/select2.css') }}"> <link rel="stylesheet" type="text/css" href="{{ static('libs/select2/select2.css') }}">
<link rel="stylesheet" type="text/css" href="{{ static('icofont/icofont.min.css') }}"> <link rel="stylesheet" type="text/css" href="{{ static('icofont/icofont.min.css') }}">
{% endcompress %} {% endcompress %}
<link rel="canonical" <link rel="canonical"
href="{{ DMOJ_SCHEME }}://{{ DMOJ_CANONICAL|default(site.domain) }}{{ request.get_full_path() }}"> href="{{ DMOJ_SCHEME }}://{{ DMOJ_CANONICAL|default(site.domain) }}{{ request.get_full_path() }}">
{% if request.user.is_impersonate %} {% if request.user.is_impersonate %}
<style> <style>
#nav-container { #nav-container {
background: #893e89 !important; background: #893e89 !important;
} }
</style> </style>
{% endif %} {% endif %}
{% block media %}{% endblock %} {% block media %}{% endblock %}
{% if use_darkmode %} {% if use_darkmode %}
{% compress css %} {% compress css %}
<link rel="stylesheet" href="{{ static('darkmode.css') }}"> <link rel="stylesheet" href="{{ static('darkmode.css') }}">
<link rel="stylesheet" href="{{ static('darkmode-svg.css') }}"> <link rel="stylesheet" href="{{ static('darkmode-svg.css') }}">
{% endcompress %} {% endcompress %}
{% endif %} {% endif %}
{% if not INLINE_JQUERY %} {% if not INLINE_JQUERY %}
<script src="{{ JQUERY_JS }}"></script> <script src="{{ JQUERY_JS }}"></script>
{% endif %} {% endif %}
<script src="https://unpkg.com/@popperjs/core@2"></script> <script src="https://unpkg.com/@popperjs/core@2"></script>
{% compress js %} {% compress js %}
<script>{{ inlinei18n(LANGUAGE_CODE)|safe }}</script> <script>{{ inlinei18n(LANGUAGE_CODE)|safe }}</script>
{% if INLINE_JQUERY %} {% if INLINE_JQUERY %}
<script src="{{ static('libs/jquery-3.4.1.min.js') }}"></script> <script src="{{ static('libs/jquery-3.4.1.min.js') }}"></script>
{% endif %} {% endif %}
<script src="{{ static('libs/jquery-cookie.js') }}"></script> <script src="{{ static('libs/jquery-cookie.js') }}"></script>
<script src="{{ static('libs/jquery-taphold.js') }}"></script> <script src="{{ static('libs/jquery-taphold.js') }}"></script>
<script src="{{ static('libs/jquery.unveil.js') }}"></script> <script src="{{ static('libs/jquery.unveil.js') }}"></script>
<script src="{{ static('libs/moment.js') }}"></script> <script src="{{ static('libs/moment.js') }}"></script>
<script src="{{ static('libs/select2/select2.js') }}"></script> <script src="{{ static('libs/select2/select2.js') }}"></script>
{% include "extra_js.html" %} {% include "extra_js.html" %}
<script src="{{ static('common.js') }}"></script> <script src="{{ static('common.js') }}"></script>
<script src="{{ static('libs/clipboard/tooltip.js') }}"></script> <script src="{{ static('libs/clipboard/tooltip.js') }}"></script>
<script> <script>
moment.locale('{{ LANGUAGE_CODE }}'); moment.locale('{{ LANGUAGE_CODE }}');
$(function () { $(function () {
$('img.unveil').unveil(200); $('img.unveil').unveil(200);
}); });
const loading_page = `{% include "loading-page.html" %}`; const loading_page = `{% include "loading-page.html" %}`;
</script> </script>
{% endcompress %} {% endcompress %}
{% block js_media %}{% endblock %} {% block js_media %}{% endblock %}
{% if request.in_contest %} {% if request.in_contest %}
<script>$(function () { <script>$(function () {
if ($("#contest-time-remaining").length) { if ($("#contest-time-remaining").length) {
count_down($("#contest-time-remaining")); count_down($("#contest-time-remaining"));
} }
var selected = null, var selected = null,
x_pos = 0, y_pos = 0, x_pos = 0, y_pos = 0,
x_elem = 0, y_elem = 0; x_elem = 0, y_elem = 0;
$('#contest-info').mousedown(function () { $('#contest-info').mousedown(function () {
selected = $(this); selected = $(this);
x_elem = x_pos - selected.offset().left; x_elem = x_pos - selected.offset().left;
y_elem = y_pos - (selected.offset().top - $(window).scrollTop()); y_elem = y_pos - (selected.offset().top - $(window).scrollTop());
return false; return false;
});
if (localStorage.getItem("contest_timer_position")) {
data = localStorage.getItem("contest_timer_position").split(":");
$("#contest-info").css({
left: data[0],
top: data[1]
});
}
$("#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;
if (selected !== null) {
left_px = (x_pos - x_elem);
top_px = (y_pos - y_elem);
left_px = Math.max(Math.min(left_px, window.innerWidth), 0) / window.innerWidth * 100 + '%';
top_px = Math.max(Math.min(top_px, window.innerHeight), 0) / window.innerHeight * 100 + '%';
localStorage.setItem("contest_timer_position", left_px + ":" + top_px);
selected.css({
left: left_px,
top: top_px
});
}
});
$(document).mouseup(function () {
selected = null;
})
}); });
</script>
if (localStorage.getItem("contest_timer_position")) {
data = localStorage.getItem("contest_timer_position").split(":");
$("#contest-info").css({
left: data[0],
top: data[1]
});
}
$("#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;
if (selected !== null) {
left_px = (x_pos - x_elem);
top_px = (y_pos - y_elem);
left_px = Math.max(Math.min(left_px, window.innerWidth), 0) / window.innerWidth * 100 + '%';
top_px = Math.max(Math.min(top_px, window.innerHeight), 0) / window.innerHeight * 100 + '%';
localStorage.setItem("contest_timer_position", left_px + ":" + top_px);
selected.css({
left: left_px,
top: top_px
});
}
});
$(document).mouseup(function () {
selected = null;
})
});
</script>
{% endif %} {% endif %}
{% if request.user.is_authenticated %} {% if request.user.is_authenticated %}
<script> <script>
window.user = { window.user = {
email: '{{ request.user.email|escapejs }}', email: '{{ request.user.email|escapejs }}',
id: '{{ request.user.id|escapejs }}', id: '{{ request.user.id|escapejs }}',
name: '{{ request.user.username|escapejs }}' name: '{{ request.user.username|escapejs }}'
}; };
</script> </script>
{% else %} {% else %}
<script>window.user = {};</script> <script>window.user = {};</script>
{% endif %} {% endif %}
{% if misc_config.analytics %} {% if misc_config.analytics %}
{{ misc_config.analytics|safe }} {{ misc_config.analytics|safe }}
{% endif %} {% endif %}
{# Don't run userscript since it may be malicious #} {# Don't run userscript since it may be malicious #}
{% if request.user.is_authenticated and request.profile.user_script and not request.user.is_impersonate %} {% if request.user.is_authenticated and request.profile.user_script and not request.user.is_impersonate %}
<script type="text/javascript">{{ request.profile.user_script|safe }}</script> <script type="text/javascript">{{ request.profile.user_script|safe }}</script>
{% endif %} {% endif %}
<noscript> <noscript>
<style> <style>
#content { #content {
margin: 80px auto auto; margin: 80px auto auto;
} }
#navigation { #navigation {
top: 27px; top: 27px;
} }
</style> </style>
</noscript> </noscript>
</head> </head>
<body> <body>
<svg width="0" height="0" style="display: block"> <svg width="0" height="0" style="display: block">
<defs> <defs>
<clipPath id="rating-clip"><circle cx="8" cy="8" r="7"/></clipPath> <clipPath id="rating-clip"><circle cx="8" cy="8" r="7"/></clipPath>
</defs> </defs>
</svg> </svg>
<nav id="navigation" class="unselectable"> <nav id="navigation" class="unselectable">
<div id="nav-container"> <div id="nav-container">
<a id="navicon" href="javascript:void(0)"><i class="fa fa-bars"></i></a> <a id="navicon" href="javascript:void(0)"><i class="fa fa-bars"></i></a>
<ul id="nav-list"> <ul id="nav-list">
<li class="home-nav-element"><a href="{{ url('home') }}">{% include "site-logo-fragment.html" %}</a></li> <li class="home-nav-element"><a href="{{ url('home') }}">{% include "site-logo-fragment.html" %}</a></li>
<li class="home-nav-element"><span class="nav-divider"></span></li> <li class="home-nav-element"><span class="nav-divider"></span></li>
<li class="home-menu-item"><a href="{{ url('home') }}" class="nav-home">{{ _('Home') }}</a></li> <li class="home-menu-item"><a href="{{ url('home') }}" class="nav-home">{{ _('Home') }}</a></li>
{% for node in mptt_tree(nav_bar) recursive %} {% for node in mptt_tree(nav_bar) recursive %}
<li> <li>
<a href="{{ node.path }}" class="nav-{{ node.key }}{% if node.key in nav_tab %} active{% endif %}"> <a href="{{ node.path }}" class="nav-{{ node.key }}{% if node.key in nav_tab %} active{% endif %}">
{{ user_trans(node.label) }} {{ user_trans(node.label) }}
{% if not node.is_leaf_node %} {% if not node.is_leaf_node %}
<div href="javascript:void(0)" class="nav-expand">></div> <div href="javascript:void(0)" class="nav-expand">></div>
{% endif %} {% endif %}
</a> </a>
{% with children=node.get_children() %} {% with children=node.get_children() %}
{% if children %}<ul>{{ loop(children) }}</ul>{% endif %} {% if children %}<ul>{{ loop(children) }}</ul>{% endif %}
{% endwith %} {% endwith %}
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
<div style="float: right; display: inline-flex; font-size: larger; align-items: center; height: 100%;"> <div style="float: right; display: inline-flex; font-size: larger; align-items: center; height: 100%;">
<span class="navbar-icons"> <span class="navbar-icons">
{% if request.user.is_authenticated %}
<span title="{{_('Chat')}}">
<a id="chat-icon" href="{{ url('chat', '') }}" class="icofont-wechat navbar-icon" aria-hidden="true">
{% set unread_chat = request.profile.count_unread_chat_boxes %}
{% if unread_chat %}
<sub class="unread_boxes">{{unread_chat}}</sub>
{% endif %}
</a>
</span>
{% set unseen_cnt = request.profile.count_unseen_notifications %}
<span title="{{_('Notification')}}" class="{{ 'notification-open' if unseen_cnt > 0 }}">
<a href="{{ url('notification') }}" class="icofont-alarm navbar-icon" id="notification" aria-hidden="true">
{% if unseen_cnt > 0 %}
<sub class="unread_boxes">{{unseen_cnt}}</sub>
{% endif %}
</a>
</span>
{% endif %}
<span title="{{_('Language')}}">
<a class="icofont-globe navbar-icon" id="nav-lang-icon" aria-hidden="true">
<sub class="sub-lang">{{LANGUAGE_CODE}}</sub>
</a>
<div id="lang-dropdown" class="dropdown" role="tooltip">
{% for language in language_info_list(LANGUAGES) %}
<div value="{{ language.code }}"
class="dropdown-item lang-dropdown-item" style="{{'font-weight: bold' if language.code == LANGUAGE_CODE}}">
{{ language.name_local }}
</div>
{% endfor %}
</div>
</span>
<span title="{{_('Dark Mode')}}">
<a class="icofont-adjust navbar-icon black" id="nav-darkmode-icon" aria-hidden="true" href="?darkmode=1"></a>
</span>
</span>
{% if request.user.is_authenticated %} {% if request.user.is_authenticated %}
<span id="user-links"> <span title="{{_('Chat')}}">
<ul><li><a href="javascript:void(0)"> <a id="chat-icon" href="{{ url('chat', '') }}" class="icofont-wechat navbar-icon" aria-hidden="true">
<span> {% set unread_chat = request.profile.count_unread_chat_boxes %}
<img src="{{ gravatar(request.user, 32) }}" height="24" width="24">{# -#} {% if unread_chat %}
<span> <sub class="unread_boxes">{{unread_chat}}</sub>
<b class="{{request.profile.css_class}}">{{ request.user.username }}</b> {% endif %}
</span> </a>
</span> </span>
</a></li></ul>
</span> {% set unseen_cnt = request.profile.count_unseen_notifications %}
<div class="dropdown" id="userlink_dropdown" role="tooptip"> <span title="{{_('Notification')}}" class="{{ 'notification-open' if unseen_cnt > 0 }}">
<div class="dropdown-item"><a href="{{ url('user_page') }}">{{ _('Profile') }}</a></div> <a href="{{ url('notification') }}" class="icofont-alarm navbar-icon" id="notification" aria-hidden="true">
{% if request.user.is_staff or request.user.is_superuser %} {% if unseen_cnt > 0 %}
<div class="dropdown-item"><a href="{{ url('admin:index') }}">{{ _('Admin') }}</a></div> <sub class="unread_boxes">{{unseen_cnt}}</sub>
{% endif %} {% endif %}
{% if request.user.is_superuser %} </a>
<div class="dropdown-item"><a href="{{ url('internal_problem') }}">{{ _('Internal') }}</a></div> </span>
<div class="dropdown-item"><a href="{{ url('site_stats') }}">{{ _('Stats') }}</a></div>
{% endif %}
<div class="dropdown-item"><a href="{{ url('user_edit_profile') }}">{{ _('Edit profile') }}</a></div>
{% if request.user.is_impersonate %}
<div class="dropdown-item"><a href="{{ url('impersonate-stop') }}">Stop impersonating</a></div>
{% else %}
<div class="dropdown-item">
<a href="#" id="logout" class="red">{{ _('Log out') }}</a>
<form id="logout-form" action="{{ url('auth_logout') }}" method="POST">
{% csrf_token %}
</form>
</div>
{% endif %}
</div>
{% else %}
<span class="anon">
<a href="{{ url('auth_login') }}?next={{ LOGIN_RETURN_PATH|urlencode }}"><b>{{ _('Log in') }}</b></a>
&nbsp;{{ _('or') }}&nbsp;
<a href="{{ url('registration_register') }}"><b>{{ _('Sign up') }}</b></a>
</span>
{% endif %} {% endif %}
<span title="{{_('Language')}}">
<a class="icofont-globe navbar-icon" id="nav-lang-icon" aria-hidden="true">
<sub class="sub-lang">{{LANGUAGE_CODE}}</sub>
</a>
<div id="lang-dropdown" class="dropdown" role="tooltip">
{% for language in language_info_list(LANGUAGES) %}
<div value="{{ language.code }}"
class="dropdown-item lang-dropdown-item" style="{{'font-weight: bold' if language.code == LANGUAGE_CODE}}">
{{ language.name_local }}
</div>
{% endfor %}
</div>
</span>
<span title="{{_('Dark Mode')}}">
<a class="icofont-adjust navbar-icon black" id="nav-darkmode-icon" aria-hidden="true" href="?darkmode=1"></a>
</span>
</span>
{% if request.user.is_authenticated %}
<span id="user-links">
<ul><li><a href="javascript:void(0)">
<span>
<img src="{{ gravatar(request.user, 32) }}" height="24" width="24">{# -#}
<span>
<b class="{{request.profile.css_class}}">{{ request.user.username }}</b>
</span>
</span>
</a></li></ul>
</span>
<div class="dropdown" id="userlink_dropdown" role="tooptip">
<div class="dropdown-item"><a href="{{ url('user_page') }}">{{ _('Profile') }}</a></div>
{% if request.user.is_staff or request.user.is_superuser %}
<div class="dropdown-item"><a href="{{ url('admin:index') }}">{{ _('Admin') }}</a></div>
{% endif %}
{% if request.user.is_superuser %}
<div class="dropdown-item"><a href="{{ url('internal_problem') }}">{{ _('Internal') }}</a></div>
<div class="dropdown-item"><a href="{{ url('site_stats') }}">{{ _('Stats') }}</a></div>
{% endif %}
<div class="dropdown-item"><a href="{{ url('user_edit_profile') }}">{{ _('Edit profile') }}</a></div>
{% if request.user.is_impersonate %}
<div class="dropdown-item"><a href="{{ url('impersonate-stop') }}">Stop impersonating</a></div>
{% else %}
<div class="dropdown-item">
<a href="#" id="logout" class="red">{{ _('Log out') }}</a>
<form id="logout-form" action="{{ url('auth_logout') }}" method="POST">
{% csrf_token %}
</form>
</div>
{% endif %}
</div>
{% else %}
<span class="anon">
<a href="{{ url('auth_login') }}?next={{ LOGIN_RETURN_PATH|urlencode }}"><b>{{ _('Log in') }}</b></a>
&nbsp;{{ _('or') }}&nbsp;
<a href="{{ url('registration_register') }}"><b>{{ _('Sign up') }}</b></a>
</span>
{% endif %}
</div> </div>
</div> </div>
<div id="nav-shadow"></div> <div id="nav-shadow"></div>
</nav> </nav>
{% if request.in_contest %} {% if request.in_contest %}
<div id="contest-info"> <div id="contest-info">
<div id="contest-info-main"> <div id="contest-info-main">
<a href="{{ url('contest_view', request.participation.contest.key) }}" style="vertical-align: middle; display: inline"> <a href="{{ url('contest_view', request.participation.contest.key) }}" style="vertical-align: middle; display: inline">
{{ request.participation.contest.name }} - {{ request.participation.contest.name }} -
{% if request.participation.spectate %} {% if request.participation.spectate %}
{{ _('spectating') }} {{ _('spectating') }}
{% elif request.participation.end_time %} {% elif request.participation.end_time %}
<div id="contest-time-remaining" data-secs="{{request.participation.end_time}}"> <div id="contest-time-remaining" data-secs="{{request.participation.end_time}}">
{{ request.participation.time_remaining|timedelta("localized") }} {{ request.participation.time_remaining|timedelta("localized") }}
</div> </div>
{% else %} {% else %}
{{ _('virtual') }} {{ _('virtual') }}
{% endif %} {% endif %}
</a> </a>
</div> </div>
<div id="contest-info-toggle" class="{{'contest-info-toggle-mode-on' if request.contest_mode else 'contest-info-toggle-mode-off'}}"> <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 %} {% if request.contest_mode %}
<i class="fa fa-toggle-on white"></i> {{_('Compete')}} <i class="fa fa-toggle-on white"></i> {{_('Compete')}}
{% else %} {% else %}
<i class="fa fa-toggle-off white"></i> {{_('General')}} <i class="fa fa-toggle-off white"></i> {{_('General')}}
{% endif %} {% endif %}
</div> </div>
</div> </div>
{% endif %} {% endif %}
<div id="page-container"> <div id="page-container">
<noscript> <noscript>
<div id="noscript">{{ _('This site works best with JavaScript enabled.') }}</div> <div id="noscript">{{ _('This site works best with JavaScript enabled.') }}</div>
</noscript> </noscript>
<br> <br>
<main id="content"> <main id="content">
{% block title_row %} {% block title_row %}
<h2 class="title-row"> <h2 class="title-row">
{% block content_title %} {% block content_title %}
{% if content_title %}{{ content_title }}{% else %}{{ title }}{% endif %} {% if content_title %}{{ content_title }}{% else %}{{ title }}{% endif %}
{% endblock %} {% endblock %}
</h2> </h2>
{% endblock %} {% endblock %}
{% block header %}{% endblock %} {% block header %}{% endblock %}
{% block title_ruler %} {% block title_ruler %}
<hr> <hr>
{% endblock %} {% endblock %}
<div id="content-body">{% block body %}{% endblock %}</div> <div id="content-body">{% block body %}{% endblock %}</div>
</main> </main>
{% if i18n_config.announcement %} {% if i18n_config.announcement %}
<div id="announcement">{{ i18n_config.announcement|safe }}</div> <div id="announcement">{{ i18n_config.announcement|safe }}</div>
{% endif %} {% endif %}
{% block bodyend %}{% endblock %} {% block bodyend %}{% endblock %}
{% block footer %} {% block footer %}
<footer> <footer>
<span id="footer-content"> <span id="footer-content">
<br> <br>
<a class="background-footer" target="_blank" href="https://dmoj.ca">proudly powered by <b>DMOJ</b></a><a target="_blank" href="https://github.com/LQDJudge/online-judge"> | developed by LQDJudge team</a> | <a class="background-footer" target="_blank" href="https://dmoj.ca">proudly powered by <b>DMOJ</b></a><a target="_blank" href="https://github.com/LQDJudge/online-judge"> | developed by LQDJudge team</a> |
{% if i18n_config.footer %} {% if i18n_config.footer %}
{{ i18n_config.footer|safe }} | {{ i18n_config.footer|safe }} |
{% endif %} {% endif %}
<form action="{{ url('set_language') }}" method="post" style="display: inline" id="form-lang"> <form action="{{ url('set_language') }}" method="post" style="display: inline" id="form-lang">
{% csrf_token %} {% csrf_token %}
<input name="next" type="hidden" value="{{ request.get_full_path() }}"> <input name="next" type="hidden" value="{{ request.get_full_path() }}">
<select name="language" onchange="form.submit()" style="height: 1.5em"> <select name="language" onchange="form.submit()" style="height: 1.5em">
{% for language in language_info_list(LANGUAGES) %} {% for language in language_info_list(LANGUAGES) %}
<option value="{{ language.code }}" {% if language.code == LANGUAGE_CODE %}selected{% endif %}> <option value="{{ language.code }}" {% if language.code == LANGUAGE_CODE %}selected{% endif %}>
{{ language.name_local }} ({{ language.code }}) {{ language.name_local }} ({{ language.code }})
</option> </option>
{% endfor %} {% endfor %}
</select> </select>
</form> </form>
</span> </span>
</footer> </footer>
{% endblock %} {% endblock %}
</div> </div>
<link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Fira+Code&family=Noto+Sans&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Fira+Code&family=Noto+Sans&display=swap" rel="stylesheet">
</body> </body>
</html> </html>

View file

@ -1,13 +1,13 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block js_media %} {% block js_media %}
{% include "comments/media-js.html" %} {% include "comments/media-js.html" %}
{% include "actionbar/media-js.html" %} {% include "actionbar/media-js.html" %}
{% endblock %} {% endblock %}
{% block media %} {% block media %}
{% include "comments/media-css.html" %} {% include "comments/media-css.html" %}
{% include "actionbar/media-css.html" %} {% include "actionbar/media-css.html" %}
{% endblock %} {% endblock %}
{% block title_row %} {% block title_row %}
@ -17,41 +17,41 @@
{% endblock %} {% endblock %}
{% block body %} {% block body %}
<div class="post-full"> <div class="post-full">
<div class="post-title">{{ title }}</div> <div class="post-title">{{ title }}</div>
<div class="time"> <div class="time">
{% with authors=post.authors.all() %} {% with authors=post.authors.all() %}
{% if authors %} {% if authors %}
<span class="post-authors">{{ link_users(authors) }}</span> <span class="post-authors">{{ link_users(authors) }}</span>
{% endif %} {% endif %}
{% endwith %} {% endwith %}
<span class="post-time"> <span class="post-time">
{% trans time=post.publish_on|date(_("N j, Y, g:i a")) %} posted on {{ time }}{% endtrans %} {% trans time=post.publish_on|date(_("N j, Y, g:i a")) %} posted on {{ time }}{% endtrans %}
</span> </span>
{% if post.is_editable_by(request.user) %} {% if post.is_editable_by(request.user) %}
<span> [<a href="{{ url('admin:judge_blogpost_change', post.id) }}">{{ _('Edit') }}</a>]</span> <span> [<a href="{{ url('admin:judge_blogpost_change', post.id) }}">{{ _('Edit') }}</a>]</span>
{% endif %} {% endif %}
{% if valid_user_to_show_edit %} {% if valid_user_to_show_edit %}
{% for org in valid_org_to_show_edit %} {% for org in valid_org_to_show_edit %}
<span> [<a href="{{ url('edit_organization_blog', org.id , org.slug , post.id) }}">{{ _('Edit in') }} {{org.slug}}</a>]</span> <span> [<a href="{{ url('edit_organization_blog', org.id , org.slug , post.id) }}">{{ _('Edit in') }} {{org.slug}}</a>]</span>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</div>
<div class="body content-description">
{% cache 86400 'post_content' post.id MATH_ENGINE %}
{{ post.content|markdown|reference|str|safe}}
{% endcache %}
</div>
{% include "actionbar/list.html" %}
</div> </div>
<hr style="width: 60%; margin:4em auto;"> <div class="body content-description">
{% include "comments/list.html" %} {% cache 86400 'post_content' post.id MATH_ENGINE %}
{{ post.content|markdown|reference|str|safe}}
{% endcache %}
</div>
{% include "actionbar/list.html" %}
</div>
<hr style="width: 60%; margin:4em auto;">
{% include "comments/list.html" %}
{% endblock %} {% endblock %}
{% block bodyend %} {% block bodyend %}
{{ super() }} {{ super() }}
{% if REQUIRE_JAX %} {% if REQUIRE_JAX %}
{% include "mathjax-load.html" %} {% include "mathjax-load.html" %}
{% endif %} {% endif %}
{% include "comments/math.html" %} {% include "comments/math.html" %}
{% endblock %} {% endblock %}

View file

@ -1,52 +1,52 @@
<section class="{% if post.sticky %}sticky {% endif %}blog-box"> <section class="{% if post.sticky %}sticky {% endif %}blog-box">
<div style="margin-bottom: 0.5em"> <div style="margin-bottom: 0.5em">
<span class="time"> <span class="time">
{% with authors=post.authors.all() %} {% with authors=post.authors.all() %}
{%- if authors -%} {%- if authors -%}
<img src="{{gravatar(authors[0])}}" style="width: 1.5em; border-radius: 50%; margin-bottom: -0.3em"> <img src="{{gravatar(authors[0])}}" style="width: 1.5em; border-radius: 50%; margin-bottom: -0.3em">
<span class="post-authors">{{ link_users(authors) }}</span> <span class="post-authors">{{ link_users(authors) }}</span>
{%- endif -%} {%- endif -%}
{% endwith %} {% endwith %}
&#8226; &#8226;
{{ relative_time(post.publish_on, abs=_('on {time}'), rel=_('{time}')) -}} {{ relative_time(post.publish_on, abs=_('on {time}'), rel=_('{time}')) -}}
{%- if post.sticky %} &#8226; {%- if post.sticky %} &#8226;
<i title="Sticky" class="fa fa-star fa-fw"></i>{% endif -%} <i title="Sticky" class="fa fa-star fa-fw"></i>{% endif -%}
{% if post.is_organization_private and show_organization_private_icon %} {% if post.is_organization_private and show_organization_private_icon %}
&#8226; &#8226;
<span> <span>
{% for org in post.organizations.all() %} {% for org in post.organizations.all() %}
<span class="organization-tag" style="display: inherit;"> <span class="organization-tag" style="display: inherit;">
<a href="{{ org.get_absolute_url() }}"> <a href="{{ org.get_absolute_url() }}">
<i class="fa fa-lock"></i> {{ org.name }} <i class="fa fa-lock"></i> {{ org.name }}
</a> </a>
</span> </span>
{% endfor %} {% endfor %}
</span>
{% endif %}
</span> </span>
<span style="float: right"> {% endif %}
<a href="{{ url('blog_post', post.id, post.slug) }}#comments" class="blog-comment-count-link"> </span>
<i class="fa fa-comments blog-comment-icon"></i> <span style="float: right">
<span class="blog-comment-count"> <a href="{{ url('blog_post', post.id, post.slug) }}#comments" class="blog-comment-count-link">
{{- post_comment_counts[post.id] or 0 -}} <i class="fa fa-comments blog-comment-icon"></i>
</span> <span class="blog-comment-count">
</a> {{- post_comment_counts[post.id] or 0 -}}
</span> </span>
</a>
</span>
</div>
<h2 class="title">
<a href="{{ url('blog_post', post.id, post.slug) }}">{{ post.title }}</a>
</h2>
<div class="blog-description">
<div class="summary content-description">
{% cache 86400 'post_summary' post.id %}
{{ post.summary|default(post.content, true)|markdown(lazy_load=True)|reference|str|safe }}
{% endcache %}
</div> </div>
<h2 class="title"> {% set pagevote = post.pagevote %}
<a href="{{ url('blog_post', post.id, post.slug) }}">{{ post.title }}</a> {% set bookmark = post.bookmark %}
</h2> {% set hide_actionbar_comment = True %}
<div class="blog-description"> {% set include_hr = True %}
<div class="summary content-description"> {% set share_url = request.build_absolute_uri(post.get_absolute_url()) %}
{% cache 86400 'post_summary' post.id %} {% include "actionbar/list.html" %}
{{ post.summary|default(post.content, true)|markdown(lazy_load=True)|reference|str|safe }} </div>
{% endcache %}
</div>
{% set pagevote = post.pagevote %}
{% set bookmark = post.bookmark %}
{% set hide_actionbar_comment = True %}
{% set include_hr = True %}
{% set share_url = request.build_absolute_uri(post.get_absolute_url()) %}
{% include "actionbar/list.html" %}
</div>
</section> </section>

View file

@ -1,34 +1,34 @@
<div class="sidebox dashboard"> <div class="sidebox dashboard">
<h3>Dashboard <i class="fa fa-dashboard"></i> <h3>Dashboard <i class="fa fa-dashboard"></i>
</h3> </h3>
<div class="sidebox-content"> <div class="sidebox-content">
<div class="user-gravatar"> <div class="user-gravatar">
<img src="{{ gravatar(request.user, 135) }}" <img src="{{ gravatar(request.user, 135) }}"
alt="gravatar" width="135px" height="135px"> alt="gravatar" width="135px" height="135px">
</div>
<div class="recently-attempted">
<h4>Recently attempted problems</h4>
<ul>
{% for code, name, problem_points, user_points, s_date in recently_attempted_problems %}
<li>
<a href="{{ url('problem_detail', code) }}">{{ name }}</a>
[<a href="{{ url('user_submissions', code, request.user.username }}">
{{- user_points }}/{{ problem_points|floatformat }}</a>]
<span class="time">
<span data-unix="{{ submission.date|utc|date("c") }}"
class="recent-time moment-time-toggle">
{% trans time=submission.date|date(_("N j, Y, g:i a")) %}
on {{ time }}
{% endtrans %}
</span>
</span>
</li>
{% endfor %}
</ul>
</div>
<div class="recommended-problems">
<h4>Recommended problems</h4><i>Coming soon.</i>
</div>
</div> </div>
<div class="recently-attempted">
<h4>Recently attempted problems</h4>
<ul>
{% for code, name, problem_points, user_points, s_date in recently_attempted_problems %}
<li>
<a href="{{ url('problem_detail', code) }}">{{ name }}</a>
[<a href="{{ url('user_submissions', code, request.user.username }}">
{{- user_points }}/{{ problem_points|floatformat }}</a>]
<span class="time">
<span data-unix="{{ submission.date|utc|date("c") }}"
class="recent-time moment-time-toggle">
{% trans time=submission.date|date(_("N j, Y, g:i a")) %}
on {{ time }}
{% endtrans %}
</span>
</span>
</li>
{% endfor %}
</ul>
</div>
<div class="recommended-problems">
<h4>Recommended problems</h4><i>Coming soon.</i>
</div>
</div>
</div> </div>

View file

@ -1,115 +1,115 @@
{% extends "three-column-content.html" %} {% extends "three-column-content.html" %}
{% block three_col_media %} {% block three_col_media %}
{% include "blog/media-css.html" %} {% include "blog/media-css.html" %}
{% include "actionbar/media-css.html" %} {% include "actionbar/media-css.html" %}
<style> <style>
@media (max-width: 799px) { @media (max-width: 799px) {
.title { .title {
clear: both; clear: both;
} }
} }
.time { .time {
margin-left: 0; margin-left: 0;
} }
.no-clarifications-message { .no-clarifications-message {
font-style: italic; font-style: italic;
text-align: center; text-align: center;
} }
</style> </style>
{% endblock %} {% endblock %}
{% block three_col_js %} {% block three_col_js %}
{% include "actionbar/media-js.html" %} {% include "actionbar/media-js.html" %}
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function () { $(document).ready(function () {
$('.time-remaining').each(function () { $('.time-remaining').each(function () {
count_down($(this)); count_down($(this));
}); });
$('.right-sidebar').hide(); $('.right-sidebar').hide();
$('#event-tab').click(function (e) { $('#event-tab').click(function (e) {
e.preventDefault(); e.preventDefault();
$('.left-sidebar-item').removeClass('active'); $('.left-sidebar-item').removeClass('active');
$('#event-tab').addClass('active'); $('#event-tab').addClass('active');
$('.middle-content').hide(); $('.middle-content').hide();
$('.right-sidebar').show(); $('.right-sidebar').show();
}); });
}); });
</script> </script>
{% endblock %} {% endblock %}
{% block left_sidebar %} {% block left_sidebar %}
<div class="left-sidebar"> <div class="left-sidebar">
{{ make_tab_item('blog', 'fa fa-rss', url('home'), _('News')) }} {{ make_tab_item('blog', 'fa fa-rss', url('home'), _('News')) }}
{{ make_tab_item('comment', 'fa fa-comments', url('comment_feed'), _('Comments')) }} {{ make_tab_item('comment', 'fa fa-comments', url('comment_feed'), _('Comments')) }}
{{ make_tab_item('ticket', 'fa fa-question-circle', url('ticket_feed'), _('Tickets')) }} {{ make_tab_item('ticket', 'fa fa-question-circle', url('ticket_feed'), _('Tickets')) }}
{{ make_tab_item('event', 'fa fa-calendar', '#', _('Events')) }} {{ make_tab_item('event', 'fa fa-calendar', '#', _('Events')) }}
</div> </div>
{% endblock %} {% endblock %}
{% block middle_content %} {% block middle_content %}
{% set show_organization_private_icon=True %} {% set show_organization_private_icon=True %}
{% if page_type == 'blog' %} {% if page_type == 'blog' %}
{% for post in posts %} {% for post in posts %}
{% include "blog/content.html" %} {% include "blog/content.html" %}
{% endfor %} {% endfor %}
{% elif page_type == 'ticket' %} {% elif page_type == 'ticket' %}
{% if tickets %} {% if tickets %}
{% for ticket in tickets %} {% for ticket in tickets %}
{% include "ticket/feed.html" %} {% include "ticket/feed.html" %}
{% endfor %} {% endfor %}
{% else %} {% else %}
<h3 style="text-align: center">{{_('You have no ticket')}}</h3> <h3 style="text-align: center">{{_('You have no ticket')}}</h3>
{% endif %}
{% elif page_type == 'comment' %}
{% for comment in comments %}
{% include "comments/feed.html" %}
{% endfor %}
{% endif %}
{% if page_obj.num_pages > 1 %}
<div style="margin-bottom:10px;margin-top:10px">{% include "list-pages.html" %}</div>
{% endif %} {% endif %}
{% elif page_type == 'comment' %}
{% for comment in comments %}
{% include "comments/feed.html" %}
{% endfor %}
{% endif %}
{% if page_obj.num_pages > 1 %}
<div style="margin-bottom:10px;margin-top:10px">{% include "list-pages.html" %}</div>
{% endif %}
{% endblock %} {% endblock %}
{% block right_sidebar %} {% block right_sidebar %}
<div class="right-sidebar"> <div class="right-sidebar">
{% if request.in_contest_mode and request.participation.contest.use_clarifications %} {% if request.in_contest_mode and request.participation.contest.use_clarifications %}
<div class="blog-sidebox sidebox"> <div class="blog-sidebox sidebox">
<h3>{{ _('Clarifications') }} <h3>{{ _('Clarifications') }}
<i class="fa fa-question-circle"></i> <i class="fa fa-question-circle"></i>
{% if can_edit_contest %} {% if can_edit_contest %}
<a href="{{url('new_contest_clarification', request.participation.contest.key)}}" <a href="{{url('new_contest_clarification', request.participation.contest.key)}}"
class="fa fa-plus-circle" class="fa fa-plus-circle"
id="add-clarification" id="add-clarification"
title="{{_('Add')}}" title="{{_('Add')}}"
style="color: lightcyan"> style="color: lightcyan">
</a> </a>
{% endif %} {% endif %}
</h3> </h3>
<div class="sidebox-content"> <div class="sidebox-content">
{% if has_clarifications %} {% if has_clarifications %}
<ul> <ul>
{% for clarification in clarifications %} {% for clarification in clarifications %}
<li class="clarification"> <li class="clarification">
<a href="{{ url('problem_detail', clarification.problem.problem.code) }}" <a href="{{ url('problem_detail', clarification.problem.problem.code) }}"
class="problem"> class="problem">
{{ clarification.problem.problem.name }} {{ clarification.problem.problem.name }}
</a> </a>
<span class="time">{{ relative_time(clarification.date) }}</span> <span class="time">{{ relative_time(clarification.date) }}</span>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
{% else %} {% else %}
<p class="no-clarifications-message"> <p class="no-clarifications-message">
{{ _('No clarifications have been made at this time.') }} {{ _('No clarifications have been made at this time.') }}
</p> </p>
{% endif %} {% endif %}
</div> </div>
</div> </div>
{% endif %} {% endif %}
{% include 'contests-countdown.html' %} {% include 'contests-countdown.html' %}
{% include 'recent-organization.html' %} {% include 'recent-organization.html' %}
{% include 'top-users.html' %} {% include 'top-users.html' %}
</div> </div>
{% endblock %} {% endblock %}

View file

@ -1,30 +1,30 @@
<style> <style>
.user-gravatar { .user-gravatar {
display: inline-block; display: inline-block;
padding-right: 15px; padding-right: 15px;
padding-top: 8px; padding-top: 8px;
width: 135px; width: 135px;
} }
.user-gravatar img { .user-gravatar img {
width: 135px; width: 135px;
height: 135px; height: 135px;
display: block; display: block;
border-radius: 6px; border-radius: 6px;
} }
.recently-attempted, .recommended-problems { .recently-attempted, .recommended-problems {
display: inline-block; display: inline-block;
} }
.recently-attempted ul { .recently-attempted ul {
list-style: none; list-style: none;
padding-left: 1em; padding-left: 1em;
padding-right: .5em; padding-right: .5em;
margin: 0.2em; margin: 0.2em;
} }
.recently-attempted h4, .recommended-problems h4 { .recently-attempted h4, .recommended-problems h4 {
font-weight: 500; font-weight: 500;
} }
</style> </style>

File diff suppressed because it is too large Load diff

View file

@ -1,134 +1,134 @@
<style> <style>
footer { footer {
display: none; display: none;
} }
#content { #content {
margin: 2.5em 1em 0 0; margin: 2.5em 1em 0 0;
} }
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 20px; width: 20px;
} }
::-webkit-scrollbar-track { ::-webkit-scrollbar-track {
background-color: transparent; background-color: transparent;
} }
::-webkit-scrollbar-thumb { ::-webkit-scrollbar-thumb {
background-color: #d6dee1; background-color: #d6dee1;
border-radius: 20px; border-radius: 20px;
border: 6px solid transparent; border: 6px solid transparent;
background-clip: content-box; background-clip: content-box;
} }
::-webkit-scrollbar-thumb:hover { ::-webkit-scrollbar-thumb:hover {
background-color: #a8bbbf; background-color: #a8bbbf;
} }
#page-container {
width: 100%;
}
.body-message img{
max-height: 12em;
}
.tooltip:not(.shown) {
display: none;
}
textarea {
resize: none;
}
.tooltip {
left: 120vh !important;
transform: translate(100px, 0) !important;
position: absolute;
}
#loader {
display: block;
margin-left: auto;
margin-right: auto;
width: 4%;
}
.profile-pic {
height: 2.6em;
width: 2.6em;
border-radius: 0.3em;
margin-top: 0.1em;
float: left;
}
.body-message {
padding-left: 3em;
padding-bottom: 0.5em;
border-bottom: 1px dotted lightgray;
}
.user-time {
margin-bottom: 0.3em;
}
.time {
margin-left: 0.5em;
}
.clear {
clear: both;
}
.content-message {
word-wrap: break-word;
}
.content-message p {
margin: 0;
}
#content {
width: 100%;
}
#content-body {
padding-bottom: 0;
}
#page-container {
min-height: 0;
}
.sidebox h3 {
border-radius: 0;
margin: -1px -5.5px 0 -5.8px;
}
.body-block {
border-radius: 4px;
padding: 0.05em 0.6em;
width: 100%;
}
#search-form {
float: inherit;
}
#search-container {
margin-bottom: 0.4em;
}
#setting {
position: relative;
}
@media (min-width: 800px) {
#page-container { #page-container {
width: 100%; position:fixed;
overflow:hidden;
} }
}
.body-message img{ @media (max-width: 799px) {
max-height: 12em; html, body {
max-width: 100%;
overflow-x: hidden;
} }
#mobile ul {
.tooltip:not(.shown) { width: 100%;
display: none;
} }
.info-pic {
textarea { margin-left: 0.5em;
resize: none;
} }
.active-span {
.tooltip { display: none;
left: 120vh !important;
transform: translate(100px, 0) !important;
position: absolute;
}
#loader {
display: block;
margin-left: auto;
margin-right: auto;
width: 4%;
}
.profile-pic {
height: 2.6em;
width: 2.6em;
border-radius: 0.3em;
margin-top: 0.1em;
float: left;
}
.body-message {
padding-left: 3em;
padding-bottom: 0.5em;
border-bottom: 1px dotted lightgray;
}
.user-time {
margin-bottom: 0.3em;
}
.time {
margin-left: 0.5em;
}
.clear {
clear: both;
}
.content-message {
word-wrap: break-word;
}
.content-message p {
margin: 0;
}
#content {
width: 100%;
}
#content-body {
padding-bottom: 0;
}
#page-container {
min-height: 0;
}
.sidebox h3 {
border-radius: 0;
margin: -1px -5.5px 0 -5.8px;
}
.body-block {
border-radius: 4px;
padding: 0.05em 0.6em;
width: 100%;
}
#search-form {
float: inherit;
}
#search-container {
margin-bottom: 0.4em;
}
#setting {
position: relative;
}
@media (min-width: 800px) {
#page-container {
position:fixed;
overflow:hidden;
}
}
@media (max-width: 799px) {
html, body {
max-width: 100%;
overflow-x: hidden;
}
#mobile ul {
width: 100%;
}
.info-pic {
margin-left: 0.5em;
}
.active-span {
display: none;
}
} }
}
</style> </style>

View file

@ -1,30 +1,30 @@
<li class="message" id="message-{{ message.id }}"> <li class="message" id="message-{{ message.id }}">
<a href="{{ url('user_page', message.author.user.username) }}"> <a href="{{ url('user_page', message.author.user.username) }}">
<img src="{{ gravatar(message.author, 135) }}" class="profile-pic"> <img src="{{ gravatar(message.author, 135) }}" class="profile-pic">
</a> </a>
<div class="body-message"> <div class="body-message">
<div class="user-time"> <div class="user-time">
<span class="username {{ message.author.css_class }}"> <span class="username {{ message.author.css_class }}">
<a href="{{ url('user_page', message.author.user.username) }}"> <a href="{{ url('user_page', message.author.user.username) }}">
{{ message.author }} {{ message.author }}
</a> </a>
</span> </span>
<span class="time"> <span class="time">
{{ relative_time(message.time, abs=_('{time}'), rel=_('{time}'), format=_('g:i a d/m/Y')) }} {{ relative_time(message.time, abs=_('{time}'), rel=_('{time}'), format=_('g:i a d/m/Y')) }}
</span> </span>
</div>
<span class="content-message">
<div class="body-block" id="body-block-{{ message.id }}" title="{{ message.time|date('g:i a') }}">
{% if request.user.is_staff %}
<a class="red chatbtn_remove_mess" value="{{message.id}}" style="cursor: pointer;">
{{_('Delete')}}
</a>
{% endif %}
<div class="message-text message-text-other">
{{message.body|markdown(lazy_load=True)|reference|str|safe }}
</div>
</div>
</span>
</div> </div>
<div class="clear"></div> <span class="content-message">
<div class="body-block" id="body-block-{{ message.id }}" title="{{ message.time|date('g:i a') }}">
{% if request.user.is_staff %}
<a class="red chatbtn_remove_mess" value="{{message.id}}" style="cursor: pointer;">
{{_('Delete')}}
</a>
{% endif %}
<div class="message-text message-text-other">
{{message.body|markdown(lazy_load=True)|reference|str|safe }}
</div>
</div>
</span>
</div>
<div class="clear"></div>
</li> </li>

View file

@ -1,12 +1,12 @@
{% if object_list %} {% if object_list %}
<div style="display: none" id="num_pages">{{num_pages}}</div> <div style="display: none" id="num_pages">{{num_pages}}</div>
{% for message in object_list | reverse%} {% for message in object_list | reverse%}
{% include "chat/message.html" %} {% include "chat/message.html" %}
{% endfor %} {% endfor %}
{% else %} {% else %}
<center id="empty_msg">{{_('You are connect now. Say something to start the conversation.')}}</center> <center id="empty_msg">{{_('You are connect now. Say something to start the conversation.')}}</center>
{% endif %} {% endif %}
{% if REQUIRE_JAX %} {% if REQUIRE_JAX %}
{% include "mathjax-load.html" %} {% include "mathjax-load.html" %}
{% endif %} {% endif %}
{% include "comments/math.html" %} {% include "comments/math.html" %}

View file

@ -1,40 +1,40 @@
<li class="status-row" id="lobby_row"> <li class="status-row" id="lobby_row">
<div class="status-container"> <div class="status-container">
<img src="{{ static('icons/logo.png') }}" style="height:1.3em"> <img src="{{ static('icons/logo.png') }}" style="height:1.3em">
</div> </div>
<span style="padding-left:0.5em"> <span style="padding-left:0.5em">
<b>{{_('Lobby')}}</b> <b>{{_('Lobby')}}</b>
</span> </span>
<span class="spacer"> <span class="spacer">
<span class="unread-count" id="unread-count-lobby">{{unread_count_lobby if unread_count_lobby}}</span> <span class="unread-count" id="unread-count-lobby">{{unread_count_lobby if unread_count_lobby}}</span>
</span> </span>
</li> </li>
{% for section in status_sections %} {% for section in status_sections %}
{% if section.user_list %} {% if section.user_list %}
<div class="status-section-title toggle open"> <div class="status-section-title toggle open">
<h4> <h4>
<i class="fa fa-chevron-right fa-fw"></i>{{_(section.title)}} <i class="fa fa-chevron-right fa-fw"></i>{{_(section.title)}}
</h4> </h4>
<hr/> <hr/>
</div> </div>
<ul class="status-list toggled"> <ul class="status-list toggled">
{% for user in section.user_list %} {% for user in section.user_list %}
<li class="click_space status-row" id="click_space_{{user.user.id}}" value="{{user.url}}"> <li class="click_space status-row" id="click_space_{{user.user.id}}" value="{{user.url}}">
<div class="status-container"> <div class="status-container">
<img src="{{ gravatar(user.user, 135) }}" class="status-pic"> <img src="{{ gravatar(user.user, 135) }}" class="status-pic">
<svg style="position:absolute;" height="32" width="32"> <svg style="position:absolute;" height="32" width="32">
<circle class="status-circle" <circle class="status-circle"
fill="{{'green' if user.is_online else 'red'}}"/> fill="{{'green' if user.is_online else 'red'}}"/>
</svg> </svg>
</div> </div>
<span style="padding-left:0.3em" class="username {{ user.user.css_class }}"> <span style="padding-left:0.3em" class="username {{ user.user.css_class }}">
{{ user.user.username }} {{ user.user.username }}
</span> </span>
<span class="spacer"> <span class="spacer">
<span class="unread-count" id="unread-count-{{user.user.id}}">{{user.unread_count if user.unread_count}}</span> <span class="unread-count" id="unread-count-{{user.user.id}}">{{user.unread_count if user.unread_count}}</span>
</span> </span>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
{% endif %} {% endif %}
{% endfor %} {% endfor %}

View file

@ -1,41 +1,41 @@
{% if other_user %} {% if other_user %}
<div class="status-container" style="height: 100%"> <div class="status-container" style="height: 100%">
<img src="{{ gravatar(other_user.user, 135) }}" class="info-pic"> <img src="{{ gravatar(other_user.user, 135) }}" class="info-pic">
<svg style="position:absolute; height:100%; width: 110%"> <svg style="position:absolute; height:100%; width: 110%">
<circle class="info-circle" <circle class="info-circle"
fill="{{'green' if other_online else 'red'}}"/> fill="{{'green' if other_online else 'red'}}"/>
</svg> </svg>
</div> </div>
{% endif %} {% endif %}
<span class="info-name username"> <span class="info-name username">
{% if other_user %} {% if other_user %}
<a href="{{url('user_page', other_user)}}">{{other_user.user.username}}</a> <a href="{{url('user_page', other_user)}}">{{other_user.user.username}}</a>
{% else%} {% else%}
<a href="#" style="margin-left: 3em">{{ _('Lobby') }}</a> <a href="#" style="margin-left: 3em">{{ _('Lobby') }}</a>
{% endif %} {% endif %}
</span> </span>
<span class="spacer"></span> <span class="spacer"></span>
{% if other_user and not other_online %} {% if other_user and not other_online %}
<span class="active-span">{{ relative_time(other_user.last_access, abs=_('Last online on {time}'), rel=_('Online {time}'), format=_('g:i a d/m/Y')) }}</span> <span class="active-span">{{ relative_time(other_user.last_access, abs=_('Last online on {time}'), rel=_('Online {time}'), format=_('g:i a d/m/Y')) }}</span>
{% endif %} {% endif %}
{% if other_user %} {% if other_user %}
<span style="margin-right: 0.3em" id="setting"> <span style="margin-right: 0.3em" id="setting">
<button class="control-button small" style="height:100%;" id="setting-button"> <button class="control-button small" style="height:100%;" id="setting-button">
<i class="fa fa-ellipsis-h"></i> <i class="fa fa-ellipsis-h"></i>
</button> </button>
<div id="setting-content"> <div id="setting-content">
<li> <li>
<a href="{{url('toggle_ignore', other_user.id)}}" class=" {{'green' if is_ignored else 'red'}}"> <a href="{{url('toggle_ignore', other_user.id)}}" class=" {{'green' if is_ignored else 'red'}}">
{% if is_ignored %} {% if is_ignored %}
{{_('Unignore')}} {{_('Unignore')}}
{% else %} {% else %}
{{_('Ignore')}} {{_('Ignore')}}
{% endif %} {% endif %}
</a> </a>
</li> </li>
</div> </div>
</span> </span>
{% else %} {% else %}
<span class="active-span">{{online_count}} {{_('users are online')}}</span> <span class="active-span">{{online_count}} {{_('users are online')}}</span>
{% endif %} {% endif %}

View file

@ -1,14 +1,14 @@
<div class="comment-submit"> <div class="comment-submit">
<form id="comment-edit" action="{{ request.get_full_path() }}" method="post"> <form id="comment-edit" action="{{ request.get_full_path() }}" method="post">
<span style="display: none" class="comment-id">{{ comment.id }}</span> <span style="display: none" class="comment-id">{{ comment.id }}</span>
<span style="display: none" class="read-back">{{ url('comment_content', comment.id) }}</span> <span style="display: none" class="read-back">{{ url('comment_content', comment.id) }}</span>
{% csrf_token %} {% csrf_token %}
{{ form.non_field_errors() }} {{ form.non_field_errors() }}
{{ form.body.errors }} {{ form.body.errors }}
<div class="comment-post-wrapper"> <div class="comment-post-wrapper">
<div id="comment-form-body">{{ form.body }}</div> <div id="comment-form-body">{{ form.body }}</div>
</div> </div>
<hr> <hr>
<input style="float: right" type="submit" value="Post!" class="button"> <input style="float: right" type="submit" value="Post!" class="button">
</form> </form>
</div> </div>

View file

@ -1,13 +1,13 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block media %} {% block media %}
{% compress css %} {% compress css %}
{{ form.media.css }} {{ form.media.css }}
{% endcompress %} {% endcompress %}
{% endblock %} {% endblock %}
{% block js_media %} {% block js_media %}
{{ form.media.js }} {{ form.media.js }}
{% endblock %} {% endblock %}
{% block body %} {% block body %}
<div class="form-area">{% include "comments/edit-ajax.html" %}</div> <div class="form-area">{% include "comments/edit-ajax.html" %}</div>
{% endblock %} {% endblock %}

View file

@ -1,18 +1,18 @@
<div class="blog-box"> <div class="blog-box">
<h3 class="problem-feed-name"> <h3 class="problem-feed-name">
<a href="{{ comment.link }}#comment-{{ comment.id }}"> <a href="{{ comment.link }}#comment-{{ comment.id }}">
{{ page_titles[comment.page] }} {{ page_titles[comment.page] }}
</a> </a>
</h3> </h3>
{% with author=comment.author %} {% with author=comment.author %}
{% if author %} {% if author %}
<div class="problem-feed-info-entry"> <div class="problem-feed-info-entry">
<i class="fa fa-pencil-square-o fa-fw"></i> <i class="fa fa-pencil-square-o fa-fw"></i>
<span class="pi-value">{{ link_user(author) }}</span> <span class="pi-value">{{ link_user(author) }}</span>
</div> </div>
{% endif %} {% endif %}
{% endwith %} {% endwith %}
<div class='blog-description content-description'> <div class='blog-description content-description'>
{{ comment.body|markdown(lazy_load=True)|reference|str|safe }} {{ comment.body|markdown(lazy_load=True)|reference|str|safe }}
</div> </div>
</div> </div>

View file

@ -1,165 +1,165 @@
{% set can_comment = request.user.is_authenticated and comment_form and not comment_lock %} {% set can_comment = request.user.is_authenticated and comment_form and not comment_lock %}
<div id="comments" class="comment-area"> <div id="comments" class="comment-area">
<h2 id="comment-header"> <h2 id="comment-header">
<i style="padding-right: 0.3em" class="fa fa-comments"></i>{{ _('Comments') }} <i style="padding-right: 0.3em" class="fa fa-comments"></i>{{ _('Comments') }}
{% if can_comment %}
<a href="" id="write-comment" style="float: right; font-size: 0.6em; margin-right: -26px;"> {{ _('Write comment') }} </a>
{% endif %}
</h2>
{% if can_comment %} {% if can_comment %}
<div id="new-comment" class="form-area comment-submit" style="display: none;" > <a href="" id="write-comment" style="float: right; font-size: 0.6em; margin-right: -26px;"> {{ _('Write comment') }} </a>
{% block comment_submit_title %} {% endif %}
<h3>{{ _('New comment') }}</h3> </h2>
<hr> {% if can_comment %}
{% endblock %} <div id="new-comment" class="form-area comment-submit" style="display: none;" >
{% if is_new_user %} {% block comment_submit_title %}
<div style="margin-bottom: 0" class="alert alert-info"> <h3>{{ _('New comment') }}</h3>
{{ _('You need to have solved at least one problem before your voice can be heard.') }} <hr>
{% endblock %}
{% if is_new_user %}
<div style="margin-bottom: 0" class="alert alert-info">
{{ _('You need to have solved at least one problem before your voice can be heard.') }}
</div>
{% else %}
<form class="comment-submit-form" action="" method="post">
{% csrf_token %}
{% if comment_form.errors %}
<div id="form-errors">
{{ comment_form.non_field_errors() }}
{{ comment_form.parent.errors }}
{% if comment_form.body.errors %}{{ _('Invalid comment body.') }}{% endif %}
</div>
{% endif %}
{{ comment_form.parent }}
<div class="comment-post-wrapper">
<div id="comment-form-body">{{ comment_form.body }}</div>
</div>
<hr>
<input style="float:right" type="submit" value="{{ _('Post!') }}" class="button">
</form>
{% endif %}
</div>
{% endif %}
{% if has_comments %}
<ul class="comments top-level-comments new-comments">
{% set logged_in = request.user.is_authenticated %}
{% set profile = request.profile if logged_in else None %}
{% for node in mptt_tree(comment_list) recursive %}
<li id="comment-{{ node.id }}" data-revision="{{ node.revisions - 1 }}"
data-max-revision="{{ node.revisions - 1 }}"
data-revision-ajax="{{ url('comment_revision_ajax', node.id) }}" class="comment">
<div class="comment-display{% if node.score <= vote_hide_threshold %} bad-comment{% endif %}">
<div class="info">
<div class="vote">
{% if logged_in %}
<a href="javascript:comment_upvote({{ node.id }})"
class="upvote-link fa fa-chevron-up fa-fw{% if node.vote_score == 1 %} voted{% endif %}"></a>
{% else %}
<a href="javascript:alert('{{ _('Please login to vote')|escapejs }}')" title="{{ _('Please login to vote') }}"
class="upvote-link fa fa-chevron-up fa-fw"></a>
{% endif %}
<br>
<div class="comment-score">{{ node.score }}</div>
{% if logged_in %}
<a href="javascript:comment_downvote({{ node.id }})"
class="downvote-link fa fa-chevron-down fa-fw{% if node.vote_score == -1 %} voted{% endif %}"></a>
{% else %}
<a href="javascript:alert('{{ _('Please login to vote')|escapejs }}')" title="{{ _('Please login to vote') }}"
class="downvote-link fa fa-chevron-down fa-fw"></a>
{% endif %}
</div>
{% with author=node.author, user=node.author.user %}
<a href="{{ url('user_page', user.username) }}" class="user">
<img src="{{ gravatar(author, 135) }}" class="gravatar">
</a>
{% endwith %}
</div>
<div class="detail">
<div class="header">
{{ link_user(node.author) }}&nbsp;
{{ relative_time(node.time, abs=_('commented on {time}'), rel=_('commented {time}')) }}
<span class="comment-spacer"></span>
<span class="comment-operation">
{% if node.revisions > 1 %}
<span class="comment-edits">
<a href="javascript:show_revision({{ node.id }}, -1)"
class="previous-revision">&larr;</a>
<span class="comment-edit-text">
{% if node.revisions > 2 %}
{% trans edits=node.revisions - 1 %}edit {{ edits }}{% endtrans %}
{% else %}
{{ _('edited') }}
{% endif %}
</span>
<a href="javascript:show_revision({{ node.id }}, 1)" style="visibility: hidden"
class="next-revision">&rarr;</a>
</span>
{% else %}
<span class="comment-edits"></span>
{% endif %}
<a href="#comment-{{ node.id }}" title="{{ _('Link') }}" class="comment-link">
<i class="fa fa-link fa-fw"></i>
</a>
{% if logged_in and not comment_lock %}
{% set can_edit = node.author.id == profile.id and not profile.mute %}
{% if can_edit %}
<a data-featherlight="{{ url('comment_edit_ajax', node.id) }}"
href="{{ url('comment_edit', node.id) }}"
title="{{ _('Edit') }}" class="edit-link">
<i class="fa fa-pencil fa-fw"></i>
</a>
{% else %}
<a href="javascript:reply_comment({{ node.id }})"
title="{{ _('Reply') }}">
<i class="fa fa-reply fa-fw"></i>
</a>
{% endif %}
{% if perms.judge.change_comment %}
{% if can_edit %}
<a href="javascript:reply_comment({{ node.id }})"
title="{{ _('Reply') }}"><i class="fa fa-reply fa-fw"></i></a>
{% else %}
<a data-featherlight="{{ url('comment_edit_ajax', node.id) }}"
href="{{ url('comment_edit', node.id) }}" title="{{ _('Edit') }}"
class="edit-link"><i class="fa fa-pencil fa-fw"></i></a>
{% endif %}
<a href="javascript:" title="{{ _('Hide') }}" data-id="{{ node.id }}"
class="hide-comment"><i class="fa fa-trash fa-fw"></i></a>
<a href="{{ url('admin:judge_comment_change', node.id) }}"
title="{{ _('Admin') }}"><i class="fa fa-cog fa-fw"></i></a>
{% endif %}
{% endif %}
</span>
</div>
<div class="content content-description">
<div class="comment-body"{% if node.score <= vote_hide_threshold %} style="display:none"{% endif %}>
{{ node.body|markdown(lazy_load=True)|reference|str|safe }}
</div> </div>
{% else %} {% if node.score <= vote_hide_threshold %}
<form class="comment-submit-form" action="" method="post"> <div class="comment-body bad-comment-body">
{% csrf_token %} <p>
{% if comment_form.errors %} {% trans id=node.id %}
<div id="form-errors"> This comment is hidden due to too much negative feedback.
{{ comment_form.non_field_errors() }} Click <a href="javascript:comment_show_content({{ id }})">here</a> to view it.
{{ comment_form.parent.errors }} {% endtrans %}
{% if comment_form.body.errors %}{{ _('Invalid comment body.') }}{% endif %} </p>
</div> </div>
{% endif %} {% endif %}
{{ comment_form.parent }} </div>
<div class="comment-post-wrapper"> </div>
<div id="comment-form-body">{{ comment_form.body }}</div> </div>
</div> </li>
<hr> <ul id="comment-{{ node.id }}-reply" class="reply-comment" hidden></ul>
<input style="float:right" type="submit" value="{{ _('Post!') }}" class="button"> {% with children=node.get_children() %}
</form> {% if children %}
{% endif %} <ul id="comment-{{ node.id }}-children" class="comments">{{ loop(children) }}</ul>
</div> {% endif %}
{% endif %} {% endwith %}
{% if has_comments %} {% endfor %}
<ul class="comments top-level-comments new-comments"> </ul>
{% set logged_in = request.user.is_authenticated %} {% elif not comment_lock %}
{% set profile = request.profile if logged_in else None %} <p class="no-comments-message">{{ _('There are no comments at the moment.') }}</p>
{% for node in mptt_tree(comment_list) recursive %} {% endif %}
<li id="comment-{{ node.id }}" data-revision="{{ node.revisions - 1 }}"
data-max-revision="{{ node.revisions - 1 }}"
data-revision-ajax="{{ url('comment_revision_ajax', node.id) }}" class="comment">
<div class="comment-display{% if node.score <= vote_hide_threshold %} bad-comment{% endif %}">
<div class="info">
<div class="vote">
{% if logged_in %}
<a href="javascript:comment_upvote({{ node.id }})"
class="upvote-link fa fa-chevron-up fa-fw{% if node.vote_score == 1 %} voted{% endif %}"></a>
{% else %}
<a href="javascript:alert('{{ _('Please login to vote')|escapejs }}')" title="{{ _('Please login to vote') }}"
class="upvote-link fa fa-chevron-up fa-fw"></a>
{% endif %}
<br>
<div class="comment-score">{{ node.score }}</div>
{% if logged_in %}
<a href="javascript:comment_downvote({{ node.id }})"
class="downvote-link fa fa-chevron-down fa-fw{% if node.vote_score == -1 %} voted{% endif %}"></a>
{% else %}
<a href="javascript:alert('{{ _('Please login to vote')|escapejs }}')" title="{{ _('Please login to vote') }}"
class="downvote-link fa fa-chevron-down fa-fw"></a>
{% endif %}
</div>
{% with author=node.author, user=node.author.user %}
<a href="{{ url('user_page', user.username) }}" class="user">
<img src="{{ gravatar(author, 135) }}" class="gravatar">
</a>
{% endwith %}
</div>
<div class="detail">
<div class="header">
{{ link_user(node.author) }}&nbsp;
{{ relative_time(node.time, abs=_('commented on {time}'), rel=_('commented {time}')) }}
<span class="comment-spacer"></span>
<span class="comment-operation">
{% if node.revisions > 1 %}
<span class="comment-edits">
<a href="javascript:show_revision({{ node.id }}, -1)"
class="previous-revision">&larr;</a>
<span class="comment-edit-text">
{% if node.revisions > 2 %}
{% trans edits=node.revisions - 1 %}edit {{ edits }}{% endtrans %}
{% else %}
{{ _('edited') }}
{% endif %}
</span>
<a href="javascript:show_revision({{ node.id }}, 1)" style="visibility: hidden"
class="next-revision">&rarr;</a>
</span>
{% else %}
<span class="comment-edits"></span>
{% endif %}
<a href="#comment-{{ node.id }}" title="{{ _('Link') }}" class="comment-link">
<i class="fa fa-link fa-fw"></i>
</a>
{% if logged_in and not comment_lock %}
{% set can_edit = node.author.id == profile.id and not profile.mute %}
{% if can_edit %}
<a data-featherlight="{{ url('comment_edit_ajax', node.id) }}"
href="{{ url('comment_edit', node.id) }}"
title="{{ _('Edit') }}" class="edit-link">
<i class="fa fa-pencil fa-fw"></i>
</a>
{% else %}
<a href="javascript:reply_comment({{ node.id }})"
title="{{ _('Reply') }}">
<i class="fa fa-reply fa-fw"></i>
</a>
{% endif %}
{% if perms.judge.change_comment %}
{% if can_edit %}
<a href="javascript:reply_comment({{ node.id }})"
title="{{ _('Reply') }}"><i class="fa fa-reply fa-fw"></i></a>
{% else %}
<a data-featherlight="{{ url('comment_edit_ajax', node.id) }}"
href="{{ url('comment_edit', node.id) }}" title="{{ _('Edit') }}"
class="edit-link"><i class="fa fa-pencil fa-fw"></i></a>
{% endif %}
<a href="javascript:" title="{{ _('Hide') }}" data-id="{{ node.id }}"
class="hide-comment"><i class="fa fa-trash fa-fw"></i></a>
<a href="{{ url('admin:judge_comment_change', node.id) }}"
title="{{ _('Admin') }}"><i class="fa fa-cog fa-fw"></i></a>
{% endif %}
{% endif %}
</span>
</div>
<div class="content content-description">
<div class="comment-body"{% if node.score <= vote_hide_threshold %} style="display:none"{% endif %}>
{{ node.body|markdown(lazy_load=True)|reference|str|safe }}
</div>
{% if node.score <= vote_hide_threshold %}
<div class="comment-body bad-comment-body">
<p>
{% trans id=node.id %}
This comment is hidden due to too much negative feedback.
Click <a href="javascript:comment_show_content({{ id }})">here</a> to view it.
{% endtrans %}
</p>
</div>
{% endif %}
</div>
</div>
</div>
</li>
<ul id="comment-{{ node.id }}-reply" class="reply-comment" hidden></ul>
{% with children=node.get_children() %}
{% if children %}
<ul id="comment-{{ node.id }}-children" class="comments">{{ loop(children) }}</ul>
{% endif %}
{% endwith %}
{% endfor %}
</ul>
{% elif not comment_lock %}
<p class="no-comments-message">{{ _('There are no comments at the moment.') }}</p>
{% endif %}
{% if comment_lock %} {% if comment_lock %}
<div class="alert alert-warning comment-lock"> <div class="alert alert-warning comment-lock">
{{ _('Comments are disabled on this page.') }} {{ _('Comments are disabled on this page.') }}
</div> </div>
{% endif %} {% endif %}
</div> </div>

View file

@ -1,3 +1,3 @@
{% compress js, inline %} {% compress js, inline %}
<script src="{{ static('pagedown_math.js') }}"></script> <script src="{{ static('pagedown_math.js') }}"></script>
{% endcompress %} {% endcompress %}

View file

@ -1,3 +1,3 @@
{% compress css %} {% compress css %}
{{ comment_form.media.css }} {{ comment_form.media.css }}
{% endcompress %} {% endcompress %}

View file

@ -1,231 +1,231 @@
<script src="{{ static('libs/featherlight/featherlight.min.js') }}" type="text/javascript"></script> <script src="{{ static('libs/featherlight/featherlight.min.js') }}" type="text/javascript"></script>
{% compress js %} {% compress js %}
{{ comment_form.media.js }} {{ comment_form.media.js }}
{% if not REQUIRE_JAX %} {% if not REQUIRE_JAX %}
<script type="text/javascript">
$(function () {
$('#id_body').keypress(function () {
if (!("MathJax" in window)) {
$.ajax({
type: "GET",
url: '{{ static('mathjax3_config.js') }}',
dataType: "script",
cache: true,
success: function () {
$.ajax({
type: "GET",
url: 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js',
dataType: "script",
cache: true,
success: function () {
mathjax_pagedown($);
}
});
}
});
}
});
});
</script>
{% endif %}
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function () { $(function () {
window.reply_comment = function (parent) { $('#id_body').keypress(function () {
var $comment_reply = $('#comment-' + parent + '-reply'); if (!("MathJax" in window)) {
var reply_id = 'reply-' + parent; $.ajax({
var new_id = 'id' + parent + '_body'; type: "GET",
if ($comment_reply.find('#' + reply_id).length == 0) { url: '{{ static('mathjax3_config.js') }}',
var $reply_form = $('#new-comment').clone(true).prop('id', reply_id).css("display", ""); dataType: "script",
$reply_form.find('h3').html('{{ _('Replying to comment') }}'); cache: true,
$reply_form.prepend('<a class="close">x</a>'); success: function () {
$reply_form.find('form.comment-submit-form input#id_parent').val(parent); $.ajax({
$reply_form.find('div#wmd-button-bar-id_body').empty().prop('id','wmd-button-bar-' + new_id); type: "GET",
$reply_form.find('textarea.wmd-input').val('').prop('id', 'wmd-input-' + new_id); url: 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js',
$reply_form.find('div#id_body-preview').attr('data-textarea-id', 'wmd-input-' + new_id).prop('id', new_id + '-preview'); dataType: "script",
$reply_form.appendTo($comment_reply); cache: true,
register_dmmd_preview($reply_form.find('div#' + new_id + '-preview')); success: function () {
if ('DjangoPagedown' in window) { mathjax_pagedown($);
window.DjangoPagedown.createEditor($reply_form.find('div.wmd-wrapper').get(0)); }
} });
} }
$comment_reply.fadeIn();
$('html, body').animate({
scrollTop: $comment_reply.offset().top - $('#navigation').height() - 4
}, 500);
};
$(document).on('click', '.close', function() {
$(this).closest('.reply-comment').fadeOut();
}); });
}
function update_math($comment) {
if ('MathJax' in window) {
var $body = $comment.find('.comment-body');
MathJax.typeset($body[0]);
}
}
window.show_revision = function (comment_id, offset) {
var $comment = $("#comment-" + comment_id);
// If .comment-body is hidden, then this is a bad comment that the user has not clicked
// Thus the revision retrieval should do nothing
if (!$comment.find('.comment-body').is(':visible'))
return;
var cur_revision = parseInt($comment.attr("data-revision"));
var max_revision = parseInt($comment.attr("data-max-revision"));
var revision_ajax = $comment.attr("data-revision-ajax");
var show_revision = cur_revision + offset;
$comment.attr("data-revision", show_revision);
$.get(revision_ajax, {
revision: show_revision
}).done(function (body) {
$comment.find('.previous-revision').css({visibility: show_revision == 0 ? 'hidden' : ''});
$comment.find('.next-revision').css({visibility: show_revision == max_revision ? 'hidden' : ''});
$comment.find('.content').html(body);
var edit_text = '{{ _('edit {edits}') }}'.replace("{edits}", show_revision);
if (show_revision == 0) {
edit_text = '{{ _('original') }}';
} else if (show_revision == max_revision && max_revision == 1) {
edit_text = '{{ _('edited') }}';
}
$comment.find('.comment-edit-text').text(' ' + edit_text + ' ');
update_math($comment);
});
};
function ajax_vote(url, id, delta, on_success) {
return $.ajax({
url: url,
type: 'POST',
data: {
id: id
},
success: function (data, textStatus, jqXHR) {
var score = $('#comment-' + id + ' .comment-score').first();
score.text(parseInt(score.text()) + delta);
if (typeof on_success !== 'undefined')
on_success();
},
error: function (data, textStatus, jqXHR) {
alert('Could not vote: ' + data.responseText);
}
});
}
var get_$votes = function (id) {
var $comment = $('#comment-' + id);
return {
upvote: $comment.find('.upvote-link').first(),
downvote: $comment.find('.downvote-link').first()
};
};
window.comment_upvote = function (id) {
ajax_vote('{{ url('comment_upvote') }}', id, 1, function () {
var $votes = get_$votes(id);
if ($votes.downvote.hasClass('voted'))
$votes.downvote.removeClass('voted');
else
$votes.upvote.addClass('voted');
});
};
window.comment_downvote = function (id) {
ajax_vote('{{ url('comment_downvote') }}', id, -1, function () {
var $votes = get_$votes(id);
if ($votes.upvote.hasClass('voted'))
$votes.upvote.removeClass('voted');
else
$votes.downvote.addClass('voted');
});
};
var $comments = $('.comments');
$comments.find('a.hide-comment').click(function (e) {
e.preventDefault();
if (!(e.ctrlKey || e.metaKey || confirm('Are you sure you want to hide this comment?')))
return;
var id = $(this).attr('data-id');
$.post('{{ url('comment_hide') }}', {id: id}).then(function () {
$('#comment-' + id).remove();
$('#comment-' + id + '-children').remove();
}).catch(function () {
alert('Failed.');
});
});
$comments.find('a.edit-link').featherlight({
afterOpen: function () {
register_dmmd_preview($('#id-edit-comment-body-preview'));
if ('DjangoPagedown' in window) {
var $wmd = $('.featherlight .wmd-wrapper');
if ($wmd.length) {
window.DjangoPagedown.createEditor($wmd.get(0));
if ('MathJax' in window) {
var preview = $('.featherlight div.wmd-preview')[0];
MathJax.typeset(preview);
}
}
}
$('#comment-edit').submit(function (event) {
event.preventDefault();
var id = $('#comment-edit').find('.comment-id').text();
var readback = $('#comment-edit').find('.read-back').text();
$.post($(this).attr('action'), $(this).serialize()).done(function (data) {
$.featherlight.current().close();
$.ajax({
url: readback
}).done(function (data) {
var $comment = $('#comment-' + id);
var $area = $comment.find('.comment-body').first();
$area.html(data);
update_math($comment);
var $edits = $comment.find('.comment-edits').first();
$edits.text('updated');
}).fail(function () {
console.log('Failed to update comment:' + id);
});
});
});
},
variant: 'featherlight-edit'
});
var $root = $('html, body');
$comments.find('a.comment-link').click(function () {
var href = $.attr(this, 'href');
$root.animate({
scrollTop: $(href).offset().top
}, 500, function () {
window.location.hash = href;
});
return false;
});
$('img.unveil').unveil(200);
window.comment_show_content = function (comment_id) {
var $comment = $('#comment-' + comment_id);
$comment.find('.comment-body').show();
$comment.find('.bad-comment-body').hide();
};
$("#write-comment").click( function(event) {
event.preventDefault();
$("#new-comment").show("slow");
$("#write-comment").hide();
$(".no-comments-message").hide();
});
}); });
});
</script> </script>
{% endif %}
<script type="text/javascript">
$(document).ready(function () {
window.reply_comment = function (parent) {
var $comment_reply = $('#comment-' + parent + '-reply');
var reply_id = 'reply-' + parent;
var new_id = 'id' + parent + '_body';
if ($comment_reply.find('#' + reply_id).length == 0) {
var $reply_form = $('#new-comment').clone(true).prop('id', reply_id).css("display", "");
$reply_form.find('h3').html('{{ _('Replying to comment') }}');
$reply_form.prepend('<a class="close">x</a>');
$reply_form.find('form.comment-submit-form input#id_parent').val(parent);
$reply_form.find('div#wmd-button-bar-id_body').empty().prop('id','wmd-button-bar-' + new_id);
$reply_form.find('textarea.wmd-input').val('').prop('id', 'wmd-input-' + new_id);
$reply_form.find('div#id_body-preview').attr('data-textarea-id', 'wmd-input-' + new_id).prop('id', new_id + '-preview');
$reply_form.appendTo($comment_reply);
register_dmmd_preview($reply_form.find('div#' + new_id + '-preview'));
if ('DjangoPagedown' in window) {
window.DjangoPagedown.createEditor($reply_form.find('div.wmd-wrapper').get(0));
}
}
$comment_reply.fadeIn();
$('html, body').animate({
scrollTop: $comment_reply.offset().top - $('#navigation').height() - 4
}, 500);
};
$(document).on('click', '.close', function() {
$(this).closest('.reply-comment').fadeOut();
});
function update_math($comment) {
if ('MathJax' in window) {
var $body = $comment.find('.comment-body');
MathJax.typeset($body[0]);
}
}
window.show_revision = function (comment_id, offset) {
var $comment = $("#comment-" + comment_id);
// If .comment-body is hidden, then this is a bad comment that the user has not clicked
// Thus the revision retrieval should do nothing
if (!$comment.find('.comment-body').is(':visible'))
return;
var cur_revision = parseInt($comment.attr("data-revision"));
var max_revision = parseInt($comment.attr("data-max-revision"));
var revision_ajax = $comment.attr("data-revision-ajax");
var show_revision = cur_revision + offset;
$comment.attr("data-revision", show_revision);
$.get(revision_ajax, {
revision: show_revision
}).done(function (body) {
$comment.find('.previous-revision').css({visibility: show_revision == 0 ? 'hidden' : ''});
$comment.find('.next-revision').css({visibility: show_revision == max_revision ? 'hidden' : ''});
$comment.find('.content').html(body);
var edit_text = '{{ _('edit {edits}') }}'.replace("{edits}", show_revision);
if (show_revision == 0) {
edit_text = '{{ _('original') }}';
} else if (show_revision == max_revision && max_revision == 1) {
edit_text = '{{ _('edited') }}';
}
$comment.find('.comment-edit-text').text(' ' + edit_text + ' ');
update_math($comment);
});
};
function ajax_vote(url, id, delta, on_success) {
return $.ajax({
url: url,
type: 'POST',
data: {
id: id
},
success: function (data, textStatus, jqXHR) {
var score = $('#comment-' + id + ' .comment-score').first();
score.text(parseInt(score.text()) + delta);
if (typeof on_success !== 'undefined')
on_success();
},
error: function (data, textStatus, jqXHR) {
alert('Could not vote: ' + data.responseText);
}
});
}
var get_$votes = function (id) {
var $comment = $('#comment-' + id);
return {
upvote: $comment.find('.upvote-link').first(),
downvote: $comment.find('.downvote-link').first()
};
};
window.comment_upvote = function (id) {
ajax_vote('{{ url('comment_upvote') }}', id, 1, function () {
var $votes = get_$votes(id);
if ($votes.downvote.hasClass('voted'))
$votes.downvote.removeClass('voted');
else
$votes.upvote.addClass('voted');
});
};
window.comment_downvote = function (id) {
ajax_vote('{{ url('comment_downvote') }}', id, -1, function () {
var $votes = get_$votes(id);
if ($votes.upvote.hasClass('voted'))
$votes.upvote.removeClass('voted');
else
$votes.downvote.addClass('voted');
});
};
var $comments = $('.comments');
$comments.find('a.hide-comment').click(function (e) {
e.preventDefault();
if (!(e.ctrlKey || e.metaKey || confirm('Are you sure you want to hide this comment?')))
return;
var id = $(this).attr('data-id');
$.post('{{ url('comment_hide') }}', {id: id}).then(function () {
$('#comment-' + id).remove();
$('#comment-' + id + '-children').remove();
}).catch(function () {
alert('Failed.');
});
});
$comments.find('a.edit-link').featherlight({
afterOpen: function () {
register_dmmd_preview($('#id-edit-comment-body-preview'));
if ('DjangoPagedown' in window) {
var $wmd = $('.featherlight .wmd-wrapper');
if ($wmd.length) {
window.DjangoPagedown.createEditor($wmd.get(0));
if ('MathJax' in window) {
var preview = $('.featherlight div.wmd-preview')[0];
MathJax.typeset(preview);
}
}
}
$('#comment-edit').submit(function (event) {
event.preventDefault();
var id = $('#comment-edit').find('.comment-id').text();
var readback = $('#comment-edit').find('.read-back').text();
$.post($(this).attr('action'), $(this).serialize()).done(function (data) {
$.featherlight.current().close();
$.ajax({
url: readback
}).done(function (data) {
var $comment = $('#comment-' + id);
var $area = $comment.find('.comment-body').first();
$area.html(data);
update_math($comment);
var $edits = $comment.find('.comment-edits').first();
$edits.text('updated');
}).fail(function () {
console.log('Failed to update comment:' + id);
});
});
});
},
variant: 'featherlight-edit'
});
var $root = $('html, body');
$comments.find('a.comment-link').click(function () {
var href = $.attr(this, 'href');
$root.animate({
scrollTop: $(href).offset().top
}, 500, function () {
window.location.hash = href;
});
return false;
});
$('img.unveil').unveil(200);
window.comment_show_content = function (comment_id) {
var $comment = $('#comment-' + comment_id);
$comment.find('.comment-body').show();
$comment.find('.bad-comment-body').hide();
};
$("#write-comment").click( function(event) {
event.preventDefault();
$("#new-comment").show("slow");
$("#write-comment").hide();
$(".no-comments-message").hide();
});
});
</script>
{% endcompress %} {% endcompress %}

View file

@ -1,4 +1,4 @@
{{ preview_data|markdown|reference|str|safe }} {{ preview_data|markdown|reference|str|safe }}
{% if REQUIRE_JAX %} {% if REQUIRE_JAX %}
<div data-config="{{ static('mathjax3_config.js') }}" class="require-mathjax-support"></div> <div data-config="{{ static('mathjax3_config.js') }}" class="require-mathjax-support"></div>
{% endif %} {% endif %}

View file

@ -1,3 +1,3 @@
{% with node=revision.field_dict %} {% with node=revision.field_dict %}
<div class="comment-body">{{ node.body|markdown|reference|str|safe }}</div> <div class="comment-body">{{ node.body|markdown|reference|str|safe }}</div>
{% endwith %} {% endwith %}

View file

@ -1,17 +1,17 @@
<h2>Votes</h2> <h2>Votes</h2>
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th>Voter</th> <th>Voter</th>
<th>Score</th> <th>Score</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for vote in votes %} {% for vote in votes %}
<tr> <tr>
<td>{{ link_user(vote.voter) }}</td> <td>{{ link_user(vote.voter) }}</td>
<td>{{ vote.score }}</td> <td>{{ vote.score }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>

View file

@ -1,80 +1,80 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block media %} {% block media %}
{% block content_media %}{% endblock %} {% block content_media %}{% endblock %}
{% endblock %} {% endblock %}
{% block js_media %} {% block js_media %}
{% compress js %} {% compress js %}
<script src="{{ static('libs/clipboard/clipboard.js') }}"></script> <script src="{{ static('libs/clipboard/clipboard.js') }}"></script>
<script type="text/javascript"> <script type="text/javascript">
$(function () { $(function () {
var info_float = $('.info-float'); var info_float = $('.info-float');
if (info_float.length) { if (info_float.length) {
var container = $('#content-right'); var container = $('#content-right');
if (window.bad_browser) { if (window.bad_browser) {
container.css('float', 'right'); container.css('float', 'right');
} else if (!featureTest('position', 'sticky')) { } else if (!featureTest('position', 'sticky')) {
fix_div(info_float, 55); fix_div(info_float, 55);
$(window).resize(function () { $(window).resize(function () {
info_float.width(container.width()); info_float.width(container.width());
});
info_float.width(container.width());
}
}
var copyButton;
$('pre code').each(function () {
$(this).parent().before($('<div>', {'class': 'copy-clipboard'})
.append(copyButton = $('<span>', {
'class': 'btn-clipboard',
'data-clipboard-text': $(this).text(),
'title': 'Click to copy'
}).text('Copy')));
$(copyButton.get(0)).mouseleave(function () {
$(this).attr('class', 'btn-clipboard');
$(this).removeAttr('aria-label');
});
var curClipboard = new Clipboard(copyButton.get(0));
curClipboard.on('success', function (e) {
e.clearSelection();
showTooltip(e.trigger, 'Copied!');
});
curClipboard.on('error', function (e) {
showTooltip(e.trigger, fallbackMessage(e.action));
});
});
}); });
</script> info_float.width(container.width());
{% endcompress %} }
{% block content_js_media %}{% endblock %} }
var copyButton;
$('pre code').each(function () {
$(this).parent().before($('<div>', {'class': 'copy-clipboard'})
.append(copyButton = $('<span>', {
'class': 'btn-clipboard',
'data-clipboard-text': $(this).text(),
'title': 'Click to copy'
}).text('Copy')));
$(copyButton.get(0)).mouseleave(function () {
$(this).attr('class', 'btn-clipboard');
$(this).removeAttr('aria-label');
});
var curClipboard = new Clipboard(copyButton.get(0));
curClipboard.on('success', function (e) {
e.clearSelection();
showTooltip(e.trigger, 'Copied!');
});
curClipboard.on('error', function (e) {
showTooltip(e.trigger, fallbackMessage(e.action));
});
});
});
</script>
{% endcompress %}
{% block content_js_media %}{% endblock %}
{% endblock %} {% endblock %}
{% block body %} {% block body %}
<div id="common-content"> <div id="common-content">
<div id="content-right"> <div id="content-right">
<div class="info-float">{% block info_float %}{% endblock %}</div> <div class="info-float">{% block info_float %}{% endblock %}</div>
</div>
<div id="content-left" class="split-common-content">
<div class="content-description screen">
{% block description %}{% endblock %}
{% block description_end %}
<hr>
{% endblock %}
</div>
{% block post_description_end %}{% endblock %}
{% block comments %}{% endblock %}
</div>
</div> </div>
<div id="content-left" class="split-common-content">
<div class="content-description screen">
{% block description %}{% endblock %}
{% block description_end %}
<hr>
{% endblock %}
</div>
{% block post_description_end %}{% endblock %}
{% block comments %}{% endblock %}
</div>
</div>
{% endblock %} {% endblock %}
{% block bodyend %} {% block bodyend %}
{% if REQUIRE_JAX %} {% if REQUIRE_JAX %}
{% include "mathjax-load.html" %} {% include "mathjax-load.html" %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View file

@ -1,35 +1,35 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block media %} {% block media %}
<style> <style>
#access-code-form { #access-code-form {
margin: 50px auto 0; margin: 50px auto 0;
display: block; display: block;
max-width: 500px; max-width: 500px;
} }
#id_access_code { #id_access_code {
width: 100%; width: 100%;
} }
.button-line { .button-line {
text-align: right; text-align: right;
} }
</style> </style>
{% endblock %} {% endblock %}
{% block body %} {% block body %}
<form id="access-code-form" action="" method="post" class="form-area"> <form id="access-code-form" action="" method="post" class="form-area">
{% csrf_token %} {% csrf_token %}
{% if form.errors or wrong_code %} {% if form.errors or wrong_code %}
<div id="form-errors"> <div id="form-errors">
<p class="error">{{ _('Invalid access code.') }}</p> <p class="error">{{ _('Invalid access code.') }}</p>
</div> </div>
{% endif %} {% endif %}
<p>{{ _('Please enter your access code:') }}</p> <p>{{ _('Please enter your access code:') }}</p>
<p>{{ form.access_code }}</p> <p>{{ form.access_code }}</p>
<p class="button-line"> <p class="button-line">
<button type="submit">{{ _('Join Contest') }}</button> <button type="submit">{{ _('Join Contest') }}</button>
</p> </p>
</form> </form>
{% endblock %} {% endblock %}

View file

@ -2,55 +2,55 @@
{% set page_type = 'calendar' %} {% set page_type = 'calendar' %}
{% block left_sidebar %} {% block left_sidebar %}
{% include "contest/contest-list-tabs.html" %} {% include "contest/contest-list-tabs.html" %}
{% endblock %} {% endblock %}
{% block middle_content %} {% block middle_content %}
<center style="font-size: 1.6em; margin-top: 0.3em;"> <center style="font-size: 1.6em; margin-top: 0.3em;">
{% if prev_month %} {% if prev_month %}
<a href="{{ url('contest_calendar', prev_month.year, prev_month.month) }}">&laquo; {{ _('Prev') }}</a> <a href="{{ url('contest_calendar', prev_month.year, prev_month.month) }}">&laquo; {{ _('Prev') }}</a>
{% endif %} {% endif %}
{% if not (curr_month.year == now.year and curr_month.month == now.month) %} {% if not (curr_month.year == now.year and curr_month.month == now.month) %}
<a href="{{ url('contest_calendar', now.year, now.month) }}"> {{ _('Today') }}</a> <a href="{{ url('contest_calendar', now.year, now.month) }}"> {{ _('Today') }}</a>
{% endif %} {% endif %}
{% if next_month %} {% if next_month %}
<a href="{{ url('contest_calendar', next_month.year, next_month.month) }}">{{ _('Next') }} &raquo;</a> <a href="{{ url('contest_calendar', next_month.year, next_month.month) }}">{{ _('Next') }} &raquo;</a>
{% endif %} {% endif %}
</center> </center>
<table id="contest-calendar"> <table id="contest-calendar">
<tr> <tr>
<th>{{ _('Sunday') }}</th> <th>{{ _('Sunday') }}</th>
<th>{{ _('Monday') }}</th> <th>{{ _('Monday') }}</th>
<th>{{ _('Tuesday') }}</th> <th>{{ _('Tuesday') }}</th>
<th>{{ _('Wednesday') }}</th> <th>{{ _('Wednesday') }}</th>
<th>{{ _('Thursday') }}</th> <th>{{ _('Thursday') }}</th>
<th>{{ _('Friday') }}</th> <th>{{ _('Friday') }}</th>
<th>{{ _('Saturday') }}</th> <th>{{ _('Saturday') }}</th>
</tr> </tr>
{% for week in calendar %} {% for week in calendar %}
<tr>{% for day in week %} <tr>{% for day in week %}
<td class="{{ day.weekday }}{% if day.is_today %} today{% endif %}{% if day.is_pad %} noday{% endif %}"> <td class="{{ day.weekday }}{% if day.is_today %} today{% endif %}{% if day.is_pad %} noday{% endif %}">
<span class="num">{{ day.date.day }}</span> <span class="num">{{ day.date.day }}</span>
<ul class="fa-ul"> <ul class="fa-ul">
{% for contest in day.starts %} {% for contest in day.starts %}
<li class="start"><i class="fa fa-li fa-lg fa-step-forward"></i> <li class="start"><i class="fa fa-li fa-lg fa-step-forward"></i>
<a href="{{ url('contest_view', contest.key) }}">{{ contest.name }}</a> <a href="{{ url('contest_view', contest.key) }}">{{ contest.name }}</a>
</li> </li>
{% endfor %} {% endfor %}
{% for contest in day.oneday %} {% for contest in day.oneday %}
<li class="oneday"> <li class="oneday">
<i class="fa fa-li fa-lg fa-play"></i> <i class="fa fa-li fa-lg fa-play"></i>
<a href="{{ url('contest_view', contest.key) }}">{{ contest.name }}</a> <a href="{{ url('contest_view', contest.key) }}">{{ contest.name }}</a>
</li> </li>
{% endfor %} {% endfor %}
{% for contest in day.ends %} {% for contest in day.ends %}
<li class="end"><i class="fa fa-li fa-lg fa-step-backward"></i> <li class="end"><i class="fa fa-li fa-lg fa-step-backward"></i>
<a href="{{ url('contest_view', contest.key) }}">{{ contest.name }}</a> <a href="{{ url('contest_view', contest.key) }}">{{ contest.name }}</a>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
</td> </td>
{% endfor %}</tr> {% endfor %}</tr>
{% endfor %} {% endfor %}
</table> </table>
{% endblock %} {% endblock %}

View file

@ -1,54 +1,54 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block media %} {% block media %}
{{ form.media.css }} {{ form.media.css }}
<style> <style>
form#clarification-form { form#clarification-form {
display: block; display: block;
margin: 0 auto; margin: 0 auto;
width: 100%; width: 100%;
max-width: 750px; max-width: 750px;
padding-top: 1em; padding-top: 1em;
} }
#id_title { #id_title {
width: 100%; width: 100%;
} }
form#clarification-form .submit { form#clarification-form .submit {
margin: 10px 0 0 auto; margin: 10px 0 0 auto;
} }
</style> </style>
{% endblock %} {% endblock %}
{% block js_media %} {% block js_media %}
{{ form.media.js }} {{ form.media.js }}
<script> <script>
$(function() { $(function() {
$('#problem-select').select2({width: '40em'}); $('#problem-select').select2({width: '40em'});
}); });
</script> </script>
{% endblock %} {% endblock %}
{% block body %} {% block body %}
<form id="clarification-form" action="" method="POST" class="form-area"> <form id="clarification-form" action="" method="POST" class="form-area">
{% csrf_token %} {% csrf_token %}
{% if form.body.errors %} {% if form.body.errors %}
<div class="form-errors"> <div class="form-errors">
{{ form.body.errors }} {{ form.body.errors }}
</div> </div>
{% endif %} {% endif %}
<h4> <h4>
<span>{{_('Problem')}}: </span> <span>{{_('Problem')}}: </span>
<select name="problem" id="problem-select"> <select name="problem" id="problem-select">
{% for problem in problems %} {% for problem in problems %}
<option value="{{ problem.problem.code }}" class="point-dropdown"> <option value="{{ problem.problem.code }}" class="point-dropdown">
{{ problem.order }}. {{problem.problem.name}} {{ problem.order }}. {{problem.problem.name}}
</option> </option>
{% endfor %} {% endfor %}
</select> </select>
</h4> </h4>
<div class="body-block">{{ form.body }}</div> <div class="body-block">{{ form.body }}</div>
<button type="submit" class="submit">{{ _('Create') }}</button> <button type="submit" class="submit">{{ _('Create') }}</button>
</form> </form>
{% endblock %} {% endblock %}

View file

@ -1,42 +1,42 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block media %} {% block media %}
<style> <style>
#contest-clone-panel { #contest-clone-panel {
position: relative; position: relative;
margin: 5em auto auto -10em; margin: 5em auto auto -10em;
top: 40%; top: 40%;
left: 50%; left: 50%;
} }
#contest-key-container { #contest-key-container {
margin: 0.5em 0; margin: 0.5em 0;
} }
#id_key { #id_key {
width: 100%; width: 100%;
} }
ul.errorlist { ul.errorlist {
list-style-type: none; list-style-type: none;
padding-left: 0; padding-left: 0;
text-align: center; text-align: center;
} }
</style> </style>
{% endblock %} {% endblock %}
{% block body %} {% block body %}
<form id="contest-clone-panel" action="" method="post" class="form-area"> <form id="contest-clone-panel" action="" method="post" class="form-area">
{% csrf_token %} {% csrf_token %}
{% if form.errors %} {% if form.errors %}
<div id="form-errors"> <div id="form-errors">
{{ form.key.errors }} {{ form.key.errors }}
</div> </div>
{% endif %} {% endif %}
<div><label class="inline-header grayed">{{ _('Enter a new key for the cloned contest:') }}</label></div> <div><label class="inline-header grayed">{{ _('Enter a new key for the cloned contest:') }}</label></div>
<div id="contest-key-container"><span class="fullwidth">{{ form.key }}</span></div> <div id="contest-key-container"><span class="fullwidth">{{ form.key }}</span></div>
<hr> <hr>
<button style="float: right;" type="submit">{{ _('Clone!') }}</button> <button style="float: right;" type="submit">{{ _('Clone!') }}</button>
</form> </form>
{% endblock %} {% endblock %}

View file

@ -1,53 +1,53 @@
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function () { $(document).ready(function () {
$('.time-remaining').each(function () { $('.time-remaining').each(function () {
count_down($(this)); count_down($(this));
});
}); });
});
</script> </script>
<div id="banner"> <div id="banner">
<a href="https://www.timeanddate.com/worldclock/fixedtime.html?msg={{ contest.name|urlquote('') }}&amp;iso= <a href="https://www.timeanddate.com/worldclock/fixedtime.html?msg={{ contest.name|urlquote('') }}&amp;iso=
{{- contest.start_time|utc|date('Y-m-d\TH:i:s') }}" class="date"> {{- contest.start_time|utc|date('Y-m-d\TH:i:s') }}" class="date">
{%- if contest.is_in_contest(request.user) and not request.participation.live -%} {%- if contest.is_in_contest(request.user) and not request.participation.live -%}
{% if request.participation.spectate %} {% if request.participation.spectate %}
{% trans countdown=contest.end_time|as_countdown %}Spectating, contest ends in {{countdown}}.{% endtrans %} {% trans countdown=contest.end_time|as_countdown %}Spectating, contest ends in {{countdown}}.{% endtrans %}
{% elif request.participation.end_time %} {% elif request.participation.end_time %}
{% trans countdown=request.participation.end_time|as_countdown %}Participating virtually, {{countdown}} remaining.{% endtrans %} {% trans countdown=request.participation.end_time|as_countdown %}Participating virtually, {{countdown}} remaining.{% endtrans %}
{% else %} {% else %}
{{- _('Participating virtually.') -}} {{- _('Participating virtually.') -}}
{% endif %} {% endif %}
{%- else -%}
{% if contest.start_time > now %}
{% trans countdown=contest.start_time|as_countdown %}Starting in {{countdown}}.{% endtrans %}
{% elif contest.end_time < now %}
{{- _('Contest is over.') -}}
{% else %}
{%- if has_joined -%}
{% if live_participation.ended %}
{% trans countdown=contest.end_time|as_countdown %}Your time is up! Contest ends in {{countdown}}.{% endtrans %}
{% else %}
{% trans countdown=live_participation.end_time|as_countdown %}You have {{countdown}} remaining.{% endtrans %}
{% endif %}
{%- else -%} {%- else -%}
{% if contest.start_time > now %} {% trans countdown=contest.end_time|as_countdown %}Contest ends in {{countdown}}.{% endtrans %}
{% trans countdown=contest.start_time|as_countdown %}Starting in {{countdown}}.{% endtrans %}
{% elif contest.end_time < now %}
{{- _('Contest is over.') -}}
{% else %}
{%- if has_joined -%}
{% if live_participation.ended %}
{% trans countdown=contest.end_time|as_countdown %}Your time is up! Contest ends in {{countdown}}.{% endtrans %}
{% else %}
{% trans countdown=live_participation.end_time|as_countdown %}You have {{countdown}} remaining.{% endtrans %}
{% endif %}
{%- else -%}
{% trans countdown=contest.end_time|as_countdown %}Contest ends in {{countdown}}.{% endtrans %}
{%- endif -%}
{% endif %}
{%- endif -%} {%- endif -%}
</a> {% endif %}
<div class="time"> {%- endif -%}
{% if contest.time_limit %} </a>
{% trans trimmed start_time=contest.start_time|date(_("F j, Y, G:i T")), end_time=contest.end_time|date(_("F j, Y, G:i T")), time_limit=contest.time_limit|timedelta('localized-no-seconds') %} <div class="time">
<b>{{ time_limit }}</b> window between <b>{{ start_time }}</b> and <b>{{ end_time }}</b> {% if contest.time_limit %}
{% endtrans %} {% trans trimmed start_time=contest.start_time|date(_("F j, Y, G:i T")), end_time=contest.end_time|date(_("F j, Y, G:i T")), time_limit=contest.time_limit|timedelta('localized-no-seconds') %}
{% else %} <b>{{ time_limit }}</b> window between <b>{{ start_time }}</b> and <b>{{ end_time }}</b>
{% trans trimmed length=contest.contest_window_length|timedelta("localized-no-seconds"), start_time=contest.start_time|date(_("F j, Y, G:i T")) %} {% endtrans %}
<b>{{ length }}</b> long starting on <b>{{ start_time }}</b> {% else %}
{% endtrans %} {% trans trimmed length=contest.contest_window_length|timedelta("localized-no-seconds"), start_time=contest.start_time|date(_("F j, Y, G:i T")) %}
{% endif %} <b>{{ length }}</b> long starting on <b>{{ start_time }}</b>
</div> {% endtrans %}
{% if contest.freeze_after and contest.freeze_after + contest.start_time < now %}
<div class="time" style="margin-top: 0.2em">
<b>{{_("Standing was frozen")}}</b> {{_("at")}} <b>{{ (contest.freeze_after + contest.start_time) | date(_("F j, Y, G:i T")) }}</b>
</div>
{% endif %} {% endif %}
</div>
{% if contest.freeze_after and contest.freeze_after + contest.start_time < now %}
<div class="time" style="margin-top: 0.2em">
<b>{{_("Standing was frozen")}}</b> {{_("at")}} <b>{{ (contest.freeze_after + contest.start_time) | date(_("F j, Y, G:i T")) }}</b>
</div>
{% endif %}
</div> </div>

View file

@ -1,5 +1,5 @@
<div class="left-sidebar"> <div class="left-sidebar">
{{ make_tab_item('list', 'fa fa-list', url('contest_list'), _('List')) }} {{ make_tab_item('list', 'fa fa-list', url('contest_list'), _('List')) }}
{{ make_tab_item('calendar', 'fa fa-calendar', url('contest_calendar', now.year, now.month), _('Calendar')) }} {{ make_tab_item('calendar', 'fa fa-calendar', url('contest_calendar', now.year, now.month), _('Calendar')) }}
{{ make_tab_item('admin', 'fa fa-edit', url('admin:judge_contest_changelist'), _('Admin')) }} {{ make_tab_item('admin', 'fa fa-edit', url('admin:judge_contest_changelist'), _('Admin')) }}
</div> </div>

View file

@ -1,40 +1,40 @@
<style> <style>
@media(max-width: 799px) { @media(max-width: 799px) {
.middle-right-content { .middle-right-content {
margin-left: 8px; margin-left: 8px;
margin-right: 8px; margin-right: 8px;
}
} }
}
</style> </style>
<div class="left-sidebar"> <div class="left-sidebar">
{{ make_tab_item('detail', 'fa fa-info-circle', url('contest_view', contest.key), _('Info')) }} {{ make_tab_item('detail', 'fa fa-info-circle', url('contest_view', contest.key), _('Info')) }}
{% if contest.ended or can_edit %} {% if contest.ended or can_edit %}
{{ make_tab_item('stats', 'fa fa-pie-chart', url('contest_stats', contest.key), _('Statistics')) }} {{ make_tab_item('stats', 'fa fa-pie-chart', url('contest_stats', contest.key), _('Statistics')) }}
{% endif %} {% endif %}
{% if contest.start_time <= now or perms.judge.see_private_contest %} {% if contest.start_time <= now or perms.judge.see_private_contest %}
{% if contest.can_see_own_scoreboard(request.user) %} {% if contest.can_see_own_scoreboard(request.user) %}
{{ make_tab_item('ranking', 'fa fa-bar-chart', url('contest_ranking', contest.key), _('Rankings')) }} {{ make_tab_item('ranking', 'fa fa-bar-chart', url('contest_ranking', contest.key), _('Rankings')) }}
{% if request.user.is_authenticated %} {% if request.user.is_authenticated %}
{{ make_tab_item('participation', 'fa fa-users', url('contest_participation_own', contest.key), _('Participation')) }} {{ make_tab_item('participation', 'fa fa-users', url('contest_participation_own', contest.key), _('Participation')) }}
{% endif %} {% endif %}
{% else %} {% else %}
{{ make_tab_item('ranking', 'fa fa-bar-chart', None, _('Hidden Rankings')) }} {{ make_tab_item('ranking', 'fa fa-bar-chart', None, _('Hidden Rankings')) }}
{% endif %}
{% endif %} {% endif %}
{% if request.user.is_superuser and contest_has_hidden_subtasks %} {% endif %}
{{ make_tab_item('resolver', 'fa fa-check', url('resolver', contest.key), _('Resolver')) }} {% if request.user.is_superuser and contest_has_hidden_subtasks %}
{% endif %} {{ make_tab_item('resolver', 'fa fa-check', url('resolver', contest.key), _('Resolver')) }}
{% if show_final_ranking %} {% endif %}
{{ make_tab_item('final_ranking', 'fa fa-bar-chart', url('contest_final_ranking', contest.key), _('Final rankings')) }} {% if show_final_ranking %}
{% endif %} {{ make_tab_item('final_ranking', 'fa fa-bar-chart', url('contest_final_ranking', contest.key), _('Final rankings')) }}
{% if can_edit %} {% endif %}
{% if perms.judge.moss_contest and has_moss_api_key %} {% if can_edit %}
{{ make_tab_item('moss', 'fa fa-gavel', url('contest_moss', contest.key), _('MOSS')) }} {% if perms.judge.moss_contest and has_moss_api_key %}
{% endif %} {{ make_tab_item('moss', 'fa fa-gavel', url('contest_moss', contest.key), _('MOSS')) }}
{{ make_tab_item('edit', 'fa fa-edit', url('admin:judge_contest_change', contest.id), _('Edit')) }}
{% endif %}
{% if perms.judge.clone_contest %}
{{ make_tab_item('clone', 'fa fa-copy', url('contest_clone', contest.key), _('Clone')) }}
{% endif %} {% endif %}
{{ make_tab_item('edit', 'fa fa-edit', url('admin:judge_contest_change', contest.id), _('Edit')) }}
{% endif %}
{% if perms.judge.clone_contest %}
{{ make_tab_item('clone', 'fa fa-copy', url('contest_clone', contest.key), _('Clone')) }}
{% endif %}
</div> </div>

View file

@ -2,141 +2,141 @@
{% set page_type = 'detail' %} {% set page_type = 'detail' %}
{% block middle_title %} {% block middle_title %}
<h2>{{contest.name}}</h2> <h2>{{contest.name}}</h2>
{% endblock %} {% endblock %}
{% block left_sidebar %} {% block left_sidebar %}
{% set title = contest.name %} {% set title = contest.name %}
{% include "contest/contest-tabs.html" %} {% include "contest/contest-tabs.html" %}
{% endblock %} {% endblock %}
{% block two_col_js %} {% block two_col_js %}
{% include "contest/media-js.html" %} {% include "contest/media-js.html" %}
{% include "comments/media-js.html" %} {% include "comments/media-js.html" %}
{% include "actionbar/media-js.html" %} {% include "actionbar/media-js.html" %}
{% endblock %} {% endblock %}
{% block two_col_media %} {% block two_col_media %}
{% include "comments/media-css.html" %} {% include "comments/media-css.html" %}
{% include "actionbar/media-css.html" %} {% include "actionbar/media-css.html" %}
{% endblock %} {% endblock %}
{% block middle_content %} {% block middle_content %}
{% include "contest/contest-datetime.html" %} {% include "contest/contest-datetime.html" %}
{% if request.user.is_authenticated %} {% if request.user.is_authenticated %}
{% if contest.can_join or is_editor or is_tester %} {% if contest.can_join or is_editor or is_tester %}
{% set in_contest = contest.is_in_contest(request.user) %} {% set in_contest = contest.is_in_contest(request.user) %}
{% if contest.ended %} {% if contest.ended %}
{# Allow users to leave the virtual contest #} {# Allow users to leave the virtual contest #}
{% if in_contest %} {% if in_contest %}
<form action="{{ url('contest_leave', contest.key) }}" method="post" <form action="{{ url('contest_leave', contest.key) }}" method="post"
class="contest-join-pseudotab btn-red"> class="contest-join-pseudotab btn-red">
{% csrf_token %} {% csrf_token %}
<input type="submit" class="leaving-forever" value="{{ _('Leave contest') }}"> <input type="submit" class="leaving-forever" value="{{ _('Leave contest') }}">
</form> </form>
{% else %} {% else %}
{# Allow users to virtual join #} {# Allow users to virtual join #}
<form action="{{ url('contest_join', contest.key) }}" method="post" <form action="{{ url('contest_join', contest.key) }}" method="post"
class="contest-join-pseudotab btn-midnightblue"> class="contest-join-pseudotab btn-midnightblue">
{% csrf_token %} {% csrf_token %}
<input type="submit" value="{{ _('Virtual join') }}"> <input type="submit" value="{{ _('Virtual join') }}">
</form> </form>
{% endif %}
{% else %}
{# Allow users to leave the contest #}
{% if in_contest %}
<form action="{{ url('contest_leave', contest.key) }}" method="post"
class="contest-join-pseudotab">
{% csrf_token %}
<input type="submit" class="btn-midnightblue" value="
{%- if request.participation.spectate %}
{{- _('Stop spectating') -}}
{% else %}
{{- _('Leave contest') -}}
{% endif %}">
</form>
{% elif is_editor or is_tester or live_participation.ended %}
<form action="{{ url('contest_join', contest.key) }}" method="post" class="contest-join-pseudotab">
{% csrf_token %}
<input type="submit" class="btn-midnightblue" value="{{ _('Spectate contest') }}">
</form>
{% else %}
<form action="{{ url('contest_join', contest.key) }}" method="post" class="contest-join-pseudotab">
{% csrf_token %}
<input type="submit" class="btn-midnightblue {% if not has_joined %}first-join{% endif %}"
value="{{ _('Join contest') }}">
</form>
{% endif %}
{% endif %}
{% endif %} {% endif %}
{% elif contest.can_join %} {% else %}
<form action="{{ url('auth_login') }}" method="get" {# Allow users to leave the contest #}
class="contest-join-pseudotab unselectable"> {% if in_contest %}
<input type="hidden" name="next" value="{{ LOGIN_RETURN_PATH|urlencode }}"> <form action="{{ url('contest_leave', contest.key) }}" method="post"
<input type="submit" class="btn-midnightblue" value="{{ _('Login to participate') }}"> class="contest-join-pseudotab">
</form> {% csrf_token %}
<input type="submit" class="btn-midnightblue" value="
{%- if request.participation.spectate %}
{{- _('Stop spectating') -}}
{% else %}
{{- _('Leave contest') -}}
{% endif %}">
</form>
{% elif is_editor or is_tester or live_participation.ended %}
<form action="{{ url('contest_join', contest.key) }}" method="post" class="contest-join-pseudotab">
{% csrf_token %}
<input type="submit" class="btn-midnightblue" value="{{ _('Spectate contest') }}">
</form>
{% else %}
<form action="{{ url('contest_join', contest.key) }}" method="post" class="contest-join-pseudotab">
{% csrf_token %}
<input type="submit" class="btn-midnightblue {% if not has_joined %}first-join{% endif %}"
value="{{ _('Join contest') }}">
</form>
{% endif %}
{% endif %}
{% endif %} {% endif %}
{% elif contest.can_join %}
<form action="{{ url('auth_login') }}" method="get"
class="contest-join-pseudotab unselectable">
<input type="hidden" name="next" value="{{ LOGIN_RETURN_PATH|urlencode }}">
<input type="submit" class="btn-midnightblue" value="{{ _('Login to participate') }}">
</form>
{% endif %}
<div class="content-description"> <div class="content-description">
{% cache 3600 'contest_html' contest.id MATH_ENGINE %} {% cache 3600 'contest_html' contest.id MATH_ENGINE %}
{{ contest.description|markdown|reference|str|safe }} {{ contest.description|markdown|reference|str|safe }}
{% endcache %} {% endcache %}
</div>
{% if editable_organizations %}
<div>
{% for org in editable_organizations %}
<span> [<a href="{{ url('organization_contest_edit', org.id , org.slug , contest.key) }}">{{ _('Edit in') }} {{org.slug}}</a>]</span>
{% endfor %}
</div> </div>
{% if editable_organizations %} {% endif %}
<div>
{% for org in editable_organizations %}
<span> [<a href="{{ url('organization_contest_edit', org.id , org.slug , contest.key) }}">{{ _('Edit in') }} {{org.slug}}</a>]</span>
{% endfor %}
</div>
{% endif %}
{% if contest.ended or request.user.is_superuser or is_editor or is_tester %} {% if contest.ended or request.user.is_superuser or is_editor or is_tester %}
<hr> <hr>
<div class="contest-problems"> <div class="contest-problems">
<h2 style="margin-bottom: 0.2em"><i class="fa fa-fw fa-question-circle"></i>{{ _('Problems') }} </h2> <h2 style="margin-bottom: 0.2em"><i class="fa fa-fw fa-question-circle"></i>{{ _('Problems') }} </h2>
<table id="contest-problems" class="table"> <table id="contest-problems" class="table">
<thead> <thead>
<tr> <tr>
<th>{{ _('Problem') }}</th> <th>{{ _('Problem') }}</th>
<th>{{ _('Points') }}</th> <th>{{ _('Points') }}</th>
<th>{{ _('AC Rate') }}</th> <th>{{ _('AC Rate') }}</th>
<th>{{ _('Users') }}</th> <th>{{ _('Users') }}</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for problem in contest_problems %} {% for problem in contest_problems %}
<tr> <tr>
<td> <td>
{% if problem.is_public %} {% if problem.is_public %}
<a href="{{ url('problem_detail', problem.code) }}">{{ problem.i18n_name }}</a> <a href="{{ url('problem_detail', problem.code) }}">{{ problem.i18n_name }}</a>
{% else %} {% else %}
{{ problem.i18n_name }} {{ problem.i18n_name }}
{% endif %} {% endif %}
</td> </td>
<td>{{ problem.points|floatformat }}{% if problem.partial %}p{% endif %}</td> <td>{{ problem.points|floatformat }}{% if problem.partial %}p{% endif %}</td>
<td>{{ problem.ac_rate|floatformat(1) }}%</td> <td>{{ problem.ac_rate|floatformat(1) }}%</td>
<td> <td>
{% if problem.is_public %} {% if problem.is_public %}
<a href="{{ url('ranked_submissions', problem.code) }}">{{ problem.user_count }}</a> <a href="{{ url('ranked_submissions', problem.code) }}">{{ problem.user_count }}</a>
{% else %} {% else %}
{{ problem.user_count }} {{ problem.user_count }}
{% endif %} {% endif %}
</td> </td>
<td> <td>
{% if problem.is_public and problem.has_public_editorial %} {% if problem.is_public and problem.has_public_editorial %}
<a href="{{ url('problem_editorial', problem.code) }}">{{ _('Editorial') }}</a> <a href="{{ url('problem_editorial', problem.code) }}">{{ _('Editorial') }}</a>
{% endif %} {% endif %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
</div> </div>
<hr> <hr>
{% endif %} {% endif %}
{% include "actionbar/list.html" %} {% include "actionbar/list.html" %}
<br> <br>
{% include "comments/list.html" %} {% include "comments/list.html" %}
{% endblock %} {% endblock %}

View file

@ -1,404 +1,404 @@
{% extends "two-column-content.html" %} {% extends "two-column-content.html" %}
{% block meta %} {% block meta %}
<meta name="description" content="The {{ SITE_NAME }}'s contest list - past, present, and future."> <meta name="description" content="The {{ SITE_NAME }}'s contest list - past, present, and future.">
{% endblock %} {% endblock %}
{% block two_col_media %} {% block two_col_media %}
<style> <style>
.content-description ul { .content-description ul {
padding: 0 !important; padding: 0 !important;
} }
.btn-contest { .btn-contest {
display: inline-block; display: inline-block;
padding: 1px 6px; padding: 1px 6px;
} }
.contest-group-header { .contest-group-header {
padding-bottom: 1em; padding-bottom: 1em;
} }
{% if page_obj and page_obj.number > 1%} {% if page_obj and page_obj.number > 1%}
#ongoing-table { #ongoing-table {
display: none; display: none;
} }
{% endif %} {% endif %}
@media (max-width: 500px) { @media (max-width: 500px) {
#search-contest, #search-org, #search-btn { #search-contest, #search-org, #search-btn {
width: 100%; width: 100%;
margin-bottom: 0.5em; margin-bottom: 0.5em;
} }
#search-contest { #search-contest {
height: 2.5em; height: 2.5em;
} }
#search-btn { #search-btn {
margin-top: 0.5em; margin-top: 0.5em;
} }
#filter-form input { #filter-form input {
padding-left: 8px; padding-left: 8px;
} }
} }
@media (min-width: 500px) { @media (min-width: 500px) {
#filter-form input { #filter-form input {
margin: 0 0.5em 0 0!important; margin: 0 0.5em 0 0!important;
padding-left: 8px; padding-left: 8px;
padding-top: 8px; padding-top: 8px;
} }
#search-contest { #search-contest {
width: 30%; width: 30%;
height: 2.3em; height: 2.3em;
margin-right: 1em; margin-right: 1em;
margin-bottom: 0; margin-bottom: 0;
padding-top: 4px !important; padding-top: 4px !important;
} }
#search-org { #search-org {
width: 40%; width: 40%;
} }
#search-btn { #search-btn {
display: inline-block; display: inline-block;
height: 2.3em; height: 2.3em;
margin-left: 0.5em; margin-left: 0.5em;
} }
} }
</style> </style>
{% endblock %} {% endblock %}
{% block two_col_js %} {% block two_col_js %}
<script src="{{ static('libs/featherlight/featherlight.min.js') }}" type="text/javascript"></script> <script src="{{ static('libs/featherlight/featherlight.min.js') }}" type="text/javascript"></script>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function () { $(document).ready(function () {
$('.time-remaining').each(function () { $('.time-remaining').each(function () {
count_down($(this)); count_down($(this));
}); });
$('.contest-tag').find('a[data-featherlight]').featherlight(); $('.contest-tag').find('a[data-featherlight]').featherlight();
$('.join-warning').click(function () { $('.join-warning').click(function () {
return confirm('{{ _('Are you sure you want to join?') }}\n' + return confirm('{{ _('Are you sure you want to join?') }}\n' +
'{{ _('Joining a contest for the first time starts your timer, after which it becomes unstoppable.') }}'); '{{ _('Joining a contest for the first time starts your timer, after which it becomes unstoppable.') }}');
}); });
$('#search-org').select2({multiple: 1, placeholder: '{{ _('Groups') }}...'}) $('#search-org').select2({multiple: 1, placeholder: '{{ _('Groups') }}...'})
.css({'visibility': 'visible'}); .css({'visibility': 'visible'});
// var tooltip_classes = 'tooltipped tooltipped-e'; // var tooltip_classes = 'tooltipped tooltipped-e';
// //
// $('.contest-tag').each(function () { // $('.contest-tag').each(function () {
// var link = $(this);// // var link = $(this);//
// link.mouseenter(function (e) { // link.mouseenter(function (e) {
// link.addClass(tooltip_classes).attr('aria-label', link.attr('data-description')); // link.addClass(tooltip_classes).attr('aria-label', link.attr('data-description'));
// }).mouseleave(function (e) { // }).mouseleave(function (e) {
// link.removeClass(tooltip_classes).removeAttr('aria-label'); // link.removeClass(tooltip_classes).removeAttr('aria-label');
// }); // });
// }); // });
}); });
</script> </script>
{% endblock %} {% endblock %}
{% block left_sidebar %} {% block left_sidebar %}
{% include "contest/contest-list-tabs.html" %} {% include "contest/contest-list-tabs.html" %}
{% endblock %} {% endblock %}
{% macro contest_head(contest) %} {% macro contest_head(contest) %}
{% spaceless %} {% spaceless %}
<a href="{{ url('contest_view', contest.key) }}" class="contest-list-title"> <a href="{{ url('contest_view', contest.key) }}" class="contest-list-title">
{{- contest.name -}} {{- contest.name -}}
</a> </a>
<span class="contest-tags"> <span class="contest-tags">
{% if not contest.is_visible %} {% if not contest.is_visible %}
<span class="contest-tag contest-tag-hidden"> <span class="contest-tag contest-tag-hidden">
<i class="fa fa-eye-slash"></i> {{ _('hidden') }} <i class="fa fa-eye-slash"></i> {{ _('hidden') }}
</span>
{% endif %}
{% if contest.is_editable %}
<span class="contest-tag contest-tag-edit">
<a href="{{ url('organization_contest_edit', organization.id, organization.slug, contest.key) }}" class="white">
<i class="fa fa-edit"></i> {{ _('Edit') }}
</a>
</span>
{% endif %}
{% if contest.is_private %}
<span class="contest-tag contest-tag-private">
<i class="fa fa-lock"></i> {{ _('private') }}
</span>
{% endif %}
{% if not hide_contest_orgs %}
{% if contest.is_organization_private %}
{% for org in contest.organizations.all() %}
<span class="contest-tag contest-tag-org">
<a href="{{ org.get_absolute_url() }}">
<i class="fa fa-lock"></i> {{ org.name }}
</a>
</span>
{% endfor %}
{% endif %}
{% endif %}
{% if contest.is_rated %}
<span class="contest-tag-rated">
<i class="fa fa-bar-chart"></i> {{ _('rated') }}
</span>
{% endif %}
{% for tag in contest.tags.all() %}
<span style="background-color: {{ tag.color }}" class="contest-tag">
<a href="{{ url('contest_tag', tag.name) }}"
style="color: {{ tag.text_color }}"
data-featherlight="{{ url('contest_tag_ajax', tag.name) }}">
{{- tag.name -}}
</a>
</span>
{% endfor %}
</span> </span>
{% endspaceless %} {% endif %}
{% if contest.is_editable %}
<span class="contest-tag contest-tag-edit">
<a href="{{ url('organization_contest_edit', organization.id, organization.slug, contest.key) }}" class="white">
<i class="fa fa-edit"></i> {{ _('Edit') }}
</a>
</span>
{% endif %}
{% if contest.is_private %}
<span class="contest-tag contest-tag-private">
<i class="fa fa-lock"></i> {{ _('private') }}
</span>
{% endif %}
{% if not hide_contest_orgs %}
{% if contest.is_organization_private %}
{% for org in contest.organizations.all() %}
<span class="contest-tag contest-tag-org">
<a href="{{ org.get_absolute_url() }}">
<i class="fa fa-lock"></i> {{ org.name }}
</a>
</span>
{% endfor %}
{% endif %}
{% endif %}
{% if contest.is_rated %}
<span class="contest-tag-rated">
<i class="fa fa-bar-chart"></i> {{ _('rated') }}
</span>
{% endif %}
{% for tag in contest.tags.all() %}
<span style="background-color: {{ tag.color }}" class="contest-tag">
<a href="{{ url('contest_tag', tag.name) }}"
style="color: {{ tag.text_color }}"
data-featherlight="{{ url('contest_tag_ajax', tag.name) }}">
{{- tag.name -}}
</a>
</span>
{% endfor %}
</span>
{% endspaceless %}
{% endmacro %} {% endmacro %}
{% macro time_left(contest) %} {% macro time_left(contest) %}
<div class="time time-left"> <div class="time time-left">
{% if contest.time_limit %} {% if contest.time_limit %}
{{ contest.start_time|date(_("M j, Y, G:i")) }} - {{ contest.start_time|date(_("M j, Y, G:i")) }} -
{{ contest.end_time|date(_("M j, Y, G:i")) }} {{ contest.end_time|date(_("M j, Y, G:i")) }}
{% else %} {% else %}
{{ contest.start_time|date(_("M j, Y, G:i")) }} {{ contest.start_time|date(_("M j, Y, G:i")) }}
{% endif %} {% endif %}
<br> <br>
{% if contest.time_limit %} {% if contest.time_limit %}
{% trans time_limit=contest.time_limit|timedelta('localized-no-seconds') %}{{ time_limit }} window{% endtrans %} {% trans time_limit=contest.time_limit|timedelta('localized-no-seconds') %}{{ time_limit }} window{% endtrans %}
{% else %} {% else %}
{% trans duration=contest.contest_window_length|timedelta('localized-no-seconds') %}{{ duration }} long{% endtrans %} {% trans duration=contest.contest_window_length|timedelta('localized-no-seconds') %}{{ duration }} long{% endtrans %}
{% endif %} {% endif %}
</div> </div>
{% endmacro %} {% endmacro %}
{% macro user_count(contest, user) %} {% macro user_count(contest, user) %}
{% if contest.can_see_own_scoreboard(user) %} {% if contest.can_see_own_scoreboard(user) %}
<a href="{{ url('contest_ranking', contest.key) }}">{{ contest.user_count }}</a> <a href="{{ url('contest_ranking', contest.key) }}">{{ contest.user_count }}</a>
{% else %} {% else %}
{{ contest.user_count }} {{ contest.user_count }}
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
{% macro contest_join(contest, request) %} {% macro contest_join(contest, request) %}
{% if not request.in_contest %} {% if not request.in_contest %}
<td> <td>
{% if request.profile in contest.authors.all() or request.profile in contest.curators.all() or request.profile in contest.testers.all() %} {% if request.profile in contest.authors.all() or request.profile in contest.curators.all() or request.profile in contest.testers.all() %}
<form action="{{ url('contest_join', contest.key) }}" method="post"> <form action="{{ url('contest_join', contest.key) }}" method="post">
{% csrf_token %} {% csrf_token %}
<input type="submit" class="unselectable button full small" <input type="submit" class="unselectable button full small"
value="{{ _('Spectate') }}"> value="{{ _('Spectate') }}">
</form> </form>
{% else %} {% else %}
<form action="{{ url('contest_join', contest.key) }}" method="post"> <form action="{{ url('contest_join', contest.key) }}" method="post">
{% csrf_token %} {% csrf_token %}
<input type="submit" class="unselectable button full small join-warning" <input type="submit" class="unselectable button full small join-warning"
value="{{ _('Join') }}"> value="{{ _('Join') }}">
</form> </form>
{% endif %} {% endif %}
</td> </td>
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
{% block middle_content %} {% block middle_content %}
<div class="content-description"> <div class="content-description">
<form id="filter-form"> <form id="filter-form">
<input id="search-contest" type="text" name="contest" value="{{ contest_query or '' }}" <input id="search-contest" type="text" name="contest" value="{{ contest_query or '' }}"
placeholder="{{ _('Search contests...') }}"> placeholder="{{ _('Search contests...') }}">
{% if organizations %} {% if organizations %}
<select id="search-org" name="orgs" multiple> <select id="search-org" name="orgs" multiple>
{% for org in organizations %} {% for org in organizations %}
<option value="{{ org.id }}"{% if org.id in org_query %} selected{% endif %}> <option value="{{ org.id }}"{% if org.id in org_query %} selected{% endif %}>
{{ org.name }} {{ org.name }}
</option> </option>
{% endfor %} {% endfor %}
</select> </select>
{% endif %} {% endif %}
<button id="search-btn" class="btn-green small"> {{ _('Search')}} </button> <button id="search-btn" class="btn-green small"> {{ _('Search')}} </button>
{% if create_url %} {% if create_url %}
<a href="{{create_url}}" class="button small" style="float: right"><i class="fa fa-plus"></i> {{ _('Create')}}</a> <a href="{{create_url}}" class="button small" style="float: right"><i class="fa fa-plus"></i> {{ _('Create')}}</a>
{% endif %} {% endif %}
</form> </form>
{% if active_participations %} {% if active_participations %}
<h3 class="toggle open contest-group-header"> <h3 class="toggle open contest-group-header">
<i class="fa fa-chevron-right fa-fw"></i> <i class="fa fa-chevron-right fa-fw"></i>
{{ _('Active Contests') }} {{ _('Active Contests') }}
</h3> </h3>
<div class="toggled"> <div class="toggled">
<table class="contest-list table striped"> <table class="contest-list table striped">
<thead> <thead>
<tr> <tr>
<th style="width:90%">{{ _('Contest') }}</th> <th style="width:90%">{{ _('Contest') }}</th>
<th>{{ _('Users') }}</th> <th>{{ _('Users') }}</th>
{% if not request.in_contest %} {% if not request.in_contest %}
<th style="width:15%"></th> <th style="width:15%"></th>
{% endif %} {% endif %}
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for participation in active_participations %} {% for participation in active_participations %}
{% with contest=participation.contest %} {% with contest=participation.contest %}
<tr>
<td>
<div class="contest-block">
{{ contest_head(contest) }}
{% if contest.start_time %}
<br>
{% if contest.time_limit %}
<span class="time">
{% trans countdown=participation.end_time|as_countdown %}Window ends in {{countdown}}{% endtrans %}
</span>
{% elif contest.time_before_end %}
<span class="time">{% trans countdown=contest.end_time|as_countdown %}Ends in {{countdown}}{% endtrans %}</span>
{% endif %}
{{ time_left(contest) }}
{% endif %}
</div>
</td>
<td>
{{ user_count(contest, request.user) }}
</td>
{{ contest_join(contest, request) }}
</tr>
{% endwith %}
{% endfor %}
</tbody>
</table>
</div>
<br>
{% endif %}
{% if current_contests %}
<h3 class="toggle open contest-group-header">
<i class="fa fa-chevron-right fa-fw"></i>
{{ _('Ongoing Contests') }}
</h3>
<div id="ongoing-table" class="toggled">
<table class="contest-list table striped">
<thead>
<tr>
<th style="width:90%">{{ _('Contest') }}</th>
<th>{{ _('Users') }}</th>
{% if not request.in_contest %}
<th style="width:15%"></th>
{% endif %}
</tr>
</thead>
<tbody>
{% for contest in current_contests %}
<tr>
<td>
<div class="contest-block">
{{ contest_head(contest) }}
{% if contest.start_time %}
<br>
{% if contest.time_before_end %}
<span class="time">{% trans countdown=contest.end_time|as_countdown %}Ends in {{countdown}}{% endtrans %}</span>
{% endif %}
{{ time_left(contest) }}
{% endif %}
</div>
</td>
<td>
{{ user_count(contest, request.user) }}
</td>
{{ contest_join(contest, request) }}
</tr>
{% endfor %}
</tbody>
</table>
<br>
</div>
{% endif %}
<h3 class="toggle open contest-group-header">
<i class="fa fa-chevron-right fa-fw"></i>
{{ _('Upcoming Contests') }}
</h3>
{% if future_contests %}
<div class="toggled">
<table class="contest-list table striped">
<thead>
<tr>
<th>{{ _('Contest') }}</th>
</tr>
</thead>
<tbody>
{% for contest in future_contests %}
<tr>
<td>
<div class="contest-block">
{{ contest_head(contest) }}
{% if contest.start_time %}
<br>
{% if contest.time_before_start %}
<span class="time">{{ _('Starting in %(countdown)s.', countdown=contest.start_time|as_countdown) }}</span>
{% endif %}
{{ time_left(contest) }}
{% endif %}
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<i>{{ _('There are no scheduled contests at this time.') }}</i>
<br>
{% endif %}
<br>
{% if past_contests %}
<h3 class="contest-group-header">{{ _('Past Contests') }}</h3>
{% if page_obj and page_obj.num_pages > 1 %}
<div style="margin-bottom: 4px;">
{% include "list-pages.html" %}
</div>
{% endif %}
<table class="contest-list table striped">
<thead>
<tr> <tr>
<th style="width:90%"> <td>
<a class="contest-list-sort" href="{{ sort_links.name }}">{{ _('Contest') }}{{ sort_order.name }}</a> <div class="contest-block">
</th> {{ contest_head(contest) }}
<th> {% if contest.start_time %}
<a class="contest-list-sort" href="{{ sort_links.user_count }}">{{ _('Users') }}{{ sort_order.user_count }}</a> <br>
</th> {% if contest.time_limit %}
{% if not request.in_contest %} <span class="time">
<th style="width:15%"></th> {% trans countdown=participation.end_time|as_countdown %}Window ends in {{countdown}}{% endtrans %}
{% endif %} </span>
</tr> {% elif contest.time_before_end %}
</thead> <span class="time">{% trans countdown=contest.end_time|as_countdown %}Ends in {{countdown}}{% endtrans %}</span>
<tbody>
{% for contest in past_contests %}
<tr>
<td>
<div class="contest-block">
{{ contest_head(contest) }}
{{ time_left(contest) }}
</div>
</td>
<td>
{{ user_count(contest, request.user) }}
</td>
{% if not request.in_contest %}
<td><form action="{{ url('contest_join', contest.key) }}" method="post">
{% csrf_token %}
<input type="submit" class="unselectable button full small"
value="{{ _('Virtual join') }}">
</form>
</td>
{% endif %} {% endif %}
</tr> {{ time_left(contest) }}
{% endfor %} {% endif %}
</tbody> </div>
</table> </td>
{% if page_obj and page_obj.num_pages > 1 %} <td>
<div style="margin-top: 10px;"> {{ user_count(contest, request.user) }}
{% include "list-pages.html" %} </td>
</div> {{ contest_join(contest, request) }}
</tr>
{% endwith %}
{% endfor %}
</tbody>
</table>
</div>
<br>
{% endif %}
{% if current_contests %}
<h3 class="toggle open contest-group-header">
<i class="fa fa-chevron-right fa-fw"></i>
{{ _('Ongoing Contests') }}
</h3>
<div id="ongoing-table" class="toggled">
<table class="contest-list table striped">
<thead>
<tr>
<th style="width:90%">{{ _('Contest') }}</th>
<th>{{ _('Users') }}</th>
{% if not request.in_contest %}
<th style="width:15%"></th>
{% endif %}
</tr>
</thead>
<tbody>
{% for contest in current_contests %}
<tr>
<td>
<div class="contest-block">
{{ contest_head(contest) }}
{% if contest.start_time %}
<br>
{% if contest.time_before_end %}
<span class="time">{% trans countdown=contest.end_time|as_countdown %}Ends in {{countdown}}{% endtrans %}</span>
{% endif %}
{{ time_left(contest) }}
{% endif %}
</div>
</td>
<td>
{{ user_count(contest, request.user) }}
</td>
{{ contest_join(contest, request) }}
</tr>
{% endfor %}
</tbody>
</table>
<br>
</div>
{% endif %}
<h3 class="toggle open contest-group-header">
<i class="fa fa-chevron-right fa-fw"></i>
{{ _('Upcoming Contests') }}
</h3>
{% if future_contests %}
<div class="toggled">
<table class="contest-list table striped">
<thead>
<tr>
<th>{{ _('Contest') }}</th>
</tr>
</thead>
<tbody>
{% for contest in future_contests %}
<tr>
<td>
<div class="contest-block">
{{ contest_head(contest) }}
{% if contest.start_time %}
<br>
{% if contest.time_before_start %}
<span class="time">{{ _('Starting in %(countdown)s.', countdown=contest.start_time|as_countdown) }}</span>
{% endif %}
{{ time_left(contest) }}
{% endif %}
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<i>{{ _('There are no scheduled contests at this time.') }}</i>
<br>
{% endif %}
<br>
{% if past_contests %}
<h3 class="contest-group-header">{{ _('Past Contests') }}</h3>
{% if page_obj and page_obj.num_pages > 1 %}
<div style="margin-bottom: 4px;">
{% include "list-pages.html" %}
</div>
{% endif %}
<table class="contest-list table striped">
<thead>
<tr>
<th style="width:90%">
<a class="contest-list-sort" href="{{ sort_links.name }}">{{ _('Contest') }}{{ sort_order.name }}</a>
</th>
<th>
<a class="contest-list-sort" href="{{ sort_links.user_count }}">{{ _('Users') }}{{ sort_order.user_count }}</a>
</th>
{% if not request.in_contest %}
<th style="width:15%"></th>
{% endif %} {% endif %}
{% endif %} </tr>
</div> </thead>
<tbody>
{% for contest in past_contests %}
<tr>
<td>
<div class="contest-block">
{{ contest_head(contest) }}
{{ time_left(contest) }}
</div>
</td>
<td>
{{ user_count(contest, request.user) }}
</td>
{% if not request.in_contest %}
<td><form action="{{ url('contest_join', contest.key) }}" method="post">
{% csrf_token %}
<input type="submit" class="unselectable button full small"
value="{{ _('Virtual join') }}">
</form>
</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
{% if page_obj and page_obj.num_pages > 1 %}
<div style="margin-top: 10px;">
{% include "list-pages.html" %}
</div>
{% endif %}
{% endif %}
</div>
{% endblock %} {% endblock %}

View file

@ -1,212 +1,212 @@
<script src="//cdn.jsdelivr.net/npm/featherlight@1.7.14/release/featherlight.min.js" type="text/javascript" charset="utf-8"></script> <script src="//cdn.jsdelivr.net/npm/featherlight@1.7.14/release/featherlight.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript"> <script type="text/javascript">
function isFaster(time1, time2) { function isFaster(time1, time2) {
let arr1 = time1.split(':'); let arr1 = time1.split(':');
let arr2 = time2.split(':'); let arr2 = time2.split(':');
for (let i in arr1) { for (let i in arr1) {
let val1 = parseInt(arr1[i]); let val1 = parseInt(arr1[i]);
let val2 = parseInt(arr2[i]); let val2 = parseInt(arr2[i]);
if (val1 < val2) return true; if (val1 < val2) return true;
if (val1 > val2) return false; if (val1 > val2) return false;
}
return false;
} }
return false;
}
function scoretimeComparison(sub1, sub2) { function scoretimeComparison(sub1, sub2) {
if (!sub2) return true; if (!sub2) return true;
return sub1['score'] > sub2['score'] || (sub1['score'] === sub2['score'] && isFaster(sub1['time'], sub2['time'])); return sub1['score'] > sub2['score'] || (sub1['score'] === sub2['score'] && isFaster(sub1['time'], sub2['time']));
} }
function highlightFirstSolve() { function highlightFirstSolve() {
// bucket to store submissions by problems // bucket to store submissions by problems
let bestSubmissions = {}; let bestSubmissions = {};
// get information
$('td a').each(function() {
var td = $(this)[0];
var link = $(this).attr('data-featherlight');
if (link && link.includes('submissions')) {
let scoreAndTime = (td.innerText.split('\n'))
let linkElements = link.split('/')
// get information // get information
$('td a').each(function() { let problem = linkElements[linkElements.length - 2];
var td = $(this)[0]; let score = parseFloat(scoreAndTime[0].replace(',', '.'));
var link = $(this).attr('data-featherlight'); let time = scoreAndTime[1];
if (link && link.includes('submissions')) {
let scoreAndTime = (td.innerText.split('\n'))
let linkElements = link.split('/')
// get information if (time) {
let problem = linkElements[linkElements.length - 2]; let curSubmission = {
let score = parseFloat(scoreAndTime[0].replace(',', '.')); 'td': $(this).parent(),
let time = scoreAndTime[1]; 'score': score,
'time': time
}
if (time) { // update best submissions
let curSubmission = { let curBest = bestSubmissions[problem]
'td': $(this).parent(),
'score': score,
'time': time
}
// update best submissions if (scoretimeComparison(curSubmission, curBest) && score) {
let curBest = bestSubmissions[problem] bestSubmissions[problem] = curSubmission;
}
if (scoretimeComparison(curSubmission, curBest) && score) {
bestSubmissions[problem] = curSubmission;
}
}
}
})
for (let problem in bestSubmissions) {
bestSubmissions[problem]['td'].addClass('first-solve')
} }
}
})
for (let problem in bestSubmissions) {
bestSubmissions[problem]['td'].addClass('first-solve')
}
}
function renew_filter(need_update=true) {
var checkboxes = [
'#show-schools-checkbox',
'#show-fullnames-checkbox',
'#show-total-score-checkbox',
];
var checkboxes2 = [
'#show-friends-checkbox',
'#show-virtual-checkbox'
]
for (var i of checkboxes) {
var $box = $(i);
if ($box.is(':checked')) {
$box.prop('checked', false);
$box.click();
$box.prop('checked', true);
}
} }
function renew_filter(need_update=true) { var to_update = false;
var checkboxes = [ for (var i of checkboxes2) {
'#show-schools-checkbox', var $box = $(i);
'#show-fullnames-checkbox', if ($box.is(':checked')) {
'#show-total-score-checkbox', to_update = true;
]; }
var checkboxes2 = [
'#show-friends-checkbox',
'#show-virtual-checkbox'
]
for (var i of checkboxes) {
var $box = $(i);
if ($box.is(':checked')) {
$box.prop('checked', false);
$box.click();
$box.prop('checked', true);
}
}
var to_update = false;
for (var i of checkboxes2) {
var $box = $(i);
if ($box.is(':checked')) {
to_update = true;
}
}
if (to_update && need_update) {
update_ranking();
}
} }
if (to_update && need_update) {
function get_initial_rank() { update_ranking();
var ranks = $('.rank-td').map(function() {return this.innerHTML}).get();
var usernames = $('.user-name .rating a').map(function() {return this.text}).get();
window.user_rank = new Map();
for (var i = 0; i < ranks.length; i++) {
window.user_rank[usernames[i]] = ranks[i];
}
} }
}
function add_initial_friend_rank() { function get_initial_rank() {
var usernames = $('.user-name .rating a').map(function() {return this.text}).get(); var ranks = $('.rank-td').map(function() {return this.innerHTML}).get();
var usernames = $('.user-name .rating a').map(function() {return this.text}).get();
var is_virtual = []; window.user_rank = new Map();
$('.user-name').each(function() { for (var i = 0; i < ranks.length; i++) {
if($(this).children('sub').length) { window.user_rank[usernames[i]] = ranks[i];
is_virtual.push(1);
}
else is_virtual.push(0);
});
$('.rank-td').each(function(i) {
if (!is_virtual[i]) this.innerHTML += ' (' + window.user_rank[usernames[i]] + ')';
});
} }
}
function update_ranking() { function add_initial_friend_rank() {
var friend = $('#show-friends-checkbox').is(':checked'); var usernames = $('.user-name .rating a').map(function() {return this.text}).get();
var virtual = $('#show-virtual-checkbox').is(':checked');
$('#loading-gif').show();
var url = `{{url('contest_ranking_ajax', contest.key)}}?friend=${friend}&virtual=${virtual}`;
{% if page_type == 'final_ranking' %}
url += "&final=true";
{% endif %}
$.get({
url: url,
success: function(HTML) {
$('#users-table').html(HTML);
highlightFirstSolve();
renew_filter(false);
$('#loading-gif').hide();
if (!virtual && !friend) {
get_initial_rank();
}
if (friend) {
add_initial_friend_rank();
}
},
fail: function() {
console.log('Fail to update ranking');
}
});
}
$(function () { var is_virtual = [];
$('.leaving-forever').click(function () { $('.user-name').each(function() {
return confirm('{{ _('Are you sure you want to leave?') }}\n' + if($(this).children('sub').length) {
'{{ _('You cannot come back to a virtual participation. You will have to start a new one.') }}'); is_virtual.push(1);
}); }
else is_virtual.push(0);
$('.first-join').click(function () {
return confirm('{{ _('Are you sure you want to join?') }}\n' +
'{{ _('Joining a contest starts your timer, after which it becomes unstoppable.') }}');
});
var url = '{{ url('contest_participation', contest.key, '__username__') }}';
var placeholder = $('#search-contest').replaceWith($('<select>').attr({
id: 'search-contest'
})).attr('placeholder');
$('#search-contest').select2({
placeholder: placeholder,
ajax: {
url: '{{ url('contest_user_search_select2_ajax', contest.key) }}'
},
minimumInputLength: 1,
escapeMarkup: function (markup) {
return markup;
},
templateResult: function (data, container) {
return ('<img class="user-search-image" src="' + data.gravatar_url + '" width="24" height="24">' +
'<span class="' + data.display_rank + ' user-search-name">' + data.text + '</span>');
}
}).on('change', function () {
window.location.href = url.replace('__username__', $(this).val());
});
$('#show-schools-checkbox').click(function () {
$('.school').toggle();
});
$('#show-fullnames-checkbox').click(function () {
$('.fullname').toggle();
});
{% if request.user.is_authenticated %}
$('#show-friends-checkbox').click(function() {
update_ranking();
})
{% endif %}
$('#show-virtual-checkbox').click(function() {
update_ranking();
})
$('#show-total-score-checkbox').click(function() {
$('.problem-score-col').toggle();
})
highlightFirstSolve();
renew_filter();
get_initial_rank();
{% if participation_tab %}
$('#show-virtual-checkbox').hide();
$('#show-virtual-label').hide();
{% else %}
{% if request.in_contest %}
clearInterval(window.rankingInterval);
window.rankingInterval = setInterval(update_ranking, 60 * 1000);
{% endif %}
{% endif %}
}); });
$('.rank-td').each(function(i) {
if (!is_virtual[i]) this.innerHTML += ' (' + window.user_rank[usernames[i]] + ')';
});
}
function update_ranking() {
var friend = $('#show-friends-checkbox').is(':checked');
var virtual = $('#show-virtual-checkbox').is(':checked');
$('#loading-gif').show();
var url = `{{url('contest_ranking_ajax', contest.key)}}?friend=${friend}&virtual=${virtual}`;
{% if page_type == 'final_ranking' %}
url += "&final=true";
{% endif %}
$.get({
url: url,
success: function(HTML) {
$('#users-table').html(HTML);
highlightFirstSolve();
renew_filter(false);
$('#loading-gif').hide();
if (!virtual && !friend) {
get_initial_rank();
}
if (friend) {
add_initial_friend_rank();
}
},
fail: function() {
console.log('Fail to update ranking');
}
});
}
$(function () {
$('.leaving-forever').click(function () {
return confirm('{{ _('Are you sure you want to leave?') }}\n' +
'{{ _('You cannot come back to a virtual participation. You will have to start a new one.') }}');
});
$('.first-join').click(function () {
return confirm('{{ _('Are you sure you want to join?') }}\n' +
'{{ _('Joining a contest starts your timer, after which it becomes unstoppable.') }}');
});
var url = '{{ url('contest_participation', contest.key, '__username__') }}';
var placeholder = $('#search-contest').replaceWith($('<select>').attr({
id: 'search-contest'
})).attr('placeholder');
$('#search-contest').select2({
placeholder: placeholder,
ajax: {
url: '{{ url('contest_user_search_select2_ajax', contest.key) }}'
},
minimumInputLength: 1,
escapeMarkup: function (markup) {
return markup;
},
templateResult: function (data, container) {
return ('<img class="user-search-image" src="' + data.gravatar_url + '" width="24" height="24">' +
'<span class="' + data.display_rank + ' user-search-name">' + data.text + '</span>');
}
}).on('change', function () {
window.location.href = url.replace('__username__', $(this).val());
});
$('#show-schools-checkbox').click(function () {
$('.school').toggle();
});
$('#show-fullnames-checkbox').click(function () {
$('.fullname').toggle();
});
{% if request.user.is_authenticated %}
$('#show-friends-checkbox').click(function() {
update_ranking();
})
{% endif %}
$('#show-virtual-checkbox').click(function() {
update_ranking();
})
$('#show-total-score-checkbox').click(function() {
$('.problem-score-col').toggle();
})
highlightFirstSolve();
renew_filter();
get_initial_rank();
{% if participation_tab %}
$('#show-virtual-checkbox').hide();
$('#show-virtual-label').hide();
{% else %}
{% if request.in_contest %}
clearInterval(window.rankingInterval);
window.rankingInterval = setInterval(update_ranking, 60 * 1000);
{% endif %}
{% endif %}
});
</script> </script>

View file

@ -2,84 +2,84 @@
{% set page_type = 'moss' %} {% set page_type = 'moss' %}
{% block left_sidebar %} {% block left_sidebar %}
{% include "contest/contest-tabs.html" %} {% include "contest/contest-tabs.html" %}
{% endblock %} {% endblock %}
{% block two_col_media %} {% block two_col_media %}
<style> <style>
.panes { .panes {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: center; justify-content: center;
} }
.pane { .pane {
padding: 20px; padding: 20px;
} }
</style> </style>
{% endblock %} {% endblock %}
{% block two_col_js %} {% block two_col_js %}
<script type="text/javascript"> <script type="text/javascript">
$(function () { $(function () {
$('.contest-moss').click(function () { $('.contest-moss').click(function () {
return confirm('{{ _('Are you sure you want MOSS the contest?') }}'); return confirm('{{ _('Are you sure you want MOSS the contest?') }}');
}); });
}); });
$(function () { $(function () {
$('.contest-moss-delete').click(function () { $('.contest-moss-delete').click(function () {
return confirm('{{ _('Are you sure you want to delete the MOSS results?') }}'); return confirm('{{ _('Are you sure you want to delete the MOSS results?') }}');
}); });
}); });
</script> </script>
{% endblock %} {% endblock %}
{% block middle_content %} {% block middle_content %}
{% if has_results %} {% if has_results %}
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th class="header">{{ _('Problem') }}</th> <th class="header">{{ _('Problem') }}</th>
{% for lang in languages %} {% for lang in languages %}
<th class="header">{{ lang }}</th> <th class="header">{{ lang }}</th>
{% endfor %} {% endfor %}
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for problem, results in moss_results %} {% for problem, results in moss_results %}
<tr id="problem-{{ problem.code }}"> <tr id="problem-{{ problem.code }}">
<td> <td>
<a href="{{ url('problem_detail', problem.code) }}">{{ problem.name }}</a> <a href="{{ url('problem_detail', problem.code) }}">{{ problem.name }}</a>
</td> </td>
{% for result in results %} {% for result in results %}
<td> <td>
{% if result.submission_count %} {% if result.submission_count %}
<a href="{{ result.url }}">{{ result.submission_count }} {{_('submissions')}}</a> <a href="{{ result.url }}">{{ result.submission_count }} {{_('submissions')}}</a>
{% else %} {% else %}
{{ _('No submissions') }} {{ _('No submissions') }}
{% endif %} {% endif %}
</td> </td>
{% endfor %} {% endfor %}
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
{% endif %} {% endif %}
<div class="panes"> <div class="panes">
<div class="pane"> <div class="pane">
<form method="post" action="{{ url('contest_moss', contest.key) }}"> <form method="post" action="{{ url('contest_moss', contest.key) }}">
{% csrf_token %} {% csrf_token %}
<input type="submit" class="unselectable button full contest-moss" style="padding: 10px;" <input type="submit" class="unselectable button full contest-moss" style="padding: 10px;"
value="{% if has_results %} {{ _('Re-MOSS contest') }} {% else %} {{ _('MOSS contest') }} {% endif %}"> value="{% if has_results %} {{ _('Re-MOSS contest') }} {% else %} {{ _('MOSS contest') }} {% endif %}">
</form> </form>
</div>
{% if has_results %}
<div class="pane">
<form method="post" action="{{ url('contest_moss_delete', contest.key) }}">
{% csrf_token %}
<input type="submit" class="unselectable button full contest-moss-delete" style="padding: 10px;"
value="{{ _('Delete MOSS results') }}">
</form>
</div>
{% endif %}
</div> </div>
{% if has_results %}
<div class="pane">
<form method="post" action="{{ url('contest_moss_delete', contest.key) }}">
{% csrf_token %}
<input type="submit" class="unselectable button full contest-moss-delete" style="padding: 10px;"
value="{{ _('Delete MOSS results') }}">
</form>
</div>
{% endif %}
</div>
{% endblock %} {% endblock %}

View file

@ -1,4 +1,4 @@
{{ preview_data|markdown|reference|str|safe }} {{ preview_data|markdown|reference|str|safe }}
{% if REQUIRE_JAX %} {% if REQUIRE_JAX %}
<div data-config="{{ static('mathjax3_config.js') }}" class="require-mathjax-support"></div> <div data-config="{{ static('mathjax3_config.js') }}" class="require-mathjax-support"></div>
{% endif %} {% endif %}

View file

@ -1,20 +1,20 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block body %} {% block body %}
{% if error.is_private %} {% if error.is_private %}
<p><i>{{ _('This contest is private to specific users.') }}</i></p> <p><i>{{ _('This contest is private to specific users.') }}</i></p>
{% endif %} {% endif %}
{% if error.is_organization_private %} {% if error.is_organization_private %}
{% if error.is_private %} {% if error.is_private %}
<p>{{ _('Additionally, only the following organizations may access this contest:') }}</p> <p>{{ _('Additionally, only the following organizations may access this contest:') }}</p>
{% else %} {% else %}
<p>{{ _('Only the following organizations may access this contest:') }}</p> <p>{{ _('Only the following organizations may access this contest:') }}</p>
{% endif %}
<ul>
{% for org in error.orgs %}
<li><a href="{{ org.get_absolute_url() }}">{{ org.name }}</a></li>
{% endfor %}
</ul>
{% endif %} {% endif %}
<ul>
{% for org in error.orgs %}
<li><a href="{{ org.get_absolute_url() }}">{{ org.name }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% endblock %} {% endblock %}

View file

@ -1,102 +1,102 @@
<style> <style>
#users-table .username { #users-table .username {
min-width: 15em; min-width: 15em;
} }
#users-table td { #users-table td {
height: 2.5em; height: 2.5em;
} }
#users-table a { #users-table a {
display: block; display: block;
} }
.userinfo a, .user-name a, .user-name form { .userinfo a, .user-name a, .user-name form {
display: inline !important; display: inline !important;
} }
#users-table td a:hover { #users-table td a:hover {
text-decoration: underline; text-decoration: underline;
} }
.rank { .rank {
min-width: 2.5em min-width: 2.5em
} }
.points { .points {
min-width: 2.5em; min-width: 2.5em;
} }
.start-time { .start-time {
display: none; display: none;
} }
.user-name { .user-name {
position: relative; position: relative;
padding-left: 2em !important; padding-left: 2em !important;
} }
.organization-column { .organization-column {
display: none; display: none;
text-align: left !important; text-align: left !important;
border-right: none !important; border-right: none !important;
} }
.featherlight-content {
border-radius: 10px;
height: 80%;
width: 60%;
overflow: auto;
}
.select2-selection__arrow {
display: none;
}
.select2-selection__rendered {
cursor: text;
overflow: initial !important
}
.select2-results__option {
white-space: nowrap;
}
#search-contest, #search-contest + .select2 {
margin-top: 0.5em;
}
#search-contest {
width: 200px;
height: 2.3em;
}
html.with-featherlight {
overflow: unset;
}
@media (max-width: 799px) {
.featherlight-content { .featherlight-content {
border-radius: 10px; width: 95%;
height: 80%;
width: 60%;
overflow: auto;
} }
#users-table .username {
.select2-selection__arrow { min-width: fit-content;
display: none;
}
.select2-selection__rendered {
cursor: text;
overflow: initial !important
}
.select2-results__option {
white-space: nowrap;
}
#search-contest, #search-contest + .select2 {
margin-top: 0.5em;
}
#search-contest {
width: 200px;
height: 2.3em;
}
html.with-featherlight {
overflow: unset;
}
@media (max-width: 799px) {
.featherlight-content {
width: 95%;
}
#users-table .username {
min-width: fit-content;
}
} }
}
</style> </style>
{% if has_rating %} {% if has_rating %}
<style>#users-table .rate-box { <style>#users-table .rate-box {
font-size: 0.85em; font-size: 0.85em;
float: left; float: left;
} }
#users-table td:nth-child(1) .rating { #users-table td:nth-child(1) .rating {
margin-left: 1.25em; margin-left: 1.25em;
display: block; display: block;
} }
#users-table td:nth-child(2) a { #users-table td:nth-child(2) a {
display: block; display: block;
} }
</style> </style>
{% endif %} {% endif %}

View file

@ -3,77 +3,77 @@
{% set friends = request.profile.get_friends() if request.user.is_authenticated else {} %} {% set friends = request.profile.get_friends() if request.user.is_authenticated else {} %}
{% block after_rank_head %} {% block after_rank_head %}
{% if has_rating %} {% if has_rating %}
<th class="rating-column">{{ _('Rating') }}</th> <th class="rating-column">{{ _('Rating') }}</th>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block after_rank %} {% block after_rank %}
{% if has_rating %} {% if has_rating %}
<td class="rating-column">{% if user.participation_rating %}{{ rating_number(user.participation_rating) }}{% endif %}</td> <td class="rating-column">{% if user.participation_rating %}{{ rating_number(user.participation_rating) }}{% endif %}</td>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block user_footer %} {% block user_footer %}
{% if user.user.first_name %} {% if user.user.first_name %}
<div style="font-weight: 600; display: none" class="fullname gray"> <div style="font-weight: 600; display: none" class="fullname gray">
{{ user.user.first_name if user.user.first_name else ''}} {{ user.user.first_name if user.user.first_name else ''}}
</div> </div>
{% endif %} {% endif %}
{% if user.user.last_name %} {% if user.user.last_name %}
<div class="school gray" style="display: none"><a style="font-weight: 600"> <div class="school gray" style="display: none"><a style="font-weight: 600">
{{- user.user.last_name -}} {{- user.user.last_name -}}
</a></div> </a></div>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block user_data %} {% block user_data %}
{% if user.participation.virtual %} {% if user.participation.virtual %}
<sub class="gray">[{{user.participation.virtual}}]</sub> <sub class="gray">[{{user.participation.virtual}}]</sub>
{% endif %} {% endif %}
{% if can_edit %} {% if can_edit %}
<span class="contest-participation-operation"> <span class="contest-participation-operation">
<form action="{{ url('contest_participation_disqualify', contest.key) }}" method="post"> <form action="{{ url('contest_participation_disqualify', contest.key) }}" method="post">
{% csrf_token %} {% csrf_token %}
<input type="hidden" name="participation" value="{{ user.participation.id }}"> <input type="hidden" name="participation" value="{{ user.participation.id }}">
{% if user.participation.is_disqualified %} {% if user.participation.is_disqualified %}
<a href="#" title="{{ _('Un-Disqualify') }}" <a href="#" title="{{ _('Un-Disqualify') }}"
class="un-disqualify-participation"><i class="fa fa-undo fa-fw"></i></a> class="un-disqualify-participation"><i class="fa fa-undo fa-fw"></i></a>
{% else %} {% else %}
<a href="#" title="{{ _('Disqualify') }}" <a href="#" title="{{ _('Disqualify') }}"
class="disqualify-participation"><i class="fa fa-trash fa-fw"></i></a> class="disqualify-participation"><i class="fa fa-trash fa-fw"></i></a>
{% endif %} {% endif %}
</form> </form>
{% if perms.judge.change_contestparticipation %} {% if perms.judge.change_contestparticipation %}
<a href="{{ url('admin:judge_contestparticipation_change', user.participation.id) }}" <a href="{{ url('admin:judge_contestparticipation_change', user.participation.id) }}"
title="{{ _('Admin') }}" class="edit-participation"><i class="fa fa-cog fa-fw"></i></a> title="{{ _('Admin') }}" class="edit-participation"><i class="fa fa-cog fa-fw"></i></a>
{% endif %} {% endif %}
</span> </span>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block before_point_head %} {% block before_point_head %}
<th class="full-name" style="display:none;">{{ _('Fullname') }}</th> <th class="full-name" style="display:none;">{{ _('Fullname') }}</th>
<th style="display:none;">{{ _('School') }}</th> <th style="display:none;">{{ _('School') }}</th>
{% for problem in problems %} {% for problem in problems %}
<th class="points header problem-score-col" title="{{ problem.problem.name }}"><a href="{{ url('problem_detail', problem.problem.code) }}"> <th class="points header problem-score-col" title="{{ problem.problem.name }}"><a href="{{ url('problem_detail', problem.problem.code) }}">
{{- contest.get_label_for_problem(loop.index0) }} {{- contest.get_label_for_problem(loop.index0) }}
<div class="point-denominator">{{ problem.points }}</div> <div class="point-denominator">{{ problem.points }}</div>
<div class="problem-code" style="display: none;">{{ problem.problem.code }}</div> <div class="problem-code" style="display: none;">{{ problem.problem.code }}</div>
</a></th> </a></th>
{% endfor %} {% endfor %}
{% endblock %} {% endblock %}
{% block row_extra %} {% block row_extra %}
class="{{ 'disqualified' if user.participation.is_disqualified }} {{'highlight' if user.username == request.user.username}}" class="{{ 'disqualified' if user.participation.is_disqualified }} {{'highlight' if user.username == request.user.username}}"
{% endblock %} {% endblock %}
{% block before_point %} {% block before_point %}
{% for cell in user.problem_cells %} {% for cell in user.problem_cells %}
{{ cell }} {{ cell }}
{% endfor %} {% endfor %}
{% endblock %} {% endblock %}
{% block point %} {% block point %}
{{ user.result_cell }} {{ user.result_cell }}
{% endblock %} {% endblock %}

View file

@ -1,160 +1,160 @@
{% extends "user/base-users-two-col.html" %} {% extends "user/base-users-two-col.html" %}
{% block left_sidebar %} {% block left_sidebar %}
{% include "contest/contest-tabs.html" %} {% include "contest/contest-tabs.html" %}
{% endblock %} {% endblock %}
{% block users_media %} {% block users_media %}
{% include "contest/ranking-css.html" %} {% include "contest/ranking-css.html" %}
{% endblock %} {% endblock %}
{% block users_js_media %} {% block users_js_media %}
{% if can_edit %} {% if can_edit %}
<script type="text/javascript"> <script type="text/javascript">
$(function () { $(function () {
$('a.disqualify-participation').click(function (e) { $('a.disqualify-participation').click(function (e) {
e.preventDefault(); e.preventDefault();
if (e.ctrlKey || e.metaKey || confirm("{{ _('Are you sure you want to disqualify this participation?') }}")) if (e.ctrlKey || e.metaKey || confirm("{{ _('Are you sure you want to disqualify this participation?') }}"))
$(this).closest('form').submit(); $(this).closest('form').submit();
}) })
$('a.un-disqualify-participation').click(function (e) { $('a.un-disqualify-participation').click(function (e) {
e.preventDefault(); e.preventDefault();
if (e.ctrlKey || e.metaKey || confirm("{{ _('Are you sure you want to un-disqualify this participation?') }}")) if (e.ctrlKey || e.metaKey || confirm("{{ _('Are you sure you want to un-disqualify this participation?') }}"))
$(this).closest('form').submit(); $(this).closest('form').submit();
}) })
});
</script>
{% endif %}
{% if perms.judge.change_contestparticipation %}
<script type="text/javascript">
$(function () {
$('td.user').find('a.user-name').click(function (e) {
var data = $(this).siblings('.edit-participation');
if (e.altKey && data.length) {
window.open(data.attr('data-link'), '_blank');
return false;
}
});
});
</script>
{% endif %}
{% if not contest.ended %}
<script type="text/javascript">
$(function () {
window.install_tooltips = function () {
$('td.user').find('a.user-name').each(function () {
var link = $(this);
link.mouseenter(function (e) {
var start_time = link.siblings('.start-time').text();
link.addClass('tooltipped tooltipped-e').attr('aria-label', start_time);
}).mouseleave(function (e) {
link.removeClass('tooltipped tooltipped-e').removeAttr('aria-label');
}); });
</script> });
{% endif %} };
{% if perms.judge.change_contestparticipation %}
<script type="text/javascript">
$(function () {
$('td.user').find('a.user-name').click(function (e) {
var data = $(this).siblings('.edit-participation');
if (e.altKey && data.length) {
window.open(data.attr('data-link'), '_blank');
return false;
}
});
});
</script>
{% endif %}
{% if not contest.ended %}
<script type="text/javascript">
$(function () {
window.install_tooltips = function () {
$('td.user').find('a.user-name').each(function () {
var link = $(this);
link.mouseenter(function (e) {
var start_time = link.siblings('.start-time').text();
link.addClass('tooltipped tooltipped-e').attr('aria-label', start_time);
}).mouseleave(function (e) {
link.removeClass('tooltipped tooltipped-e').removeAttr('aria-label');
});
});
};
install_tooltips(); install_tooltips();
}); });
</script> </script>
{% endif %} {% endif %}
{% if page_type == 'ranking' or page_type == 'final_ranking' %} {% if page_type == 'ranking' or page_type == 'final_ranking' %}
<script type="text/javascript"> <script type="text/javascript">
$.fn.ignore = function(sel) { $.fn.ignore = function(sel) {
return this.clone().find(sel || '>*').remove().end(); return this.clone().find(sel || '>*').remove().end();
}; };
function download_ranking_as_csv() { function download_ranking_as_csv() {
function clean_text(text) { function clean_text(text) {
// Remove new line and leading/trailing spaces // Remove new line and leading/trailing spaces
text = text.replace(/(\r\n|\n|\r)/gm, '').trim(); text = text.replace(/(\r\n|\n|\r)/gm, '').trim();
// Escape double-quote with double-double-quote // Escape double-quote with double-double-quote
text = text.replace(/"/g, '""'); text = text.replace(/"/g, '""');
return '"' + text + '"'; return '"' + text + '"';
} }
var csv = []; var csv = [];
$('table#users-table thead tr').each(function () { $('table#users-table thead tr').each(function () {
var header = []; var header = [];
$(this).find('th').each(function () { $(this).find('th').each(function () {
var $col = $(this); var $col = $(this);
if ($col.hasClass('rating-column')) { if ($col.hasClass('rating-column')) {
return; return;
} else if ($col.hasClass('problem-score-col')) { } else if ($col.hasClass('problem-score-col')) {
header.push(clean_text($col.find('.problem-code').text())); header.push(clean_text($col.find('.problem-code').text()));
} else { } else {
header.push(clean_text($col.text())); header.push(clean_text($col.text()));
}
});
csv.push(header.join(','));
});
$('table#users-table tbody tr').each(function () {
var row_data = [];
$(this).find('td').each(function () {
var $col = $(this);
if ($col.hasClass('rating-column')) {
return;
} else if ($col.hasClass('user-name')) {
row_data.push(clean_text($col.ignore('.fullname').ignore('.school').text()));
row_data.push(clean_text($col.ignore('.user').ignore('.school').text()));
row_data.push(clean_text($col.ignore('.user').ignore('.fullname').text()));
} else {
row_data.push(clean_text($col.ignore('.solving-time').text()));
}
});
csv.push(row_data.join(','));
});
csv = csv.join('\n');
var filename = '{{ contest.key }}_' + moment().format('MMMM Do YYYY, h:mm:ss a'); + '.csv';
var link = document.createElement('a');
link.style.display = 'none';
link.setAttribute('target', '_blank');
link.setAttribute('href', 'data:text/csv;charset=utf-8,\uFEFF' + encodeURIComponent(csv));
link.setAttribute('download', filename);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
} }
</script> });
{% endif %} csv.push(header.join(','));
{% include "contest/media-js.html" %} });
$('table#users-table tbody tr').each(function () {
var row_data = [];
$(this).find('td').each(function () {
var $col = $(this);
if ($col.hasClass('rating-column')) {
return;
} else if ($col.hasClass('user-name')) {
row_data.push(clean_text($col.ignore('.fullname').ignore('.school').text()));
row_data.push(clean_text($col.ignore('.user').ignore('.school').text()));
row_data.push(clean_text($col.ignore('.user').ignore('.fullname').text()));
} else {
row_data.push(clean_text($col.ignore('.solving-time').text()));
}
});
csv.push(row_data.join(','));
});
csv = csv.join('\n');
var filename = '{{ contest.key }}_' + moment().format('MMMM Do YYYY, h:mm:ss a'); + '.csv';
var link = document.createElement('a');
link.style.display = 'none';
link.setAttribute('target', '_blank');
link.setAttribute('href', 'data:text/csv;charset=utf-8,\uFEFF' + encodeURIComponent(csv));
link.setAttribute('download', filename);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
</script>
{% endif %}
{% include "contest/media-js.html" %}
{% endblock %} {% endblock %}
{% block before_table %} {% block before_table %}
{% include "contest/contest-datetime.html" %} {% include "contest/contest-datetime.html" %}
<div style="margin-bottom: 0.5em"> <div style="margin-bottom: 0.5em">
{% if page_type == 'participation' %} {% if page_type == 'participation' %}
{% if contest.can_see_full_scoreboard(request.user) %} {% if contest.can_see_full_scoreboard(request.user) %}
<input id="search-contest" type="text" placeholder="{{ _('View user participation') }}"> <input id="search-contest" type="text" placeholder="{{ _('View user participation') }}">
{% endif %} {% endif %}
{% endif %} {% endif %}
<input id="show-schools-checkbox" type="checkbox" style="vertical-align: bottom"> <input id="show-schools-checkbox" type="checkbox" style="vertical-align: bottom">
<label for="show-schools-checkbox" style="vertical-align: bottom; margin-right: 1em;">{{ _('Show schools') }}</label> <label for="show-schools-checkbox" style="vertical-align: bottom; margin-right: 1em;">{{ _('Show schools') }}</label>
<input id="show-fullnames-checkbox" type="checkbox" style="vertical-align: bottom"> <input id="show-fullnames-checkbox" type="checkbox" style="vertical-align: bottom">
<label for="show-fullnames-checkbox" style="vertical-align: bottom; margin-right: 1em;">{{ _('Show full name') }}</label> <label for="show-fullnames-checkbox" style="vertical-align: bottom; margin-right: 1em;">{{ _('Show full name') }}</label>
{% if request.user.is_authenticated %} {% if request.user.is_authenticated %}
<input id="show-friends-checkbox" type="checkbox" style="vertical-align: bottom;"> <input id="show-friends-checkbox" type="checkbox" style="vertical-align: bottom;">
<label for="show-friends-checkbox" style="vertical-align: bottom; margin-right: 1em;">{{ _('Show friends only') }}</label> <label for="show-friends-checkbox" style="vertical-align: bottom; margin-right: 1em;">{{ _('Show friends only') }}</label>
{% endif %} {% endif %}
<input id="show-total-score-checkbox" type="checkbox" style="vertical-align: bottom; "> <input id="show-total-score-checkbox" type="checkbox" style="vertical-align: bottom; ">
<label for="show-total-score-checkbox" style="vertical-align: bottom; margin-right: 1em;">{{ _('Total score only') }}</label> <label for="show-total-score-checkbox" style="vertical-align: bottom; margin-right: 1em;">{{ _('Total score only') }}</label>
<input id="show-virtual-checkbox" type="checkbox" style="vertical-align: bottom;"> <input id="show-virtual-checkbox" type="checkbox" style="vertical-align: bottom;">
<label id="show-virtual-label" for="show-virtual-checkbox" style="vertical-align: bottom; margin-right: 1em;">{{ _('Show virtual participation') }}</label> <label id="show-virtual-label" for="show-virtual-checkbox" style="vertical-align: bottom; margin-right: 1em;">{{ _('Show virtual participation') }}</label>
<img src="{{static('loading.gif')}}" style="height: 1em; display:none;" id="loading-gif"></img> <img src="{{static('loading.gif')}}" style="height: 1em; display:none;" id="loading-gif"></img>
<a href="#" onclick="download_ranking_as_csv()" style="float: right;"> <a href="#" onclick="download_ranking_as_csv()" style="float: right;">
<i class="fa fa-download" aria-hidden="true"></i> <i class="fa fa-download" aria-hidden="true"></i>
{{ _('Download as CSV') }} {{ _('Download as CSV') }}
</a> </a>
</div> </div>
{% endblock %} {% endblock %}
{% block users_table %} {% block users_table %}
{% include "contest/ranking-table.html" %} {% include "contest/ranking-table.html" %}
{% endblock %} {% endblock %}

View file

@ -2,82 +2,82 @@
{% set page_type = 'stats' %} {% set page_type = 'stats' %}
{% block left_sidebar %} {% block left_sidebar %}
{% include "contest/contest-tabs.html" %} {% include "contest/contest-tabs.html" %}
{% endblock %} {% endblock %}
{% block two_col_js %} {% block two_col_js %}
<script type="text/javascript">
window.stats = {{ stats }};
</script>
{% compress js %}
{% include "stats/media-js.html" %}
<script type="text/javascript"> <script type="text/javascript">
window.stats = {{ stats }}; $(function () {
draw_stacked_bar_chart(window.stats.problem_status_count, $('#problem-status-count'));
draw_bar_chart(window.stats.problem_ac_rate, $('#problem-ac-rate'));
pts_hist = draw_histogram(window.stats.problem_point[0], $('#problem-point'));
draw_pie_chart(window.stats.language_count, $('#language-count'));
draw_bar_chart(window.stats.language_ac_rate, $('#language-ac-rate'));
$('#problem-point-select').change(function() {
pts_hist.destroy();
problem = $(this).val();
pts_hist = draw_histogram(window.stats.problem_point[problem],
$('#problem-point'));
})
$('#problem-point-select').select2({
width: '10em',
});
});
</script> </script>
{% compress js %} {% endcompress %}
{% include "stats/media-js.html" %} {% include "contest/media-js.html" %}
<script type="text/javascript">
$(function () {
draw_stacked_bar_chart(window.stats.problem_status_count, $('#problem-status-count'));
draw_bar_chart(window.stats.problem_ac_rate, $('#problem-ac-rate'));
pts_hist = draw_histogram(window.stats.problem_point[0], $('#problem-point'));
draw_pie_chart(window.stats.language_count, $('#language-count'));
draw_bar_chart(window.stats.language_ac_rate, $('#language-ac-rate'));
$('#problem-point-select').change(function() {
pts_hist.destroy();
problem = $(this).val();
pts_hist = draw_histogram(window.stats.problem_point[problem],
$('#problem-point'));
})
$('#problem-point-select').select2({
width: '10em',
});
});
</script>
{% endcompress %}
{% include "contest/media-js.html" %}
{% endblock %} {% endblock %}
{% block two_col_media %} {% block two_col_media %}
<style> <style>
.chart { .chart {
margin: 10px 0; margin: 10px 0;
} }
</style> </style>
{% endblock %} {% endblock %}
{% block middle_content %} {% block middle_content %}
<h3>{{ _('Problem Status Distribution') }}</h3> <h3>{{ _('Problem Status Distribution') }}</h3>
<div id="problem-status-count" class="chart"> <div id="problem-status-count" class="chart">
<canvas></canvas> <canvas></canvas>
</div> </div>
<h3>{{ _('Problem AC Rate') }}</h3> <h3>{{ _('Problem AC Rate') }}</h3>
<div id="problem-ac-rate" class="chart"> <div id="problem-ac-rate" class="chart">
<canvas></canvas> <canvas></canvas>
</div> </div>
<h3> <h3>
{{ _('Problem Point Distribution') }}: {{ _('Problem Point Distribution') }}:
<select id="problem-point-select"> <select id="problem-point-select">
{% for name in problems %} {% for name in problems %}
<option value="{{ loop.index0 }}" class="point-dropdown"> <option value="{{ loop.index0 }}" class="point-dropdown">
{{ name }} {{ name }}
</option> </option>
{% endfor %} {% endfor %}
</select> </select>
</h3> </h3>
<div id="problem-point" class="chart"> <div id="problem-point" class="chart">
<canvas></canvas> <canvas></canvas>
</div> </div>
<h3>{{ _('Submissions by Language') }}</h3> <h3>{{ _('Submissions by Language') }}</h3>
<div id="language-count" class="chart"> <div id="language-count" class="chart">
<canvas width="400" height="300"></canvas> <canvas width="400" height="300"></canvas>
<ul class="legend"></ul> <ul class="legend"></ul>
</div> </div>
<h3>{{ _('Language AC Rate') }}</h3> <h3>{{ _('Language AC Rate') }}</h3>
<div id="language-ac-rate" class="chart"> <div id="language-ac-rate" class="chart">
<canvas></canvas> <canvas></canvas>
</div> </div>
{% endblock %} {% endblock %}

View file

@ -1,7 +1,7 @@
{% if not title %} {% if not title %}
{% include "contest/tag-title.html" %} {% include "contest/tag-title.html" %}
<br><br> <br><br>
<hr> <hr>
{% endif %} {% endif %}
{{ tag.description|markdown }} {{ tag.description|markdown }}

View file

@ -1,11 +1,11 @@
<h2 style="display:inline"> <h2 style="display:inline">
<span style="background-color: {{ tag.color }}; color: {{ tag.text_color }}" class="contest-tag"> <span style="background-color: {{ tag.color }}; color: {{ tag.text_color }}" class="contest-tag">
{{- tag.name -}} {{- tag.name -}}
</span> </span>
</h2> </h2>
{% if perms.judge.change_contesttag %} {% if perms.judge.change_contesttag %}
<div class="title-line-action"> <div class="title-line-action">
[<a href="{{ url('admin:judge_contesttag_change', tag.id) }}">{{ _('Edit') }}</a>] [<a href="{{ url('admin:judge_contesttag_change', tag.id) }}">{{ _('Edit') }}</a>]
</div> </div>
{% endif %} {% endif %}

View file

@ -1,9 +1,9 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block content_title %} {% block content_title %}
{% include "contest/tag-title.html" %} {% include "contest/tag-title.html" %}
{% endblock %} {% endblock %}
{% block body %} {% block body %}
{% include "contest/tag-ajax.html" %} {% include "contest/tag-ajax.html" %}
{% endblock %} {% endblock %}

View file

@ -1,35 +1,35 @@
{% if current_contests %} {% if current_contests %}
<div class="blog-sidebox sidebox"> <div class="blog-sidebox sidebox">
<h3>{{ _('Ongoing contests') }} <i class="fa fa-trophy"></i></h3> <h3>{{ _('Ongoing contests') }} <i class="fa fa-trophy"></i></h3>
<div class="sidebox-content"> <div class="sidebox-content">
{% for contest in current_contests %} {% for contest in current_contests %}
<div class="contest"> <div class="contest">
<div class="contest-list-title"> <div class="contest-list-title">
<a href="{{ url('contest_view', contest.key) }}">{{ contest.name }}</a> <a href="{{ url('contest_view', contest.key) }}">{{ contest.name }}</a>
</div> </div>
<div class="time"> <div class="time">
{{ _('Ends in') }} {{ _('%(countdown)s.', countdown=contest.end_time|as_countdown) }} {{ _('Ends in') }} {{ _('%(countdown)s.', countdown=contest.end_time|as_countdown) }}
</div> </div>
</div>
{% endfor %}
</div> </div>
{% endfor %}
</div> </div>
</div>
{% endif %} {% endif %}
{% if future_contests %} {% if future_contests %}
<div class="blog-sidebox sidebox"> <div class="blog-sidebox sidebox">
<h3>{{ _('Upcoming contests') }} <i class="fa fa-trophy"></i></h3> <h3>{{ _('Upcoming contests') }} <i class="fa fa-trophy"></i></h3>
<div class="sidebox-content"> <div class="sidebox-content">
{% for contest in future_contests %} {% for contest in future_contests %}
<div class="contest"> <div class="contest">
<div class="contest-list-title"> <div class="contest-list-title">
<a href="{{ url('contest_view', contest.key) }}">{{ contest.name }}</a> <a href="{{ url('contest_view', contest.key) }}">{{ contest.name }}</a>
</div> </div>
<div class="time"> <div class="time">
{{ _('Starting in %(countdown)s.', countdown=contest.start_time|as_countdown) }} {{ _('Starting in %(countdown)s.', countdown=contest.start_time|as_countdown) }}
</div> </div>
</div>
{% endfor %}
</div> </div>
{% endfor %}
</div> </div>
</div>
{% endif %} {% endif %}

View file

@ -1,32 +1,32 @@
<html> <html>
<head> <head>
<title>{{ code }} - {{ id }}</title> <title>{{ code }} - {{ id }}</title>
<style> <style>
body { body {
font-size: 16px; font-size: 16px;
font-smooth: never; font-smooth: never;
-webkit-font-smoothing: none; -webkit-font-smoothing: none;
margin-left: 50px; margin-left: 50px;
margin-right: 50px; margin-right: 50px;
margin-top: 20px; margin-top: 20px;
} }
pre { pre {
line-height: 1.3; line-height: 1.3;
font-smooth: never; font-smooth: never;
-webkit-font-smoothing: none; -webkit-font-smoothing: none;
white-space: pre-wrap; white-space: pre-wrap;
} }
</style> </style>
</head> </head>
<body> <body>
<h2>SIGSEGV: {{ id }}</h2> <h2>SIGSEGV: {{ id }}</h2>
<hr/> <hr/>
<pre>{{ description }} <pre>{{ description }}
site: fatal signal: Segmentation fault site: fatal signal: Segmentation fault
site died (signal <b>{{ code }}</b>, exit -11)<br><br><a href="javascript:history.back()">Go back</a></pre> site died (signal <b>{{ code }}</b>, exit -11)<br><br><a href="javascript:history.back()">Go back</a></pre>
{% if request.user.is_superuser and traceback %} {% if request.user.is_superuser and traceback %}
<pre>{{ traceback }}</pre> <pre>{{ traceback }}</pre>
{% endif %} {% endif %}
</body> </body>
</html> </html>

View file

@ -1,32 +1,32 @@
<script type="text/template" id="qq-template"> <script type="text/template" id="qq-template">
<div class="qq-uploader-selector qq-uploader"> <div class="qq-uploader-selector qq-uploader">
<div class="qq-upload-drop-area-selector qq-upload-drop-area" qq-hide-dropzone> <div class="qq-upload-drop-area-selector qq-upload-drop-area" qq-hide-dropzone>
<span>{{_('Drop files here to upload')}}</span> <span>{{_('Drop files here to upload')}}</span>
</div>
<div class="qq-upload-button-selector qq-upload-button">
<div>{{_('Upload file')}}</div>
</div>
<span class="qq-drop-processing-selector qq-drop-processing">
<span>Processing dropped files...</span>
<span class="qq-drop-processing-spinner-selector qq-drop-processing-spinner"></span>
</span>
<ul class="qq-upload-list-selector qq-upload-list">
<li>
<div class="qq-progress-bar-container-selector">
<div class="qq-progress-bar-selector qq-progress-bar"></div>
</div>
<span class="qq-upload-spinner-selector qq-upload-spinner"></span>
<span class="qq-edit-filename-icon-selector qq-edit-filename-icon"></span>
<span class="qq-upload-file-selector qq-upload-file"></span>
<input class="qq-edit-filename-selector qq-edit-filename" tabindex="0" type="text">
<span class="qq-upload-size-selector qq-upload-size"></span>
<a class="qq-upload-cancel-selector qq-upload-cancel" href="#">{{_('Cancel')}}</a>
<a class="qq-upload-retry-selector qq-upload-retry" href="#">{{_('Retry')}}</a>
<a class="qq-upload-delete-selector qq-upload-delete" href="#">{{_('Delete')}}</a>
<button class="qq-upload-pause-selector qq-upload-pause">{{_('Pause')}}</button>
<button class="qq-upload-continue-selector qq-upload-continue">{{_('Continue')}}</button>
<span class="qq-upload-status-text-selector qq-upload-status-text"></span>
</li>
</ul>
</div> </div>
<div class="qq-upload-button-selector qq-upload-button">
<div>{{_('Upload file')}}</div>
</div>
<span class="qq-drop-processing-selector qq-drop-processing">
<span>Processing dropped files...</span>
<span class="qq-drop-processing-spinner-selector qq-drop-processing-spinner"></span>
</span>
<ul class="qq-upload-list-selector qq-upload-list">
<li>
<div class="qq-progress-bar-container-selector">
<div class="qq-progress-bar-selector qq-progress-bar"></div>
</div>
<span class="qq-upload-spinner-selector qq-upload-spinner"></span>
<span class="qq-edit-filename-icon-selector qq-edit-filename-icon"></span>
<span class="qq-upload-file-selector qq-upload-file"></span>
<input class="qq-edit-filename-selector qq-edit-filename" tabindex="0" type="text">
<span class="qq-upload-size-selector qq-upload-size"></span>
<a class="qq-upload-cancel-selector qq-upload-cancel" href="#">{{_('Cancel')}}</a>
<a class="qq-upload-retry-selector qq-upload-retry" href="#">{{_('Retry')}}</a>
<a class="qq-upload-delete-selector qq-upload-delete" href="#">{{_('Delete')}}</a>
<button class="qq-upload-pause-selector qq-upload-pause">{{_('Pause')}}</button>
<button class="qq-upload-continue-selector qq-upload-continue">{{_('Continue')}}</button>
<span class="qq-upload-status-text-selector qq-upload-status-text"></span>
</li>
</ul>
</div>
</script> </script>

View file

@ -1,5 +1,5 @@
{% if perms.flatpages.change_flatpage %} {% if perms.flatpages.change_flatpage %}
<div class="title-line-action"> <div class="title-line-action">
[<a href="{{ url('admin:flatpages_flatpage_change', flatpage.id) }}">{{ _('Edit') }}</a>] [<a href="{{ url('admin:flatpages_flatpage_change', flatpage.id) }}">{{ _('Edit') }}</a>]
</div> </div>
{% endif %} {% endif %}

View file

@ -1,15 +1,15 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block title %}{{ flatpage.title }} - {{ SITE_LONG_NAME }}{% endblock %} {% block title %}{{ flatpage.title }} - {{ SITE_LONG_NAME }}{% endblock %}
{% block og_title %} {% block og_title %}
<meta property="og:title" content="{{ flatpage.title }} - {{ SITE_LONG_NAME }}"> <meta property="og:title" content="{{ flatpage.title }} - {{ SITE_LONG_NAME }}">
{% endblock %} {% endblock %}
{% block content_title %}{{ flatpage.title }}{% endblock %} {% block content_title %}{{ flatpage.title }}{% endblock %}
{% block header %} {% block header %}
{% include "flatpages/admin_link.html" %} {% include "flatpages/admin_link.html" %}
{% endblock %} {% endblock %}
{% block body %} {% block body %}
{{ render_django(flatpage.content) }} {{ render_django(flatpage.content) }}
{% endblock %} {% endblock %}

View file

@ -2,7 +2,7 @@
{% block title %}{{ flatpage.title }} - {{ SITE_LONG_NAME }}{% endblock %} {% block title %}{{ flatpage.title }} - {{ SITE_LONG_NAME }}{% endblock %}
{% block og_title %} {% block og_title %}
<meta property="og:title" content="{{ flatpage.title }} - {{ SITE_LONG_NAME }}"> <meta property="og:title" content="{{ flatpage.title }} - {{ SITE_LONG_NAME }}">
{% endblock %} {% endblock %}
{% block content_title %}{{ flatpage.title }}{% endblock %} {% block content_title %}{{ flatpage.title }}{% endblock %}
@ -10,5 +10,5 @@
{% block header %}{% include "flatpages/admin_link.html" %}{% endblock %} {% block header %}{% include "flatpages/admin_link.html" %}{% endblock %}
{% block body %} {% block body %}
<div class="content-description">{{ flatpage.content|markdown|reference|str|safe }}</div> <div class="content-description">{{ flatpage.content|markdown|reference|str|safe }}</div>
{% endblock %} {% endblock %}

View file

@ -1,9 +1,9 @@
{% extends "flatpages/markdown.html" %} {% extends "flatpages/markdown.html" %}
{% block body %} {% block body %}
<div class="content-description">{{ flatpage.content|markdown|reference }}</div> <div class="content-description">{{ flatpage.content|markdown|reference }}</div>
{% endblock %} {% endblock %}
{% block bodyend %} {% block bodyend %}
{% if REQUIRE_JAX %}{% include "mathjax-load.html" %}{% endif %} {% if REQUIRE_JAX %}{% include "mathjax-load.html" %}{% endif %}
{% endblock %} {% endblock %}

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block body %} {% block body %}
<h3>{{ message }}</h3> <h3>{{ message }}</h3>
{% endblock %} {% endblock %}

View file

@ -1,23 +1,23 @@
{% extends "blog/list.html" %} {% extends "blog/list.html" %}
{% block before_posts %} {% block before_posts %}
{% if i18n_config.home_page_top %} {% if i18n_config.home_page_top %}
{{ render_django(i18n_config.home_page_top, request=request, user_count=user_count, problem_count=problem_count, submission_count=submission_count, language_count=language_count, perms=perms) }} {{ render_django(i18n_config.home_page_top, request=request, user_count=user_count, problem_count=problem_count, submission_count=submission_count, language_count=language_count, perms=perms) }}
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block meta %} {% block meta %}
{% if i18n_config.meta_description %} {% if i18n_config.meta_description %}
<meta name="description" content="{{ i18n_config['meta_description'] }}"> <meta name="description" content="{{ i18n_config['meta_description'] }}">
{% endif %} {% endif %}
<script type="application/ld+json"> <script type="application/ld+json">
{ {
"@context": "https://schema.org", "@context": "https://schema.org",
"@type": "WebSite", "@type": "WebSite",
"url": "{{ DMOJ_SCHEME }}://{{ site.domain }}/", "url": "{{ DMOJ_SCHEME }}://{{ site.domain }}/",
"potentialAction": { "potentialAction": {
"@type": "SearchAction", "@type": "SearchAction",
"target": "{{ DMOJ_SCHEME }}://{{ site.domain }}/problems/?search={search_term_string}", "target": "{{ DMOJ_SCHEME }}://{{ site.domain }}/problems/?search={search_term_string}",
"query-input": "required name=search_term_string" "query-input": "required name=search_term_string"
} }
} }
</script> </script>
{% endblock %} {% endblock %}

View file

@ -1,92 +1,92 @@
{% extends "three-column-content.html" %} {% extends "three-column-content.html" %}
{% block three_col_media %} {% block three_col_media %}
<style> <style>
.middle-content { .middle-content {
max-width: 50%; max-width: 50%;
} }
ol { ol {
padding-left: 1em; padding-left: 1em;
} }
</style> </style>
{% endblock %} {% endblock %}
{% block three_col_js %} {% block three_col_js %}
<script type="text/javascript"> <script type="text/javascript">
$(function () { $(function () {
$('.vote-detail').each(function() { $('.vote-detail').each(function() {
$(this).on('click', function() { $(this).on('click', function() {
var pid = $(this).attr('pid'); var pid = $(this).attr('pid');
$('.detail').hide(); $('.detail').hide();
$('#detail-'+pid).show(); $('#detail-'+pid).show();
}) })
}) })
}); });
</script> </script>
{% endblock %} {% endblock %}
{% block left_sidebar %} {% block left_sidebar %}
<div class="left-sidebar"> <div class="left-sidebar">
{{ make_tab_item('problem', 'fa fa-list', url('internal_problem'), _('Problem')) }} {{ make_tab_item('problem', 'fa fa-list', url('internal_problem'), _('Problem')) }}
</div> </div>
{% endblock %} {% endblock %}
{% block middle_content %} {% block middle_content %}
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th>{{_('Problem')}}</th> <th>{{_('Problem')}}</th>
<th>{{_('Code')}}</th> <th>{{_('Code')}}</th>
<th>{{_('Vote count')}}</th> <th>{{_('Vote count')}}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for problem in problems %} {% for problem in problems %}
<tr> <tr>
<td><a href="{{url('problem_detail', problem.code)}}">{{problem.name}}</a></td> <td><a href="{{url('problem_detail', problem.code)}}">{{problem.name}}</a></td>
<td><a href="{{url('admin:judge_problem_change', problem.id)}}">{{problem.code}}</a></td> <td><a href="{{url('admin:judge_problem_change', problem.id)}}">{{problem.code}}</a></td>
<td><a href="#" class="vote-detail" pid="{{problem.id}}">{{problem.vote_count}}</a></td> <td><a href="#" class="vote-detail" pid="{{problem.id}}">{{problem.vote_count}}</a></td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
{% if page_obj.num_pages > 1 %} {% if page_obj.num_pages > 1 %}
<div style="margin-top:10px;">{% include "list-pages.html" %}</div> <div style="margin-top:10px;">{% include "list-pages.html" %}</div>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block right_sidebar %} {% block right_sidebar %}
<div style="display: block; width: 100%"> <div style="display: block; width: 100%">
<div><a href="{{url('admin:judge_volunteerproblemvote_changelist')}}">{{_('Admin')}}</a></div> <div><a href="{{url('admin:judge_volunteerproblemvote_changelist')}}">{{_('Admin')}}</a></div>
{% for problem in problems %} {% for problem in problems %}
<div class="detail" id="detail-{{problem.id}}" style="display: none;"> <div class="detail" id="detail-{{problem.id}}" style="display: none;">
<h3>{{_('Votes for problem') }} {{problem.name}}</h3> <h3>{{_('Votes for problem') }} {{problem.name}}</h3>
<ol> <ol>
{% for vote in problem.volunteer_user_votes.order_by('id') %} {% for vote in problem.volunteer_user_votes.order_by('id') %}
<li> <li>
<h4> {{link_user(vote.voter)}} </h4> <h4> {{link_user(vote.voter)}} </h4>
<table class="table"> <table class="table">
<tbody> <tbody>
<tr> <tr>
<td style="width:10%">{{_('Knowledge')}}</td> <td style="width:10%">{{_('Knowledge')}}</td>
<td>{{vote.knowledge_points}}</td> <td>{{vote.knowledge_points}}</td>
</tr> </tr>
<tr> <tr>
<td>{{_('Thinking')}}</td> <td>{{_('Thinking')}}</td>
<td>{{vote.thinking_points}}</td> <td>{{vote.thinking_points}}</td>
</tr> </tr>
<tr> <tr>
<td>{{_('Types')}}</td> <td>{{_('Types')}}</td>
<td>{{vote.types.all() | join(', ')}}</td> <td>{{vote.types.all() | join(', ')}}</td>
</tr> </tr>
<tr> <tr>
<td>{{_('Feedback')}}</td> <td>{{_('Feedback')}}</td>
<td>{{vote.feedback}}</td> <td>{{vote.feedback}}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</li> </li>
{% endfor %} {% endfor %}
</ol> </ol>
</div> </div>
{% endfor %} {% endfor %}
{% endblock %} {% endblock %}

View file

@ -1,13 +1,13 @@
{% extends "common-content.html" %} {% extends "common-content.html" %}
{% block description %} {% block description %}
{% cache 3600 'license_html' license.id %} {% cache 3600 'license_html' license.id %}
{{ license.text|markdown }} {{ license.text|markdown }}
{% endcache %} {% endcache %}
{% endblock %} {% endblock %}
{% block info_float %} {% block info_float %}
{% if perms.judge.change_license %} {% if perms.judge.change_license %}
<div><a href="{{ url('admin:judge_license_change', license.id) }}">{{ _('Edit') }}</a></div> <div><a href="{{ url('admin:judge_license_change', license.id) }}">{{ _('Edit') }}</a></div>
{% endif %} {% endif %}
<div><b>{{ _('Source:') }}</b> <a href="{{ license.link }}">{{ license.link }}</a></div> <div><b>{{ _('Source:') }}</b> <a href="{{ license.link }}">{{ license.link }}</a></div>
{% endblock %} {% endblock %}

View file

@ -1,31 +1,31 @@
<ul class="pagination"> <ul class="pagination">
{% if page_obj.has_previous() %} {% if page_obj.has_previous() %}
{% if page_obj.previous_page_number() == 1 and first_page_href != None %} {% if page_obj.previous_page_number() == 1 and first_page_href != None %}
<li><a href="{{ first_page_href }}">«</a></li> <li><a href="{{ first_page_href }}">«</a></li>
{% else %}
<li><a href="{{ page_prefix or '' }}{{ page_obj.previous_page_number() }}{{ page_suffix or '' }}">«</a></li>
{% endif %}
{% else %} {% else %}
<li class="disabled-page"><span>«</span></li> <li><a href="{{ page_prefix or '' }}{{ page_obj.previous_page_number() }}{{ page_suffix or '' }}">«</a></li>
{% endif %} {% endif %}
{% else %}
<li class="disabled-page"><span>«</span></li>
{% endif %}
{% for page in page_obj.page_range %} {% for page in page_obj.page_range %}
{% if not page %} {% if not page %}
<li class="disabled-page"><span>...</span></li> <li class="disabled-page"><span>...</span></li>
{% else %}
<li{% if page == page_obj.number %} class="active-page"{% endif %}><a href="
{%- if page == 1 and first_page_href != None -%}
{{ first_page_href }}
{%- else -%}
{{ page_prefix or '' }}{{ page }}{{ page_suffix or '' }}
{%- endif -%}
">{{ page }}</a></li>
{% endif %}
{% endfor %}
{% if page_obj.has_next() %}
<li><a href="{{ page_prefix or '' }}{{ page_obj.next_page_number() }}{{ page_suffix or '' }}">»</a></li>
{% else %} {% else %}
<li class="disabled-page"><span>»</span></li> <li{% if page == page_obj.number %} class="active-page"{% endif %}><a href="
{%- if page == 1 and first_page_href != None -%}
{{ first_page_href }}
{%- else -%}
{{ page_prefix or '' }}{{ page }}{{ page_suffix or '' }}
{%- endif -%}
">{{ page }}</a></li>
{% endif %} {% endif %}
{% endfor %}
{% if page_obj.has_next() %}
<li><a href="{{ page_prefix or '' }}{{ page_obj.next_page_number() }}{{ page_suffix or '' }}">»</a></li>
{% else %}
<li class="disabled-page"><span>»</span></li>
{% endif %}
</ul> </ul>

View file

@ -1,7 +1,7 @@
{% if messages %} {% if messages %}
<ul class="messages"> <ul class="messages">
{% for message in messages %} {% for message in messages %}
<li class="{{ message.tags }}">{{ message }}</li> <li class="{{ message.tags }}">{{ message }}</li>
{% endfor %} {% endfor %}
</ul> </ul>
{% endif %} {% endif %}

View file

@ -2,47 +2,47 @@
{% block body %} {% block body %}
{% if not has_notifications %} {% if not has_notifications %}
<h2 style="text-align: center;">{{ _('You have no notifications') }}</h2> <h2 style="text-align: center;">{{ _('You have no notifications') }}</h2>
{% else %} {% else %}
<table class="table"> <table class="table">
<tr> <tr>
<th>{{ _('User') }}</th> <th>{{ _('User') }}</th>
<th>{{ _('Activity') }}</th> <th>{{ _('Activity') }}</th>
<th>{{ _('Link') }}</th> <th>{{ _('Link') }}</th>
<th>{{ _('Time') }}</th> <th>{{ _('Time') }}</th>
</tr> </tr>
{% for notification in notifications %} {% for notification in notifications %}
<tr class="{{ 'highlight' if not notification.seen }}"> <tr class="{{ 'highlight' if not notification.seen }}">
<td> <td>
{% if notification.comment %} {% if notification.comment %}
{{ link_user(notification.comment.author) }} {{ link_user(notification.comment.author) }}
{% else %} {% else %}
{{ link_user(notification.author) }} {{ link_user(notification.author) }}
{% endif %} {% endif %}
</td> </td>
<td> <td>
{{ notification.category }} {{ notification.category }}
</td> </td>
<td> <td>
{% if notification.comment %} {% if notification.comment %}
<a href="{{ notification.comment.link }}#comment-{{ notification.comment.id }}">{{ page_titles[notification.comment.page] }}</a> <a href="{{ notification.comment.link }}#comment-{{ notification.comment.id }}">{{ page_titles[notification.comment.page] }}</a>
{% else %} {% else %}
{% autoescape off %} {% autoescape off %}
{{notification.html_link}} {{notification.html_link}}
{% endautoescape %} {% endautoescape %}
{% endif %} {% endif %}
</td> </td>
<td> <td>
{{ relative_time(notification.time) }} {{ relative_time(notification.time) }}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View file

@ -1,9 +1,9 @@
{% extends "organization/home-base.html" %} {% extends "organization/home-base.html" %}
{% block org_js %} {% block org_js %}
{{ form.media.js }} {{ form.media.js }}
{% endblock %} {% endblock %}
{% block middle_content %} {% block middle_content %}
{% include "organization/form.html" %} {% include "organization/form.html" %}
{% endblock %} {% endblock %}

View file

@ -1,18 +1,18 @@
{% extends "two-column-content.html" %} {% extends "two-column-content.html" %}
{% block two_col_js %} {% block two_col_js %}
{{ form.media.js }} {{ form.media.js }}
{% endblock %} {% endblock %}
{% block two_col_media %} {% block two_col_media %}
{{ form.media.css }} {{ form.media.css }}
{% endblock %} {% endblock %}
{% block left_sidebar %} {% block left_sidebar %}
{% include "user/user-left-sidebar.html" %} {% include "user/user-left-sidebar.html" %}
{% endblock %} {% endblock %}
{% block middle_content %} {% block middle_content %}
<center><h2>{{title}}</h2></center> <center><h2>{{title}}</h2></center>
{% include "organization/form.html" %} {% include "organization/form.html" %}
{% endblock %} {% endblock %}

View file

@ -1,14 +1,14 @@
{% extends "organization/home-base.html" %} {% extends "organization/home-base.html" %}
{% block three_col_js %} {% block three_col_js %}
{{ form.media.js }} {{ form.media.js }}
{% include "organization/home-js.html" %} {% include "organization/home-js.html" %}
{% endblock %} {% endblock %}
{% block three_col_media %} {% block three_col_media %}
{{ form.media.css }} {{ form.media.css }}
{% endblock %} {% endblock %}
{% block middle_content %} {% block middle_content %}
{% include "organization/form.html" %} {% include "organization/form.html" %}
{% endblock %} {% endblock %}

View file

@ -1,39 +1,39 @@
{% extends "organization/home-base.html" %} {% extends "organization/home-base.html" %}
{% block three_col_js %} {% block three_col_js %}
{{ form.media.js }} {{ form.media.js }}
{% include "organization/home-js.html" %} {% include "organization/home-js.html" %}
{% endblock %} {% endblock %}
{% block three_col_media %} {% block three_col_media %}
{{ form.media.css }} {{ form.media.css }}
{% endblock %} {% endblock %}
{% block middle_content %} {% block middle_content %}
<form action="" method="post"> <form action="" method="post">
{% csrf_token %} {% csrf_token %}
{% if form.errors %} {% if form.errors %}
<div class="alert alert-danger alert-dismissable"> <div class="alert alert-danger alert-dismissable">
<a href="#" class="close">x</a> <a href="#" class="close">x</a>
{{ form.non_field_errors() }} {{ form.non_field_errors() }}
{{ form.errors }} {{ form.errors }}
</div> </div>
{% endif %} {% endif %}
{% for field in form %} {% for field in form %}
{% if not field.is_hidden %} {% if not field.is_hidden %}
<div style="margin-bottom: 1em;"> <div style="margin-bottom: 1em;">
{{ field.errors }} {{ field.errors }}
<label for="{{field.id_for_label }}"><b>{{ field.label }}{% if field.field.required %}<span style="color:red"> * </span>{% endif %}:</b> </label> <label for="{{field.id_for_label }}"><b>{{ field.label }}{% if field.field.required %}<span style="color:red"> * </span>{% endif %}:</b> </label>
<div class="org-field-wrapper" id="org-field-wrapper-{{field.html_name }}"> <div class="org-field-wrapper" id="org-field-wrapper-{{field.html_name }}">
{{ field }} {{ field }}
</div> </div>
{% if field.help_text %} {% if field.help_text %}
<i style="display: block">{{ field.help_text|safe }}</i> <i style="display: block">{{ field.help_text|safe }}</i>
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
<button type="submit" style="display: inline;" name="action" value="Save" >{{ _('Save') }} </button> <button type="submit" style="display: inline;" name="action" value="Save" >{{ _('Save') }} </button>
<button type="submit" style="background-color: red; float: right;" name="action" value="Delete" > {{ _('Delete') }} </button> <button type="submit" style="background-color: red; float: right;" name="action" value="Delete" > {{ _('Delete') }} </button>
</form> </form>
{% endblock %} {% endblock %}

View file

@ -1,28 +1,28 @@
{% extends "organization/home-base.html" %} {% extends "organization/home-base.html" %}
{% block middle_content %} {% block middle_content %}
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th> <th>
{{_('Blog')}} {{_('Blog')}}
</th> </th>
<th> <th>
{{_('Author')}} {{_('Author')}}
</th> </th>
<th> <th>
{{_('Post time')}} {{_('Post time')}}
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for blog in blogs %} {% for blog in blogs %}
<tr> <tr>
<td><a href="{{url('edit_organization_blog', organization.id, organization.slug, blog.id)}}">{{blog.title}}</a></td> <td><a href="{{url('edit_organization_blog', organization.id, organization.slug, blog.id)}}">{{blog.title}}</a></td>
<td>{{link_users(blog.authors.all())}}</td> <td>{{link_users(blog.authors.all())}}</td>
<td>{{- blog.publish_on|date(_("N j, Y, g:i a")) -}}</td> <td>{{- blog.publish_on|date(_("N j, Y, g:i a")) -}}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
{% endblock %} {% endblock %}

View file

@ -1,38 +1,38 @@
{% extends "organization/home-base.html" %} {% extends "organization/home-base.html" %}
{% block three_col_js %} {% block three_col_js %}
{{ form.media.js }} {{ form.media.js }}
{% endblock %} {% endblock %}
{% block three_col_media %} {% block three_col_media %}
{{ form.media.css }} {{ form.media.css }}
{% endblock %} {% endblock %}
{% block middle_content %} {% block middle_content %}
<form action="" method="post"> <form action="" method="post">
{% csrf_token %} {% csrf_token %}
{% if form.errors %} {% if form.errors %}
<div class="alert alert-danger alert-dismissable"> <div class="alert alert-danger alert-dismissable">
<a href="#" class="close">x</a> <a href="#" class="close">x</a>
{{ form.non_field_errors() }} {{ form.non_field_errors() }}
{{ form.errors }} {{ form.errors }}
</div> </div>
{% endif %} {% endif %}
{% for field in form %} {% for field in form %}
{% if not field.is_hidden %} {% if not field.is_hidden %}
<div style="margin-bottom: 1em;"> <div style="margin-bottom: 1em;">
{{ field.errors }} {{ field.errors }}
<label for="{{field.id_for_label }}"><b>{{ field.label }}{% if field.field.required %}<span class="red"> * </span>{% endif %}:</b> </label> <label for="{{field.id_for_label }}"><b>{{ field.label }}{% if field.field.required %}<span class="red"> * </span>{% endif %}:</b> </label>
<div class="org-field-wrapper" id="org-field-wrapper-{{field.html_name }}"> <div class="org-field-wrapper" id="org-field-wrapper-{{field.html_name }}">
{{ field }} {{ field }}
</div> </div>
{% if field.help_text %} {% if field.help_text %}
<i style="display: block">{{ field.help_text|safe }}</i> <i style="display: block">{{ field.help_text|safe }}</i>
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
<button type="submit">{{ _('Save') }}</button> <button type="submit">{{ _('Save') }}</button>
</form> </form>
{% endblock %} {% endblock %}

View file

@ -1,88 +1,88 @@
{% extends "organization/home-base.html" %} {% extends "organization/home-base.html" %}
{% block three_col_js %} {% block three_col_js %}
{{ form.media.js }} {{ form.media.js }}
{% endblock %} {% endblock %}
{% block three_col_media %} {% block three_col_media %}
{{ form.media.css }} {{ form.media.css }}
<style> <style>
#org-field-wrapper-scoreboard_visibility, #org-field-wrapper-scoreboard_visibility,
#org-field-wrapper-points_precision, #org-field-wrapper-points_precision,
#org-field-wrapper-start_time, #org-field-wrapper-start_time,
#org-field-wrapper-end_time, #org-field-wrapper-end_time,
#org-field-wrapper-time_limit, #org-field-wrapper-time_limit,
#org-field-wrapper-format_name { #org-field-wrapper-format_name {
display: inline-flex; display: inline-flex;
} }
.problems-problem { .problems-problem {
width: 40%; width: 40%;
} }
input[type=number] { input[type=number] {
width: 5em; width: 5em;
} }
.middle-content { .middle-content {
z-index: 1; z-index: 1;
} }
#three-col-container { #three-col-container {
overflow: auto; overflow: auto;
} }
</style> </style>
{% endblock %} {% endblock %}
{% block middle_content %} {% block middle_content %}
<form action="" method="post"> <form action="" method="post">
{% csrf_token %} {% csrf_token %}
{% if form.errors %} {% if form.errors %}
<div class="alert alert-danger alert-dismissable"> <div class="alert alert-danger alert-dismissable">
<a href="#" class="close">x</a> <a href="#" class="close">x</a>
{{ form.non_field_errors() }} {{ form.non_field_errors() }}
{{ form.errors }} {{ form.errors }}
</div> </div>
{% endif %} {% endif %}
{% for field in form %} {% for field in form %}
{% if not field.is_hidden %} {% if not field.is_hidden %}
<div style="margin-bottom: 1em;"> <div style="margin-bottom: 1em;">
{{ field.errors }} {{ field.errors }}
<label for="{{field.id_for_label }}"><b>{{ field.label }}{% if field.field.required %}<span class="red"> * </span>{% endif %}:</b> </label> <label for="{{field.id_for_label }}"><b>{{ field.label }}{% if field.field.required %}<span class="red"> * </span>{% endif %}:</b> </label>
<div class="org-field-wrapper" id="org-field-wrapper-{{field.html_name }}"> <div class="org-field-wrapper" id="org-field-wrapper-{{field.html_name }}">
{{ field }} {{ field }}
</div> </div>
{% if field.help_text %} {% if field.help_text %}
<i style="display: block">{{ field.help_text|safe }}</i> <i style="display: block">{{ field.help_text|safe }}</i>
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
<hr><br> <hr><br>
{{ problems_form.management_form }} {{ problems_form.management_form }}
<i>{{_('If you run out of rows, click Save')}}</i> <i>{{_('If you run out of rows, click Save')}}</i>
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
{% for field in problems_form[0] %} {% for field in problems_form[0] %}
{% if not field.is_hidden %} {% if not field.is_hidden %}
<th> <th>
{{field.label}} {{field.label}}
</th> </th>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for form in problems_form %} {% for form in problems_form %}
<tr> <tr>
{% for field in form %} {% for field in form %}
<td class="problems-{{field.name}}" title=" <td class="problems-{{field.name}}" title="
{{ field.help_text|safe if field.help_text }}" {{ field.help_text|safe if field.help_text }}"
style="{{ 'display:none' if field.is_hidden }}" style="{{ 'display:none' if field.is_hidden }}"
>{{field}}<div class="red">{{field.errors}}</div></td> >{{field}}<div class="red">{{field.errors}}</div></td>
{% endfor %}
</tr>
{% endfor %} {% endfor %}
</tbody> </tr>
</table> {% endfor %}
<button type="submit">{{ _('Save') }}</button> </tbody>
</form> </table>
<button type="submit">{{ _('Save') }}</button>
</form>
{% endblock %} {% endblock %}

View file

@ -1,4 +1,4 @@
{% extends "contest/list.html" %} {% extends "contest/list.html" %}
{% block left_sidebar %} {% block left_sidebar %}
{% include "organization/org-left-sidebar.html" %} {% include "organization/org-left-sidebar.html" %}
{% endblock %} {% endblock %}

View file

@ -1,36 +1,36 @@
{% extends "organization/home-base.html" %} {% extends "organization/home-base.html" %}
{% block org_js %} {% block org_js %}
{{ form.media.js }} {{ form.media.js }}
<script type="text/javascript"> <script type="text/javascript">
window.django = {jQuery: $}; window.django = {jQuery: $};
function pluralidx(count) { function pluralidx(count) {
return (count == 1) ? 0 : 1; return (count == 1) ? 0 : 1;
} }
function gettext(msgid) { function gettext(msgid) {
return msgid; return msgid;
} }
function interpolate(fmt, obj, named) { function interpolate(fmt, obj, named) {
if (named) { if (named) {
return fmt.replace(/%\(\w+\)s/g, function (match) { return fmt.replace(/%\(\w+\)s/g, function (match) {
return String(obj[match.slice(2, -2)]) return String(obj[match.slice(2, -2)])
}); });
} else { } else {
return fmt.replace(/%s/g, function (match) { return fmt.replace(/%s/g, function (match) {
return String(obj.shift()) return String(obj.shift())
}); });
} }
} }
</script> </script>
{% endblock %} {% endblock %}
{% block three_col_media %} {% block three_col_media %}
{{ form.media.css }} {{ form.media.css }}
{% endblock %} {% endblock %}
{% block middle_content %} {% block middle_content %}
{% include "organization/form.html" %} {% include "organization/form.html" %}
{% endblock %} {% endblock %}

View file

@ -1,25 +1,25 @@
<form action="" method="post"> <form action="" method="post">
{% csrf_token %} {% csrf_token %}
{% if form.errors %} {% if form.errors %}
<div class="alert alert-danger alert-dismissable"> <div class="alert alert-danger alert-dismissable">
<a href="#" class="close">x</a> <a href="#" class="close">x</a>
{{ form.non_field_errors() }} {{ form.non_field_errors() }}
{{ form.errors }} {{ form.errors }}
</div>
{% endif %}
{% for field in form %}
{% if not field.is_hidden %}
<div style="margin-bottom: 1em;">
{{ field.errors }}
<label for="{{field.id_for_label }}"><b>{{ field.label }}{% if field.field.required %}<span class="red"> * </span>{% endif %}:</b> </label>
<div class="org-field-wrapper" id="org-field-wrapper-{{field.html_name }}">
{{ field }}
</div> </div>
{% endif %} {% if field.help_text %}
{% for field in form %} <i style="display: block">{{ field.help_text|safe }}</i>
{% if not field.is_hidden %}
<div style="margin-bottom: 1em;">
{{ field.errors }}
<label for="{{field.id_for_label }}"><b>{{ field.label }}{% if field.field.required %}<span class="red"> * </span>{% endif %}:</b> </label>
<div class="org-field-wrapper" id="org-field-wrapper-{{field.html_name }}">
{{ field }}
</div>
{% if field.help_text %}
<i style="display: block">{{ field.help_text|safe }}</i>
{% endif %}
</div>
{% endif %} {% endif %}
{% endfor %} </div>
<button type="submit" style="display: inline;" name="action" value="Save" >{{ _('Save') }} </button> {% endif %}
{% endfor %}
<button type="submit" style="display: inline;" name="action" value="Save" >{{ _('Save') }} </button>
</form> </form>

View file

@ -1,21 +1,21 @@
{% extends "three-column-content.html" %} {% extends "three-column-content.html" %}
{% block three_col_js %} {% block three_col_js %}
{% include "organization/home-js.html" %} {% include "organization/home-js.html" %}
{% block org_js %}{% endblock %} {% block org_js %}{% endblock %}
{% endblock %} {% endblock %}
{% block left_sidebar %} {% block left_sidebar %}
{% include "organization/org-left-sidebar.html" %} {% include "organization/org-left-sidebar.html" %}
{% endblock %} {% endblock %}
{% block right_sidebar %} {% block right_sidebar %}
{% include "organization/org-right-sidebar.html" %} {% include "organization/org-right-sidebar.html" %}
{% endblock %} {% endblock %}
{% block middle_title %} {% block middle_title %}
{% if title or content_title %} {% if title or content_title %}
<center><h2>{{ content_title if content_title else title }}</h2></center> <center><h2>{{ content_title if content_title else title }}</h2></center>
<br/> <br/>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View file

@ -1,23 +1,23 @@
<script type="text/javascript"> <script type="text/javascript">
$(function () { $(function () {
$('.time-remaining').each(function () { $('.time-remaining').each(function () {
count_down($(this)); count_down($(this));
});
$('.leave-organization').click(function () {
if (confirm('{{ _('Are you sure you want to leave this organization?') }}\n' +
{% if organization.is_open %}
'{{ _('You will have to rejoin to show up on the organization leaderboard.') }}'
{% else %}
'{{ _('You will have to request membership in order to join again.') }}'
{% endif %}
)) {
$(this).parent().submit();
}
});
$('#control-panel a').on('click', function(e) {
e.preventDefault();
navigateTo($(this));
})
}); });
$('.leave-organization').click(function () {
if (confirm('{{ _('Are you sure you want to leave this organization?') }}\n' +
{% if organization.is_open %}
'{{ _('You will have to rejoin to show up on the organization leaderboard.') }}'
{% else %}
'{{ _('You will have to request membership in order to join again.') }}'
{% endif %}
)) {
$(this).parent().submit();
}
});
$('#control-panel a').on('click', function(e) {
e.preventDefault();
navigateTo($(this));
})
});
</script> </script>

View file

@ -3,62 +3,62 @@
{% block title_ruler %}{% endblock %} {% block title_ruler %}{% endblock %}
{% block org_js %} {% block org_js %}
{% include "actionbar/media-js.html" %} {% include "actionbar/media-js.html" %}
{% endblock %} {% endblock %}
{% block three_col_media %} {% block three_col_media %}
{% include "actionbar/media-css.html" %} {% include "actionbar/media-css.html" %}
{% endblock %} {% endblock %}
{% block middle_title %} {% block middle_title %}
<div class="page-title"> <div class="page-title">
<div class="tabs" style="border: none;"> <div class="tabs" style="border: none;">
<h2><img src="{{logo_override_image}}" style="height: 3rem; vertical-align: middle"> <h2><img src="{{logo_override_image}}" style="height: 3rem; vertical-align: middle">
{{title}} {{title}}
</h2> </h2>
{% if is_member %} {% if is_member %}
<div> <div>
<a href="{{organization_subdomain}}" target="_blank">(Subdomain)</a> <a href="{{organization_subdomain}}" target="_blank">(Subdomain)</a>
</div>
{% endif %}
<span class="spacer"></span>
{% if request.user.is_authenticated %}
{% if is_member %}
{% elif organization.is_open or can_edit %}
<form method="post" action="{{ url('join_organization', organization.id, organization.slug) }}">
{% csrf_token %}
<input type="submit" class="unselectable button" value="{{ _('Join') }}">
</form>
{% else %}
<a href="{{ url('request_organization', organization.id, organization.slug) }}"
class="unselectable button">{{ _('Request membership') }}</a>
{% endif %}
{% endif %}
</div> </div>
{% endif %}
<span class="spacer"></span>
{% if request.user.is_authenticated %}
{% if is_member %}
{% elif organization.is_open or can_edit %}
<form method="post" action="{{ url('join_organization', organization.id, organization.slug) }}">
{% csrf_token %}
<input type="submit" class="unselectable button" value="{{ _('Join') }}">
</form>
{% else %}
<a href="{{ url('request_organization', organization.id, organization.slug) }}"
class="unselectable button">{{ _('Request membership') }}</a>
{% endif %}
{% endif %}
</div> </div>
</div>
{% endblock %} {% endblock %}
{% block middle_content %} {% block middle_content %}
{% block before_posts %}{% endblock %} {% block before_posts %}{% endblock %}
{% if is_member or can_edit %} {% if is_member or can_edit %}
{% for post in posts %} {% for post in posts %}
{% include "blog/content.html" %} {% include "blog/content.html" %}
{% endfor %} {% endfor %}
{% if posts.paginator.num_pages > 1 %} {% if posts.paginator.num_pages > 1 %}
<div style="margin-bottom:10px;margin-top:10px">{% include "list-pages.html" %}</div> <div style="margin-bottom:10px;margin-top:10px">{% include "list-pages.html" %}</div>
{% endif %}
{% else %}
<div class="blog-sidebox sidebox">
<h3>{{ _('About') }}<i class="fa fa-info-circle"></i></h3>
<div class="sidebox-content">
<div style="margin: 0.3em;">
{% cache 3600 'organization_html' organization.id MATH_ENGINE %}
{{ organization.about|markdown|reference|str|safe }}
{% endcache %}
</div>
</div>
</div>
{% endif %} {% endif %}
{% block after_posts %}{% endblock %} {% else %}
<div class="blog-sidebox sidebox">
<h3>{{ _('About') }}<i class="fa fa-info-circle"></i></h3>
<div class="sidebox-content">
<div style="margin: 0.3em;">
{% cache 3600 'organization_html' organization.id MATH_ENGINE %}
{{ organization.about|markdown|reference|str|safe }}
{% endcache %}
</div>
</div>
</div>
{% endif %}
{% block after_posts %}{% endblock %}
{% endblock %} {% endblock %}

View file

@ -1,49 +1,49 @@
{% extends "two-column-content.html" %} {% extends "two-column-content.html" %}
{% block two_col_media %} {% block two_col_media %}
<style> <style>
.organization-container .organization-row:last-child { .organization-container .organization-row:last-child {
border-bottom: none; border-bottom: none;
} }
.org-logo { .org-logo {
vertical-align: middle; vertical-align: middle;
height: 2em; height: 2em;
width: 2em; width: 2em;
display: inline-block; display: inline-block;
margin-right: 1em; margin-right: 1em;
margin-left: 0.5em; margin-left: 0.5em;
} }
.toggle { .toggle {
cursor: pointer; cursor: pointer;
} }
</style> </style>
{% endblock %} {% endblock %}
{% block title_ruler %}{% endblock %} {% block title_ruler %}{% endblock %}
{% block left_sidebar %} {% block left_sidebar %}
{% include "user/user-left-sidebar.html" %} {% include "user/user-left-sidebar.html" %}
{% endblock %} {% endblock %}
{% macro org_list(title, queryset) %} {% macro org_list(title, queryset) %}
{% if queryset %} {% if queryset %}
<h3 style="padding-bottom: 1em" class="toggle open"><i class="fa fa-chevron-right fa-fw"></i> {{title}} ({{queryset.count()}})</h3> <h3 style="padding-bottom: 1em" class="toggle open"><i class="fa fa-chevron-right fa-fw"></i> {{title}} ({{queryset.count()}})</h3>
<div class="organization-container toggled"> <div class="organization-container toggled">
{% for org in queryset %} {% for org in queryset %}
<a href="{{ org.get_absolute_url() }}" class="organization-row" title="{{org.about}}"> <a href="{{ org.get_absolute_url() }}" class="organization-row" title="{{org.about}}">
<img class="org-logo" data-src="{{ org.logo_override_image or static('icons/icon.png') }}"> <img class="org-logo" data-src="{{ org.logo_override_image or static('icons/icon.png') }}">
<span style="margin-right: auto">{{ org.name }}</span> <span style="margin-right: auto">{{ org.name }}</span>
<span style="font-weight: normal"><i>{{ org.member_count }} {{_('members')}}</i></span> <span style="font-weight: normal"><i>{{ org.member_count }} {{_('members')}}</i></span>
</a> </a>
{% endfor %} {% endfor %}
</div> </div>
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
{% block middle_content %} {% block middle_content %}
<a style="float: right" class="button small" href="{{url('organization_add')}}">{{_("Create group")}}</a> <a style="float: right" class="button small" href="{{url('organization_add')}}">{{_("Create group")}}</a>
{{ org_list(_('My groups'), my_organizations) }} {{ org_list(_('My groups'), my_organizations) }}
{{ org_list(_('Open groups'), open_organizations) }} {{ org_list(_('Open groups'), open_organizations) }}
{{ org_list(_('Private groups'), private_organizations) }} {{ org_list(_('Private groups'), private_organizations) }}
{% endblock %} {% endblock %}

View file

@ -4,9 +4,9 @@
{% block media %}{{ form.media.css }}{% endblock %} {% block media %}{{ form.media.css }}{% endblock %}
{% block body %} {% block body %}
<form action="" method="post" class="form-area"> <form action="" method="post" class="form-area">
{% csrf_token %} {% csrf_token %}
<table border="0" style="text-align:left">{{ form.as_table() }}</table> <table border="0" style="text-align:left">{{ form.as_table() }}</table>
<button type="submit">{{ _('Create') }}</button> <button type="submit">{{ _('Create') }}</button>
</form> </form>
{% endblock %} {% endblock %}

View file

@ -1,14 +1,14 @@
<div class="left-sidebar"> <div class="left-sidebar">
{{ make_tab_item('home', 'fa fa-home', organization.get_absolute_url(), _('Home')) }} {{ make_tab_item('home', 'fa fa-home', organization.get_absolute_url(), _('Home')) }}
{% if is_member or can_edit %} {% if is_member or can_edit %}
{{ make_tab_item('problems', 'fa fa-list', organization.get_problems_url(), _('Problems')) }} {{ make_tab_item('problems', 'fa fa-list', organization.get_problems_url(), _('Problems')) }}
{{ make_tab_item('contests', 'fa fa-trophy', organization.get_contests_url(), _('Contests')) }} {{ make_tab_item('contests', 'fa fa-trophy', organization.get_contests_url(), _('Contests')) }}
{{ make_tab_item('submissions', 'fa fa-book', organization.get_submissions_url(), _('Submissions')) }} {{ make_tab_item('submissions', 'fa fa-book', organization.get_submissions_url(), _('Submissions')) }}
{% endif %} {% endif %}
{% if is_member or can_edit or organization.is_open %} {% if is_member or can_edit or organization.is_open %}
{{ make_tab_item('users', 'fa fa-user', organization.get_users_url(), _('Members')) }} {{ make_tab_item('users', 'fa fa-user', organization.get_users_url(), _('Members')) }}
{% endif %} {% endif %}
{% if perms.judge.change_organization %} {% if perms.judge.change_organization %}
{{ make_tab_item('admin', 'fa fa-edit', url('admin:judge_organization_change', organization.id), _('Admin')) }} {{ make_tab_item('admin', 'fa fa-edit', url('admin:judge_organization_change', organization.id), _('Admin')) }}
{% endif %} {% endif %}
</div> </div>

View file

@ -1,83 +1,83 @@
<div class="right-sidebar"> <div class="right-sidebar">
{% if (is_member or can_edit) %} {% if (is_member or can_edit) %}
{% include 'contests-countdown.html' %} {% include 'contests-countdown.html' %}
{% endif %} {% endif %}
{% if can_edit or is_member %} {% if can_edit or is_member %}
<div id="control-panel" class="blog-sidebox sidebox no-dot-blog-sidebox"> <div id="control-panel" class="blog-sidebox sidebox no-dot-blog-sidebox">
<h3>{{ _('Controls') }} <i class="fa fa-cog"></i></h3> <h3>{{ _('Controls') }} <i class="fa fa-cog"></i></h3>
<ul id="control-list" class="sidebox-content" style="padding: 1em;"> <ul id="control-list" class="sidebox-content" style="padding: 1em;">
{% if can_edit %} {% if can_edit %}
<li> <li>
<div> <div>
<a href="{{ url('edit_organization', organization.id, organization.slug) }}">{{ _('Edit group') }}</a> <a href="{{ url('edit_organization', organization.id, organization.slug) }}">{{ _('Edit group') }}</a>
</div>
</li>
{% endif %}
{% if can_edit and not organization.is_open %}
<li>
<div>
<a href="{{ url('organization_requests_pending', organization.id, organization.slug) }}">{{ _('View requests') }}</a>
{% if pending_count > 0 %}
<span id="pending-count-box">
{{pending_count}}
</span>
{% endif %}
</div>
</li>
{% endif %}
{% if can_edit %}
<li>
<div>
<a href="{{ url('add_organization_member', organization.id, organization.slug) }}">{{ _('Add members') }}</a>
</div>
</li>
{% endif %}
{% if is_member %}
<li>
<div>
<a href="{{ url('add_organization_blog', organization.id, organization.slug) }}">{{ _('Add blog') }}</a>
</div>
</li>
{% endif %}
<li>
<div>
<a href="{{ url('organization_pending_blogs', organization.id, organization.slug) }}">{{ _('Pending blogs') }}</a>
{% if pending_blog_count > 0 %}
<span id="pending-count-box">
{{pending_blog_count}}
</span>
{% endif %}
</div>
</li>
{% if can_edit %}
<li>
<div>
<a href="{{ url('organization_contest_add', organization.id, organization.slug) }}">{{ _('Add contest') }}</a>
</div>
</li>
{% endif %}
{% if is_member and not can_edit %}
<li>
<form method="post" action="{{ url('leave_organization', organization.id, organization.slug) }}">
{% csrf_token %}
<a href="#" class="leave-organization">{{ _('Leave group') }}</a>
</form>
</li>
{% endif %}
</ul>
</div>
<div class="blog-sidebox sidebox">
<h3>{{ _('About') }}<i class="fa fa-info-circle"></i></h3>
<div class="sidebox-content">
<div style="margin: 0.3em;">
{% cache 3600 'organization_html' organization.id MATH_ENGINE %}
{{ organization.about|markdown|reference|str|safe }}
{% endcache %}
</div>
</div> </div>
</li>
{% endif %}
{% if can_edit and not organization.is_open %}
<li>
<div>
<a href="{{ url('organization_requests_pending', organization.id, organization.slug) }}">{{ _('View requests') }}</a>
{% if pending_count > 0 %}
<span id="pending-count-box">
{{pending_count}}
</span>
{% endif %}
</div>
</li>
{% endif %}
{% if can_edit %}
<li>
<div>
<a href="{{ url('add_organization_member', organization.id, organization.slug) }}">{{ _('Add members') }}</a>
</div>
</li>
{% endif %}
{% if is_member %}
<li>
<div>
<a href="{{ url('add_organization_blog', organization.id, organization.slug) }}">{{ _('Add blog') }}</a>
</div>
</li>
{% endif %}
<li>
<div>
<a href="{{ url('organization_pending_blogs', organization.id, organization.slug) }}">{{ _('Pending blogs') }}</a>
{% if pending_blog_count > 0 %}
<span id="pending-count-box">
{{pending_blog_count}}
</span>
{% endif %}
</div>
</li>
{% if can_edit %}
<li>
<div>
<a href="{{ url('organization_contest_add', organization.id, organization.slug) }}">{{ _('Add contest') }}</a>
</div>
</li>
{% endif %}
{% if is_member and not can_edit %}
<li>
<form method="post" action="{{ url('leave_organization', organization.id, organization.slug) }}">
{% csrf_token %}
<a href="#" class="leave-organization">{{ _('Leave group') }}</a>
</form>
</li>
{% endif %}
</ul>
</div>
<div class="blog-sidebox sidebox">
<h3>{{ _('About') }}<i class="fa fa-info-circle"></i></h3>
<div class="sidebox-content">
<div style="margin: 0.3em;">
{% cache 3600 'organization_html' organization.id MATH_ENGINE %}
{{ organization.about|markdown|reference|str|safe }}
{% endcache %}
</div> </div>
{% endif %} </div>
{% if is_member or can_edit or organization.is_open %} </div>
{% include 'top-users.html' %} {% endif %}
{% endif %} {% if is_member or can_edit or organization.is_open %}
{% include 'top-users.html' %}
{% endif %}
</div> </div>

View file

@ -1,4 +1,4 @@
{{ preview_data|markdown|reference|str|safe }} {{ preview_data|markdown|reference|str|safe }}
{% if REQUIRE_JAX %} {% if REQUIRE_JAX %}
<div data-config="{{ static('mathjax3_config.js') }}" class="require-mathjax-support"></div> <div data-config="{{ static('mathjax3_config.js') }}" class="require-mathjax-support"></div>
{% endif %} {% endif %}

View file

@ -1,4 +1,4 @@
{% extends "problem/list.html" %} {% extends "problem/list.html" %}
{% block left_sidebar %} {% block left_sidebar %}
{% include "organization/org-left-sidebar.html" %} {% include "organization/org-left-sidebar.html" %}
{% endblock %} {% endblock %}

View file

@ -1,26 +1,26 @@
{% extends "organization/home-base.html" %} {% extends "organization/home-base.html" %}
{% block middle_content %} {% block middle_content %}
<table class="table"> <table class="table">
<tr> <tr>
<th>{{ _('User:') }}</th> <th>{{ _('User:') }}</th>
<td>{{ link_user(object.user) }}</td> <td>{{ link_user(object.user) }}</td>
</tr> </tr>
<tr> <tr>
<th>{{ _('Organization:') }}</th> <th>{{ _('Organization:') }}</th>
<td> <td>
{% with org=object.organization %} {% with org=object.organization %}
<a href="{{ org.get_absolute_url() }}">{{ org.name }}</a> <a href="{{ org.get_absolute_url() }}">{{ org.name }}</a>
{% endwith %} {% endwith %}
</td> </td>
</tr> </tr>
<tr> <tr>
<th>{{ _('Time:') }}</th> <th>{{ _('Time:') }}</th>
<td>{{ object.time|date(_("N j, Y, g:i a")) }}</td> <td>{{ object.time|date(_("N j, Y, g:i a")) }}</td>
</tr> </tr>
<tr> <tr>
<th>{{ _('Reason:') }}</th> <th>{{ _('Reason:') }}</th>
<td>{{ object.reason }}</td> <td>{{ object.reason }}</td>
</tr> </tr>
</table> </table>
{% endblock %} {% endblock %}

View file

@ -1,30 +1,30 @@
{% extends "organization/home-base.html" %} {% extends "organization/home-base.html" %}
{% block middle_content %} {% block middle_content %}
{% include "organization/requests/tabs.html" %} {% include "organization/requests/tabs.html" %}
{% if requests %} {% if requests %}
<table class="table"> <table class="table">
<tr> <tr>
<th>{{ _('User') }}</th> <th>{{ _('User') }}</th>
<th>{{ _('Time') }}</th> <th>{{ _('Time') }}</th>
<th>{{ _('State') }}</th> <th>{{ _('State') }}</th>
<th>{{ _('Reason') }}</th> <th>{{ _('Reason') }}</th>
</tr> </tr>
{% for r in requests %} {% for r in requests %}
<tr id="request-{{ r.id }}"> <tr id="request-{{ r.id }}">
<td>{{ link_user(r.user) }}</td> <td>{{ link_user(r.user) }}</td>
<td> <td>
<a href="{{ url('request_organization_detail', object.id, object.slug, r.id) }}"> <a href="{{ url('request_organization_detail', object.id, object.slug, r.id) }}">
{{- r.time|date(_("N j, Y, g:i a")) -}} {{- r.time|date(_("N j, Y, g:i a")) -}}
</a> </a>
</td> </td>
<td>{{ r.state }}</td> <td>{{ r.state }}</td>
<td>{{ r.reason|truncatechars(50) }}</td> <td>{{ r.reason|truncatechars(50) }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
{% else %} {% else %}
<p>{{ _('There are no requests to approve.') }}</p> <p>{{ _('There are no requests to approve.') }}</p>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View file

@ -1,46 +1,46 @@
{% extends "organization/home-base.html" %} {% extends "organization/home-base.html" %}
{% block org_js %} {% block org_js %}
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
$("select").select2(); $("select").select2();
}); });
</script> </script>
{% endblock %} {% endblock %}
{% block middle_content %} {% block middle_content %}
{% include "messages.html" %} {% include "messages.html" %}
{% include "organization/requests/tabs.html" %} {% include "organization/requests/tabs.html" %}
{% if formset.forms %} {% if formset.forms %}
<form action="" method="post"> <form action="" method="post">
{% csrf_token %} {% csrf_token %}
{{ formset.management_form }} {{ formset.management_form }}
<table class="table"> <table class="table">
<tr> <tr>
<th>{{ _('User') }}</th> <th>{{ _('User') }}</th>
<th>{{ _('Time') }}</th> <th>{{ _('Time') }}</th>
<th>{{ _('State') }}</th> <th>{{ _('State') }}</th>
<th>{{ _('Reason') }}</th> <th>{{ _('Reason') }}</th>
{% if formset.can_delete %} {% if formset.can_delete %}
<th>{{ _('Delete?') }}</th> <th>{{ _('Delete?') }}</th>
{% endif %} {% endif %}
</tr> </tr>
{% for form in formset %} {% for form in formset %}
<tr id="request-{{ form.instance.id }}"> <tr id="request-{{ form.instance.id }}">
<td>{{ form.id }}{{ link_user(form.instance.user) }}</td> <td>{{ form.id }}{{ link_user(form.instance.user) }}</td>
<td><a href="{{ url('request_organization_detail', object.id, object.slug, form.instance.id) }}"> <td><a href="{{ url('request_organization_detail', object.id, object.slug, form.instance.id) }}">
{{ form.instance.time|date(_("N j, Y, g:i a")) }} {{ form.instance.time|date(_("N j, Y, g:i a")) }}
</a></td> </a></td>
<td>{{ form.state }}</td> <td>{{ form.state }}</td>
<td>{{ form.instance.reason|truncatechars(50) }}</td> <td>{{ form.instance.reason|truncatechars(50) }}</td>
{% if formset.can_delete %} {% if formset.can_delete %}
<td>{{ form.DELETE }}</td> <td>{{ form.DELETE }}</td>
{% endif %} {% endif %}
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
<button type="submit">{{ _('Update') }}</button> <button type="submit">{{ _('Update') }}</button>
</form> </form>
{% else %} {% else %}
<p>{{ _('There are no requests to approve.') }}</p> <p>{{ _('There are no requests to approve.') }}</p>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View file

@ -1,22 +1,22 @@
{% extends "organization/home-base.html" %} {% extends "organization/home-base.html" %}
{% block org_js %} {% block org_js %}
<script type="text/javascript"> <script type="text/javascript">
$(function () { $(function () {
$('#id_reason').keydown(function (e) { $('#id_reason').keydown(function (e) {
if (e.ctrlKey && (e.keyCode === 13 || e.keyCode === 10)) { if (e.ctrlKey && (e.keyCode === 13 || e.keyCode === 10)) {
$(this).closest('form').submit(); $(this).closest('form').submit();
} }
}); });
}); });
</script> </script>
{% endblock %} {% endblock %}
{% block middle_content %} {% block middle_content %}
<form action="" method="post" class="form-area"> <form action="" method="post" class="form-area">
{% csrf_token %} {% csrf_token %}
<p><label for="{{ form.reason.id_for_label }}"><b>{{ _('Your reason for joining:') }}</b></label></p> <p><label for="{{ form.reason.id_for_label }}"><b>{{ _('Your reason for joining:') }}</b></label></p>
<p>{{ form.reason }}</p> <p>{{ form.reason }}</p>
<button type="submit">{{ _('Request') }}</button> <button type="submit">{{ _('Request') }}</button>
</form> </form>
{% endblock %} {% endblock %}

View file

@ -1,16 +1,16 @@
<div class="tabs"> <div class="tabs">
<ul> <ul>
<li{% if tab == 'pending' %} class="active"{% endif %}> <li{% if tab == 'pending' %} class="active"{% endif %}>
<a href="{{ url('organization_requests_pending', object.id, object.slug) }}">{{ _('Pending') }}</a> <a href="{{ url('organization_requests_pending', object.id, object.slug) }}">{{ _('Pending') }}</a>
</li> </li>
<li{% if tab == 'log' %} class="active"{% endif %}> <li{% if tab == 'log' %} class="active"{% endif %}>
<a href="{{ url('organization_requests_log', object.id, object.slug) }}">{{ _('Log') }}</a> <a href="{{ url('organization_requests_log', object.id, object.slug) }}">{{ _('Log') }}</a>
</li> </li>
<li{% if tab == 'approved' %} class="active"{% endif %}> <li{% if tab == 'approved' %} class="active"{% endif %}>
<a href="{{ url('organization_requests_approved', object.id, object.slug) }}">{{ _('Approved') }}</a> <a href="{{ url('organization_requests_approved', object.id, object.slug) }}">{{ _('Approved') }}</a>
</li> </li>
<li{% if tab == 'rejected' %} class="active"{% endif %}> <li{% if tab == 'rejected' %} class="active"{% endif %}>
<a href="{{ url('organization_requests_rejected', object.id, object.slug) }}">{{ _('Rejected') }}</a> <a href="{{ url('organization_requests_rejected', object.id, object.slug) }}">{{ _('Rejected') }}</a>
</li> </li>
</ul> </ul>
</div> </div>

View file

@ -1,4 +1,4 @@
{% extends "submission/list.html" %} {% extends "submission/list.html" %}
{% block left_sidebar %} {% block left_sidebar %}
{% include "organization/org-left-sidebar.html" %} {% include "organization/org-left-sidebar.html" %}
{% endblock %} {% endblock %}

View file

@ -1,19 +1,19 @@
{% extends "user/users-table.html" %} {% extends "user/users-table.html" %}
{% block before_point_head %} {% block before_point_head %}
{% if can_edit %} {% if can_edit %}
<th class="header"></th> <th class="header"></th>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block before_point %} {% block before_point %}
{% if can_edit %} {% if can_edit %}
<td> <td>
<form action="{{ kick_url }}" method="POST" class="kick-form"> <form action="{{ kick_url }}" method="POST" class="kick-form">
{% csrf_token %} {% csrf_token %}
<input type="hidden" name="user" value="{{ user.id }}"> <input type="hidden" name="user" value="{{ user.id }}">
<a href="#" class="button small">{{ _('Kick') }}</a> <a href="#" class="button small">{{ _('Kick') }}</a>
</form> </form>
</td> </td>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View file

@ -1,46 +1,46 @@
{% extends "user/base-users-two-col.html" %} {% extends "user/base-users-two-col.html" %}
{% block users_media %} {% block users_media %}
<style> <style>
.kick-form .button { .kick-form .button {
margin: -8px 0; margin: -8px 0;
padding: 3px 12px; padding: 3px 12px;
} }
#users-table td:nth-child(3), #users-table th:nth-child(3) { #users-table td:nth-child(3), #users-table th:nth-child(3) {
text-align: left; text-align: left;
} }
#users-table td:nth-child(2), #users-table th:nth-child(2) { #users-table td:nth-child(2), #users-table th:nth-child(2) {
border-right: none; border-right: none;
} }
.rank-td { .rank-td {
font-family: "Jersey M54"; font-family: "Jersey M54";
font-size: large; font-size: large;
} }
.user-points, .user-problem-count, .rating-td { .user-points, .user-problem-count, .rating-td {
font-family: cursive; font-family: cursive;
} }
</style> </style>
{% if can_edit %} {% if can_edit %}
<style>#users-table td:nth-child(3), #users-table th:nth-child(3) { <style>#users-table td:nth-child(3), #users-table th:nth-child(3) {
border-right: none; border-right: none;
} }
</style> </style>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block users_js_media %} {% block users_js_media %}
<script type="text/javascript"> <script type="text/javascript">
$(function () { $(function () {
$('form.kick-form').find('a.button').click(function () { $('form.kick-form').find('a.button').click(function () {
$(this).parent().submit(); $(this).parent().submit();
return false; return false;
}) })
}); });
</script> </script>
{% endblock %} {% endblock %}
{% block left_sidebar %} {% block left_sidebar %}
{% include "organization/org-left-sidebar.html" %} {% include "organization/org-left-sidebar.html" %}
{% endblock %} {% endblock %}
{% block users_table %}{% include "organization/users-table.html" %}{% endblock %} {% block users_table %}{% include "organization/users-table.html" %}{% endblock %}

View file

@ -1,35 +1,35 @@
<div class="wmd-wrapper {% if image_upload_enabled %}image-upload-enabled{% endif %}"> <div class="wmd-wrapper {% if image_upload_enabled %}image-upload-enabled{% endif %}">
<div class="wmd-panel"> <div class="wmd-panel">
<div id="wmd-button-bar-{{ postfix }}"></div> <div id="wmd-button-bar-{{ postfix }}"></div>
<textarea id="wmd-input-{{ postfix }}" {{ attrs|safe }}>{{ body }}</textarea> <textarea id="wmd-input-{{ postfix }}" {{ attrs|safe }}>{{ body }}</textarea>
</div>
{% if show_preview %}
<div id="{{ postfix|safe }}-preview" data-preview-url="{{ preview_url }}" data-textarea-id="wmd-input-{{ postfix }}"
data-timeout="{{ preview_timeout or '' }}" class="wmd-panel wmd-preview dmmd-preview {{ extra_classes }}">
<div class="dmmd-preview-update"><i class="fa fa-refresh"></i> Update Preview</div>
<div class="dmmd-preview-content content-description"></div>
</div> </div>
{% if show_preview %} {% endif %}
<div id="{{ postfix|safe }}-preview" data-preview-url="{{ preview_url }}" data-textarea-id="wmd-input-{{ postfix }}" {% if image_upload_enabled %}
data-timeout="{{ preview_timeout or '' }}" class="wmd-panel wmd-preview dmmd-preview {{ extra_classes }}"> <div class="pagedown-image-upload">
<div class="dmmd-preview-update"><i class="fa fa-refresh"></i> Update Preview</div> <h2>Insert Image</h2>
<div class="dmmd-preview-content content-description"></div> <div class="form-row">
<div>
<label class="label">From the web</label>
<input class="url-input" type="text" placeholder="http://" />
</div> </div>
{% endif %} </div>
{% if image_upload_enabled %} <div class="form-row">
<div class="pagedown-image-upload"> <div>
<h2>Insert Image</h2> <label class="label">From your computer</label>
<div class="form-row"> <input class="file-input" type="file" name="image" id="file" data-action="{{ url('pagedown-image-upload') }}" accept="image/*"/>
<div>
<label class="label">From the web</label>
<input class="url-input" type="text" placeholder="http://" />
</div>
</div>
<div class="form-row">
<div>
<label class="label">From your computer</label>
<input class="file-input" type="file" name="image" id="file" data-action="{{ url('pagedown-image-upload') }}" accept="image/*"/>
</div>
</div>
<div class="submit-row">
<div class="submit-loading"></div>
<input class="submit-input show" type="submit" value="Save" name="_addanother">
<p class="deletelink-box"><a href="#" class="close-image-upload deletelink">Cancel</a></p>
</div>
</div> </div>
{% endif %} </div>
<div class="submit-row">
<div class="submit-loading"></div>
<input class="submit-input show" type="submit" value="Save" name="_addanother">
<p class="deletelink-box"><a href="#" class="close-image-upload deletelink">Cancel</a></p>
</div>
</div>
{% endif %}
</div> </div>

View file

@ -1,9 +1,9 @@
<div class="wmd-wrapper" id="{{ id }}-wmd-wrapper"> <div class="wmd-wrapper" id="{{ id }}-wmd-wrapper">
<div class="wmd-panel"> <div class="wmd-panel">
<div id="{{ id|safe }}_wmd_button_bar"></div> <div id="{{ id|safe }}_wmd_button_bar"></div>
<textarea{{ attrs|safe }}>{{ body }}</textarea> <textarea{{ attrs|safe }}>{{ body }}</textarea>
</div> </div>
{% if show_preview %} {% if show_preview %}
<div id="{{ id|safe }}_wmd_preview" class="wmd-panel wmd-preview content-description"></div> <div id="{{ id|safe }}_wmd_preview" class="wmd-panel wmd-preview content-description"></div>
{% endif %} {% endif %}
</div> </div>

Some files were not shown because too many files have changed in this diff Show more