Allow to create group and its contest on UI

This commit is contained in:
cuom1999 2022-09-15 02:05:02 -05:00
parent 196e2a9bb0
commit 67ef6b9111
28 changed files with 1029 additions and 556 deletions

View file

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

View file

@ -7,11 +7,6 @@
{% block three_col_media %}
{{ form.media.css }}
<style>
#org-field-wrapper-visible, #org-field-wrapper-sticky {
display: contents;
}
</style>
{% endblock %}
{% block middle_content %}

View file

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

View file

@ -29,11 +29,6 @@
{% block three_col_media %}
{{ form.media.css }}
<style>
#org-field-wrapper-is_open {
display: contents;
}
</style>
{% endblock %}
{% block middle_content %}

View file

@ -4,18 +4,19 @@
<div class="alert alert-danger alert-dismissable">
<a href="#" class="close">x</a>
{{ form.non_field_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 }}:</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 }}">
{{ field }}
</div>
{% if field.help_text %}
<i>{{ field.help_text|safe }}</i>
<i style="display: block">{{ field.help_text|safe }}</i>
{% endif %}
</div>
{% endif %}

View file

@ -14,8 +14,8 @@
{% endblock %}
{% block middle_title %}
{% if title %}
<center><h2>{{ title }}</h2></center>
{% if title or content_title %}
<center><h2>{{ content_title if content_title else title }}</h2></center>
<br/>
{% endif %}
{% endblock %}

View file

@ -1,13 +1,6 @@
{% extends "user/base-users-three-col.html" %}
{% block users_js_media %}
<script type="text/javascript">
$(function(){
register_all_toggles();
});
</script>
{% endblock %}
{% extends "two-column-content.html" %}
{% block users_media %}
{% block two_col_media %}
<style>
.organization-row {
display: block;
@ -62,7 +55,8 @@
{% endif %}
{% endmacro %}
{% block users_table %}
{% block middle_content %}
<a style="float: right" class="button small" href="{{url('organization_add')}}">{{_("Create group")}}</a>
{{ org_list(_('My groups'), my_organizations) }}
{{ org_list(_('Open groups'), open_organizations) }}
{{ org_list(_('Private groups'), private_organizations) }}

View file

@ -49,6 +49,13 @@
{% 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) }}">

View file

@ -12,7 +12,7 @@
<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>
<a href="#" class="button small">{{ _('Kick') }}</a>
</form>
</td>
{% endif %}