NDOJ/templates/organization/home.html

209 lines
8.9 KiB
HTML
Raw Permalink Normal View History

2020-12-28 05:45:58 +00:00
{% extends "base.html" %}
2020-01-21 06:35:58 +00:00
2021-10-10 22:37:15 +00:00
{% block media %}
2020-12-28 05:45:58 +00:00
<style>
2021-10-10 22:37:15 +00:00
{% if request.user.is_authenticated and is_member %}
#control-panel {
display: none;
}
{% endif %}
.leave-organization, .leave-organization:hover {
color: red;
}
#control-list li {
border-bottom: 1px solid black;
}
#pending-count-box {
float: right;
text-align: center;
background: red;
color: white;
border-radius: 3px;
padding-left: 0.3em;
padding-right: 0.3em;
2020-12-28 05:45:58 +00:00
}
</style>
2021-10-10 22:37:15 +00:00
{% endblock %}
2020-12-28 05:45:58 +00:00
{% block js_media %}
2020-01-21 06:35:58 +00:00
<script type="text/javascript">
$(function () {
$('.leave-organization').click(function () {
2021-12-27 08:43:03 +00:00
if (confirm('{{ _('Are you sure you want to leave this organization?') }}\n' +
2020-01-21 06:35:58 +00:00
{% 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 %}
2021-12-27 08:43:03 +00:00
)) {
$(this).parent().submit();
}
2020-01-21 06:35:58 +00:00
});
2020-12-28 05:45:58 +00:00
$(document).ready(function () {
$('.blog-sidebar').hide();
$('#info-tab').find('a').click(function (e) {
e.preventDefault();
$('#info-tab').addClass('active');
$('#detail-tab').removeClass('active');
$('.blog-content').show();
$('.blog-sidebar').hide();
});
$('#detail-tab').find('a').click(function (e) {
e.preventDefault();
$('#detail-tab').addClass('active');
$('#info-tab').removeClass('active');
$('.blog-content').hide();
$('.blog-sidebar').show();
});
2021-11-21 04:23:03 +00:00
$('.control-button').click(function(e) {
2021-10-10 22:37:15 +00:00
e.preventDefault();
$('#control-panel').toggle("fast");
})
2020-12-28 05:45:58 +00:00
});
2020-01-21 06:35:58 +00:00
});
2021-10-10 22:37:15 +00:00
2020-01-21 06:35:58 +00:00
</script>
{% endblock %}
2021-10-10 22:37:15 +00:00
{% block title_row %}
<div class="page-title">
<div class="tabs">
<h2>{{title}}</h2>
<span class="spacer"></span>
{% if request.user.is_authenticated %}
{% if is_member or can_edit %}
{% elif organization.is_open or can_edit %}
<form method="post" action="{{ url('join_organization', organization.id, organization.slug) }}">
{% csrf_token %}
2021-12-27 08:43:03 +00:00
<input type="submit" class="unselectable button" value="{{ _('Join organization') }}" style="margin-right: 1em">
2021-10-10 22:37:15 +00:00
</form>
{% else %}
<a href="{{ url('request_organization', organization.id, organization.slug) }}"
class="unselectable button">{{ _('Request membership') }}</a>
{% endif %}
{% endif %}
2021-11-21 04:23:03 +00:00
<button class="control-button"><i class="fa fa-ellipsis-h"></i></button>
2021-10-10 22:37:15 +00:00
</div>
</div>
{% endblock %}
{% block title_ruler %} {% endblock %}
2020-12-28 05:45:58 +00:00
{% block body %}
{% block before_posts %}{% endblock %}
<div id="mobile" class="tabs">
<ul>
<li id="info-tab" class="tab active"><a href="#">
<i class="tab-icon fa fa-info-circle"></i> {{ _('Info') }}
</a></li>
<li id="detail-tab" class="tab"><a href="#"><i class="tab-icon fa fa-rss"></i> {{ _('Details') }}</a></li>
</ul>
</div>
<div id="blog-container">
<div class="blog-content sidebox">
2021-10-10 22:37:15 +00:00
<h3>{{ _('About') }}<i class="fa fa-info-circle"></i></h3>
2020-12-28 05:45:58 +00:00
<div class="sidebox-content">
<div style="margin: 1.4em;">
{% cache 3600 'organization_html' organization.id MATH_ENGINE %}
{{ organization.about|markdown('organization-about', MATH_ENGINE)|reference|str|safe }}
{% endcache %}
</div>
2020-01-21 06:35:58 +00:00
</div>
2020-12-28 05:45:58 +00:00
{% if is_member or can_edit %}
<br>
<h3>{{ _('Organization news') }} <i class="fa fa-terminal"></i></h3>
<div class="sidebox-content">
{% for post in posts %}
{% include "blog/content.html" %}
{% else %}
<div style="margin: 1.4em;">
<i>{{ _('There is no news at this time.') }}</i>
</div>
{% endfor %}
</div>
{% endif %}
2020-01-21 06:35:58 +00:00
</div>
2020-12-28 05:45:58 +00:00
<div class="blog-sidebar">
2021-10-10 22:37:15 +00:00
<div id="control-panel" class="blog-sidebox sidebox">
2020-12-28 05:45:58 +00:00
<h3>{{ _('Controls') }} <i class="fa fa-cog"></i></h3>
2021-10-10 22:37:15 +00:00
<ul id="control-list" class="sidebox-content" style="padding: 1em;">
2020-12-28 05:45:58 +00:00
{% if can_edit %}
2021-10-10 22:37:15 +00:00
<li>
2020-12-28 05:45:58 +00:00
<div>
2021-10-10 22:37:15 +00:00
<a href="{{ url('edit_organization', organization.id, organization.slug) }}">{{ _('Edit organization') }}</a>
2020-12-28 05:45:58 +00:00
</div>
2021-10-10 22:37:15 +00:00
</li>
{% if 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>
2020-12-28 05:45:58 +00:00
{% endif %}
{% endif %}
{% if perms.judge.change_organization %}
2021-10-10 22:37:15 +00:00
<li>
2020-12-28 05:45:58 +00:00
<div>
<a href="{{ url('admin:judge_organization_change', organization.id) }}">{{ _('Admin organization') }}</a>
</div>
2021-10-10 22:37:15 +00:00
</li>
2020-12-28 05:45:58 +00:00
{% endif %}
2021-10-10 22:37:15 +00:00
<li>
<div>
<a href="{{ organization.get_users_url() }}">{{ _('View members') }}</a>
</div>
</li>
{% if is_member and not can_edit %}
<li>
<form method="post" action="{{ url('leave_organization', organization.id, organization.slug) }}">
{% csrf_token %}
2021-12-27 08:43:03 +00:00
<a href="#" class="leave-organization">{{ _('Leave organization') }}</a>
2021-10-10 22:37:15 +00:00
</form>
</li>
{% endif %}
</ul>
2020-12-28 05:45:58 +00:00
</div>
{% if (is_member or can_edit) %}
{% if new_contests %}
<div class="blog-sidebox sidebox">
<h3>{{ _('New private contests') }} <i class="fa fa-trophy"></i>
</h3>
<div class="sidebox-content">
<ul class="problem-list">
{% for contest in new_contests %}
<li><a href="{{ url('contest_view', contest.key) }}">{{ contest.name }}</a></li>
{% endfor %}
2021-10-10 22:37:15 +00:00
2020-12-28 05:45:58 +00:00
</ul>
2021-10-10 22:37:15 +00:00
<hr>
<center><a target="_blank" href="{{url('contest_list')+'?orgs='+str(organization.id)}}">{{_('View all')}} <i class="fa fa-chevron-right"></i></a></center>
2020-12-28 05:45:58 +00:00
</div>
</div>
{% endif %}
{% if new_problems %}
<div class="blog-sidebox sidebox">
<h3>{{ _('New private problems') }} <i class="fa fa-puzzle-piece"></i>
</h3>
<div class="sidebox-content">
<ul class="problem-list">
{% for problem in new_problems %}
<li><a href="{{ url('problem_detail', problem.code) }}">{{ problem.name }}</a></li>
{% endfor %}
</ul>
2021-10-10 22:37:15 +00:00
<hr>
<center><a target="_blank" href="{{url('problem_list')+'?orgs='+str(organization.id)}}">{{_('View all')}} <i class="fa fa-chevron-right"></i></a></center>
2020-12-28 05:45:58 +00:00
</div>
</div>
{% endif %}
{% endif %}
</div>
2020-01-21 06:35:58 +00:00
</div>
2020-12-28 05:45:58 +00:00
{% block after_posts %}{% endblock %}
{% endblock %}