Make file modale chooser and complete user profile

This commit is contained in:
Skia
2016-08-11 04:24:32 +02:00
parent a8858fa781
commit 43b709bfd5
40 changed files with 850 additions and 177 deletions

View File

@ -60,23 +60,25 @@
{{ tests }}
{% endblock %}
-->
{% block script %}
<script src="{{ static('core/js/jquery-3.1.0.min.js') }}"></script>
<script src="{{ static('core/js/ui/jquery-ui.min.js') }}"></script>
<script src="{{ static('core/js/multiple-select.js') }}"></script>
<script src="{{ static('core/js/script.js') }}"></script>
<script>
$('select:not([multiple])').multipleSelect({
single: true,
{% if not popup %}
position: 'top',
{% endif %}
});
$('select[multiple=multiple]').multipleSelect({
filter: true,
{% if not popup %}
position: 'top',
{% endif %}
});
$('.select_single').multipleSelect({
single: true,
{% if not popup %}
position: 'top',
{% endif %}
});
$('.select_multiple').multipleSelect({
filter: true,
{% if not popup %}
position: 'top',
{% endif %}
});
</script>
{% endblock %}
</body>
</html>

View File

@ -1,5 +1,9 @@
{% extends "core/base.jinja" %}
{% block title %}
{% trans obj=object %}Edit {{ obj }}{% endtrans %}
{% endblock %}
{% block content %}
<h2>{% trans obj=object %}Edit {{ obj }}{% endtrans %}</h2>
<form action="" method="post">

View File

@ -42,8 +42,18 @@
{% if not file.home_of and not file.home_of_club and file.parent %}
<p><a href="{{ url('core:file_delete', file_id=file.id, popup=popup) }}">{% trans %}Delete{% endtrans %}</a></p>
{% endif %}
{% if popup %}
{% endif %}
{% endblock %}
{% block script %}
{{ super() }}
{% if popup and file.is_file %}
<script>
parent.$("#file_id").replaceWith('<span id="file_id" value="{{ file.id }}">{{ file.name }}</span>');
</script>
{% endif %}
{% endblock %}

View File

@ -21,7 +21,9 @@
<form method="post" action="{{ url('core:login') }}">
{% csrf_token %}
{{ form.as_p() }}
<p>{{ form.username.errors }}<label for="{{ form.username.name }}">{{ form.username.label }}
</label><input id="id_username" maxlength="254" name="username" type="text" autofocus="autofocus" /></p>
<p>{{ form.password.errors }}<label for="{{ form.password.name }}">{{ form.password.label }}</label>{{ form.password }}</p>
<input type="hidden" name="next" value="{{ next }}">
<p><input type="submit" value="{% trans %}login{% endtrans %}"></p>
</form>

View File

@ -5,12 +5,26 @@
{% endblock %}
{% block infos %}
<h3>{% trans %}User Profile{% endtrans %}</h3>
<div class="user_profile">
<div id="user_profile">
<div id="pictures">
{% if profile.profile_pict %}
<img src="{{ profile.profile_pict.get_download_url() }}" alt="{% trans %}Profile{% endtrans %}" />
{% endif %}
<p><em>{{ profile.quote }}</em></p>
</div>
<h4>{{ profile.get_full_name() }}</h4>
<p>{{ profile.nick_name }}</p>
<p id="nickname">&laquo; {{ profile.nick_name }} &raquo;</p>
<p>{% trans %}Born: {% endtrans %}{{ profile.date_of_birth|date("d/m/Y") }}</p>
<p>{{ profile.department }}{{ profile.semester }}
{% if profile.dpt_option %}
<br>{% trans %}Option: {% endtrans %}{{ profile.dpt_option }}
{% endif %}
</p>
{% if profile.promo %}
<p><img src="{{ static('core/img/promo_%02d.png' % profile.promo) }}" alt="Promo {{ profile.promo }}" class="promo_pict" />
{% trans %}Promo: {% endtrans %}{{ profile.promo }}</p>
{% endif %}
</div>
{% if user.membership.filter(end_date=None).exists() or user.is_in_group(settings.SITH_MAIN_BOARD_GROUP) %}

View File

@ -1,15 +1,31 @@
{% extends "core/base.jinja" %}
{% extends "core/user_base.jinja" %}
{% block content %}
{% block infos %}
<h2>{% trans %}Edit user profile{% endtrans %}</h2>
<form action="" method="post">
<form action="" method="post" enctype="multipart/form-data">
{% csrf_token %}
{{ form.as_p() }}
{% for field in form %}
<p>{{ field.errors }}<label for="{{ field.name }}">{{ field.label }}
{%- if field.name == "profile_pict" and form.instance.profile_pict -%}
<br>{% trans %}Current profile: {% endtrans %}
<img src="{{ form.instance.profile_pict.get_download_url() }}" title="{% trans %}Profile{% endtrans %}" width="50px" /><br>
{%- elif field.name == "avatar_pict" and form.instance.avatar_pict -%}
<br>{% trans %}Current avatar: {% endtrans %}
<img src="{{ form.instance.avatar_pict.get_download_url() }}" title="{% trans %}Avatar{% endtrans %}" width="50px" /><br>
{%- elif field.name == "scrub_pict" and form.instance.scrub_pict -%}
<br>{% trans %}Current scrub: {% endtrans %}
<img src="{{ form.instance.scrub_pict.get_download_url() }}" title="{% trans %}Scrub{% endtrans %}" width="50px" /><br>
{%- endif %}</label> {{ field }}</p>
{% endfor %}
<p><input type="submit" value="{% trans %}Update{% endtrans %}" /></p>
<p>{% trans %}Username: {% endtrans %}{{ form.instance.username }}</p>
{% if form.instance.customer %}
<p>{% trans %}Account number: {% endtrans %}{{ form.instance.customer.account_id }}</p>
{% endif %}
{% if form.instance == user %}
<p><a href="{{ url('core:password_change') }}">{% trans %}Change my password{% endtrans %}</a></p>
{% endif %}
</form>
{% if form.instance == user %}
<p><a href="{{ url('core:password_change') }}">{% trans %}Change my password{% endtrans %}</a></p>
{% endif %}
{% endblock %}

View File

@ -1,6 +1,6 @@
{% extends "core/base.jinja" %}
{% extends "core/user_base.jinja" %}
{% block content %}
{% block infos %}
<h2>{% trans user_name=profile.get_full_name() %}Edit user groups for {{ user_name }}{% endtrans %}</h2>
<form action="" method="post">
{% csrf_token %}