Cloned DMOJ
This commit is contained in:
parent
f623974b58
commit
49dc9ff10c
513 changed files with 132349 additions and 39 deletions
48
templates/organization/edit.html
Normal file
48
templates/organization/edit.html
Normal file
|
@ -0,0 +1,48 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block js_media %}
|
||||
{{ form.media.js }}
|
||||
<script type="text/javascript">
|
||||
window.django = {jQuery: $};
|
||||
|
||||
function pluralidx(count) {
|
||||
return (count == 1) ? 0 : 1;
|
||||
}
|
||||
|
||||
function gettext(msgid) {
|
||||
return msgid;
|
||||
}
|
||||
|
||||
function interpolate(fmt, obj, named) {
|
||||
if (named) {
|
||||
return fmt.replace(/%\(\w+\)s/g, function (match) {
|
||||
return String(obj[match.slice(2, -2)])
|
||||
});
|
||||
} else {
|
||||
return fmt.replace(/%s/g, function (match) {
|
||||
return String(obj.shift())
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block media %}
|
||||
{{ form.media.css }}
|
||||
<link rel="stylesheet" href="{{ static('admin/css/widgets.css') }}" type="text/css">
|
||||
<link rel="stylesheet" href="{{ static('admin/css/pagedown.css') }}" type="text/css">
|
||||
<link rel="stylesheet" href="{{ static('problem_edit.css') }}" type="text/css">
|
||||
<style>
|
||||
#id_about {
|
||||
width: 500px;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<form action="" method="post" class="form-area">
|
||||
{% csrf_token %}
|
||||
<table border="0" style="text-align:left">{{ form.as_table() }}</table>
|
||||
<button type="submit">{{ _('Update') }}</button>
|
||||
</form>
|
||||
{% endblock %}
|
63
templates/organization/home.html
Normal file
63
templates/organization/home.html
Normal file
|
@ -0,0 +1,63 @@
|
|||
{% extends "common-content.html" %}
|
||||
|
||||
{% block content_js_media %}
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$('.leave-organization').click(function () {
|
||||
return 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 %}
|
||||
);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block info_float %}
|
||||
{% if request.user.is_authenticated %}
|
||||
{% if request.profile in organization %}
|
||||
<form method="post" action="{{ url('leave_organization', organization.id, organization.slug) }}">
|
||||
{% csrf_token %}
|
||||
<input type="submit" class="unselectable button full leave-organization" value="{{ _('Leave organization') }}">
|
||||
</form>
|
||||
{% elif organization.is_open %}
|
||||
<form method="post" action="{{ url('join_organization', organization.id, organization.slug) }}">
|
||||
{% csrf_token %}
|
||||
<input type="submit" class="unselectable button full" value="{{ _('Join organization') }}">
|
||||
</form>
|
||||
{% else %}
|
||||
<a href="{{ url('request_organization', organization.id, organization.slug) }}"
|
||||
class="unselectable button full">{{ _('Request membership') }}</a>
|
||||
{% endif %}
|
||||
<hr>
|
||||
{% endif %}
|
||||
|
||||
{% if can_edit %}
|
||||
<div><a href="{{ url('edit_organization', organization.id, organization.slug) }}">{{ _('Edit organization') }}</a></div>
|
||||
|
||||
{% if not organization.is_open %}
|
||||
<div>
|
||||
<a href="{{ url('organization_requests_pending', organization.id, organization.slug) }}">{{ _('View requests') }}</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if perms.judge.change_organization %}
|
||||
<div>
|
||||
<a href="{{ url('admin:judge_organization_change', organization.id) }}">{{ _('Admin organization') }}</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div>
|
||||
<a href="{{ organization.get_users_url() }}">{{ _('View members') }}</a>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block description %}
|
||||
{% cache 3600 'organization_html' organization.id MATH_ENGINE %}
|
||||
{{ organization.about|markdown('organization-about', MATH_ENGINE)|reference|str|safe }}
|
||||
{% endcache %}
|
||||
{% endblock %}
|
36
templates/organization/list.html
Normal file
36
templates/organization/list.html
Normal file
|
@ -0,0 +1,36 @@
|
|||
{% extends "base.html" %}
|
||||
{% block js_media %}
|
||||
<script src="{{ static('libs/tablesorter.js') }}" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$("#organization-table").tablesorter();
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block title_ruler %}{% endblock %}
|
||||
|
||||
{% block title_row %}
|
||||
{% set tab = 'organizations' %}
|
||||
{% set title = _('Organizations') %}
|
||||
{% include "user/user-list-tabs.html" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<table id="organization-table" class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:85%">{{ _('Name') }}</th>
|
||||
<th>{{ _('Members') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for org in organizations %}
|
||||
<tr>
|
||||
<td><a href="{{ org.get_absolute_url() }}">{{ org.name }}</a></td>
|
||||
<td><a href="{{ org.get_users_url() }}">{{ org.member_count }}</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock %}
|
12
templates/organization/new.html
Normal file
12
templates/organization/new.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block js_media %}{{ form.media.js }}{% endblock %}
|
||||
{% block media %}{{ form.media.css }}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<form action="" method="post" class="form-area">
|
||||
{% csrf_token %}
|
||||
<table border="0" style="text-align:left">{{ form.as_table() }}</table>
|
||||
<button type="submit">{{ _('Create') }}</button>
|
||||
</form>
|
||||
{% endblock %}
|
4
templates/organization/preview.html
Normal file
4
templates/organization/preview.html
Normal file
|
@ -0,0 +1,4 @@
|
|||
{{ preview_data|markdown('organization-about', MATH_ENGINE)|reference|str|safe }}
|
||||
{% if REQUIRE_JAX %}
|
||||
<div data-config="{{ static('mathjax_config.js') }}" class="require-mathjax-support"></div>
|
||||
{% endif %}
|
35
templates/organization/requests/detail.html
Normal file
35
templates/organization/requests/detail.html
Normal file
|
@ -0,0 +1,35 @@
|
|||
{% extends "base.html" %}
|
||||
{% block media %}
|
||||
<style>
|
||||
th {
|
||||
text-align: left
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<table>
|
||||
<tr>
|
||||
<th>{{ _('User:') }}</th>
|
||||
<td>{{ link_user(object.user) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ _('Organization:') }}</th>
|
||||
<td>
|
||||
{% with org=object.organization %}
|
||||
<a href="{{ org.get_absolute_url() }}">{{ org.name }}</a>
|
||||
{% endwith %}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ _('Time:') }}</th>
|
||||
<td>{{ object.time|date(_("N j, Y, g:i a")) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2">{{ _('Reason:') }}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" style="padding-left: 2em">{{ object.reason }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
{% endblock %}
|
30
templates/organization/requests/log.html
Normal file
30
templates/organization/requests/log.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block body %}
|
||||
{% include "organization/requests/tabs.html" %}
|
||||
|
||||
{% if requests %}
|
||||
<table>
|
||||
<tr>
|
||||
<th>{{ _('User') }}</th>
|
||||
<th>{{ _('Time') }}</th>
|
||||
<th>{{ _('State') }}</th>
|
||||
<th>{{ _('Reason') }}</th>
|
||||
</tr>
|
||||
{% for r in requests %}
|
||||
<tr id="request-{{ r.id }}">
|
||||
<td>{{ link_user(r.user) }}</td>
|
||||
<td>
|
||||
<a href="{{ url('request_organization_detail', object.id, object.slug, r.id) }}">
|
||||
{{- r.time|date(_("N j, Y, H:i")) -}}
|
||||
</a>
|
||||
</td>
|
||||
<td>{{ r.state }}</td>
|
||||
<td>{{ r.reason|truncatechars(50) }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% else %}
|
||||
<p>{{ _('There are no requests to approve.') }}</p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
39
templates/organization/requests/pending.html
Normal file
39
templates/organization/requests/pending.html
Normal file
|
@ -0,0 +1,39 @@
|
|||
{% extends "base.html" %}
|
||||
{% block body %}
|
||||
{% include "messages.html" %}
|
||||
{% include "organization/requests/tabs.html" %}
|
||||
|
||||
{% if formset.forms %}
|
||||
<form action="" method="post">
|
||||
{% csrf_token %}
|
||||
{{ formset.management_form }}
|
||||
<table>
|
||||
<tr>
|
||||
<th>{{ _('User') }}</th>
|
||||
<th>{{ _('Time') }}</th>
|
||||
<th>{{ _('State') }}</th>
|
||||
<th>{{ _('Reason') }}</th>
|
||||
{% if formset.can_delete %}
|
||||
<th>{{ _('Delete?') }}</th>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% for form in formset %}
|
||||
<tr id="request-{{ form.instance.id }}">
|
||||
<td>{{ form.id }}{{ link_user(form.instance.user) }}</td>
|
||||
<td><a href="{{ url('request_organization_detail', object.id, object.slug, form.instance.id) }}">
|
||||
{{ form.instance.time|date(_("N j, Y, H:i")) }}
|
||||
</a></td>
|
||||
<td>{{ form.state }}</td>
|
||||
<td>{{ form.instance.reason|truncatechars(50) }}</td>
|
||||
{% if formset.can_delete %}
|
||||
<td>{{ form.DELETE }}</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
<button type="submit">{{ _('Update') }}</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<p>{{ _('There are no requests to approve.') }}</p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
22
templates/organization/requests/request.html
Normal file
22
templates/organization/requests/request.html
Normal file
|
@ -0,0 +1,22 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block js_media %}
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$('#id_reason').keydown(function (e) {
|
||||
if (e.ctrlKey && (e.keyCode === 13 || e.keyCode === 10)) {
|
||||
$(this).closest('form').submit();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<form action="" method="post" class="form-area">
|
||||
{% csrf_token %}
|
||||
<p><label for="{{ form.reason.id_for_label }}"><b>{{ _('Your reason for joining:') }}</b></label></p>
|
||||
<p>{{ form.reason }}</p>
|
||||
<button type="submit">{{ _('Request') }}</button>
|
||||
</form>
|
||||
{% endblock %}
|
16
templates/organization/requests/tabs.html
Normal file
16
templates/organization/requests/tabs.html
Normal file
|
@ -0,0 +1,16 @@
|
|||
<div class="tabs">
|
||||
<ul>
|
||||
<li{% if tab == 'pending' %} class="active"{% endif %}>
|
||||
<a href="{{ url('organization_requests_pending', object.id, object.slug) }}">{{ _('Pending') }}</a>
|
||||
</li>
|
||||
<li{% if tab == 'log' %} class="active"{% endif %}>
|
||||
<a href="{{ url('organization_requests_log', object.id, object.slug) }}">{{ _('Log') }}</a>
|
||||
</li>
|
||||
<li{% if tab == 'approved' %} class="active"{% endif %}>
|
||||
<a href="{{ url('organization_requests_approved', object.id, object.slug) }}">{{ _('Approved') }}</a>
|
||||
</li>
|
||||
<li{% if tab == 'rejected' %} class="active"{% endif %}>
|
||||
<a href="{{ url('organization_requests_rejected', object.id, object.slug) }}">{{ _('Rejected') }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
19
templates/organization/users-table.html
Normal file
19
templates/organization/users-table.html
Normal file
|
@ -0,0 +1,19 @@
|
|||
{% extends "user/users-table.html" %}
|
||||
|
||||
{% block before_point_head %}
|
||||
{% if is_admin %}
|
||||
<th class="header"></th>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block before_point %}
|
||||
{% if is_admin %}
|
||||
<td>
|
||||
<form action="{{ kick_url }}" method="POST" class="kick-form">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="user" value="{{ user.id }}">
|
||||
<a href="#" class="button">{{ _('Kick') }}</a>
|
||||
</form>
|
||||
</td>
|
||||
{% endif %}
|
||||
{% endblock %}
|
33
templates/organization/users.html
Normal file
33
templates/organization/users.html
Normal file
|
@ -0,0 +1,33 @@
|
|||
{% extends "user/base-users.html" %}
|
||||
{% block users_media %}
|
||||
<style>
|
||||
#users-table td:nth-child(2), #users-table th:nth-child(2) {
|
||||
border-right: none;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.kick-form .button {
|
||||
margin: -8px 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
{% if is_admin %}
|
||||
<style>#users-table td:nth-child(3), #users-table th:nth-child(3) {
|
||||
border-right: none;
|
||||
}
|
||||
</style>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block users_js_media %}
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$('form.kick-form').find('a.button').click(function () {
|
||||
$(this).parent().submit();
|
||||
return false;
|
||||
})
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block users_table %}{% include "organization/users-table.html" %}{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue