mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-26 02:54:20 +00:00
trombi: make the export page
Signed-off-by: Skia <skia@libskia.so>
This commit is contained in:
parent
8bf72daa31
commit
3eea8ed4e3
File diff suppressed because it is too large
Load Diff
@ -10,7 +10,7 @@
|
|||||||
<a href="{{ url('trombi:moderate_comments', trombi_id=object.id) }}">{% trans %}Moderate comments{% endtrans %}</a>
|
<a href="{{ url('trombi:moderate_comments', trombi_id=object.id) }}">{% trans %}Moderate comments{% endtrans %}</a>
|
||||||
<p>{% trans %}Subscription deadline: {% endtrans %}{{ object.subscription_deadline|date(DATETIME_FORMAT) }}</p>
|
<p>{% trans %}Subscription deadline: {% endtrans %}{{ object.subscription_deadline|date(DATETIME_FORMAT) }}</p>
|
||||||
<p>{% trans %}Comment deadline: {% endtrans %}{{ object.comments_deadline|date(DATETIME_FORMAT) }}</p>
|
<p>{% trans %}Comment deadline: {% endtrans %}{{ object.comments_deadline|date(DATETIME_FORMAT) }}</p>
|
||||||
<a href="#">Export</a>
|
<a href="{{ url('trombi:export', trombi_id=object.id) }}">{% trans %}Export{% endtrans %}</a>
|
||||||
<hr>
|
<hr>
|
||||||
<h4>{% trans %}Add user{% endtrans %}</h4>
|
<h4>{% trans %}Add user{% endtrans %}</h4>
|
||||||
<form action="" method="post">
|
<form action="" method="post">
|
||||||
|
113
trombi/templates/trombi/export.jinja
Normal file
113
trombi/templates/trombi/export.jinja
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
{% extends 'core/base.jinja' %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
{% trans club=object.club %}{{ club }}'s Trombi{% endtrans %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h2>{% trans club=object.club %}{{ club }}'s Trombi{% endtrans %}</h2>
|
||||||
|
<a href="{{ url('trombi:detail', trombi_id=object.id) }}">{% trans %}Back{% endtrans %}</a>
|
||||||
|
<hr>
|
||||||
|
<div>
|
||||||
|
{% for trombi_user in object.users.order_by('user__nick_name') %}
|
||||||
|
<div style="border: solid 1px grey; text-align: center; margin: 5px;">
|
||||||
|
<div id="user_{{ trombi_user.id }}_infos">
|
||||||
|
{{ trombi_user.user.get_display_name() }}<br>
|
||||||
|
{% trans %}Date of birth: {% endtrans %}{{ trombi_user.user.date_of_birth|date("d/m/Y") }}<br>
|
||||||
|
{% trans %}Email: {% endtrans %}{{ trombi_user.user.second_email }}<br>
|
||||||
|
{% trans %}Phone: {% endtrans %}{{ trombi_user.user.phone }}<br>
|
||||||
|
{% trans %}City: {% endtrans %}{{ trombi_user.user.parent_address }}<br>
|
||||||
|
{% trans %}Quote: {% endtrans %}{{ trombi_user.user.quote }}<br>
|
||||||
|
</div>
|
||||||
|
<button onclick="copyToClipboard(document.getElementById('user_{{ trombi_user.id }}_infos'))">{% trans %}Copy{% endtrans %}</button>
|
||||||
|
|
||||||
|
<h4>{% trans %}Pictures{% endtrans %}</h4>
|
||||||
|
{% set profile_file = None %}
|
||||||
|
{% set scrub_file = None %}
|
||||||
|
{% if trombi_user.profile_pict %}
|
||||||
|
{% set profile_file = trombi_user.profile_pict.url %}
|
||||||
|
{% else %}
|
||||||
|
{% set profile_file = static('core/img/na.gif') %}
|
||||||
|
{% endif %}
|
||||||
|
{% if trombi_user.scrub_pict %}
|
||||||
|
{% set scrub_file = trombi_user.scrub_pict.url %}
|
||||||
|
{% else %}
|
||||||
|
{% set scrub_file = static('core/img/na.gif') %}
|
||||||
|
{% endif %}
|
||||||
|
<div style="max-width: 410px; margin: auto; text-align: center;">
|
||||||
|
<div>
|
||||||
|
<div class="ib w_medium">
|
||||||
|
<div id="user_{{ trombi_user.id }}_profile"><img src="{{ profile_file }}" alt="" style="max-width: 200px"></div>
|
||||||
|
<button onclick="copyToClipboard(document.getElementById('user_{{ trombi_user.id }}_profile'))">{% trans %}Copy profile picture{% endtrans %}</button>
|
||||||
|
</div>
|
||||||
|
<div class="ib w_medium">
|
||||||
|
<div id="user_{{ trombi_user.id }}_scrub"><img src="{{ scrub_file }}" alt="" style="max-width: 200px"></div>
|
||||||
|
<button onclick="copyToClipboard(document.getElementById('user_{{ trombi_user.id }}_scrub'))">{% trans %}Copy scrub picture{% endtrans %}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% if trombi_user.memberships.exists() %}
|
||||||
|
<h4>{% trans %}Club{% endtrans %}</h4>
|
||||||
|
<table id="user_{{ trombi_user.id }}_clubs" style="max-width: 70%; margin: auto;">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td>{% trans %}Club{% endtrans %}</td>
|
||||||
|
<td>{% trans %}Role{% endtrans %}</td>
|
||||||
|
<td>{% trans %}Date{% endtrans %}</td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for m in trombi_user.memberships.all() %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ m.club }}</td>
|
||||||
|
<td>{{ m.role }}</td>
|
||||||
|
<td>{{ m.start }} - {{ m.end }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<button onclick="copyToClipboard(document.getElementById('user_{{ trombi_user.id }}_clubs'))">{% trans %}Copy clubs{% endtrans %}</button>
|
||||||
|
{% endif %}
|
||||||
|
<h4>{% trans %}Comments{% endtrans %}</h4>
|
||||||
|
<div id="user_{{ trombi_user.id }}_coms" style="text-align: left">
|
||||||
|
{% for c in trombi_user.received_comments.filter(is_moderated=True) %}
|
||||||
|
<strong>{{ c.author.user.get_display_name() }}</strong><br>
|
||||||
|
{% for line in c.content.splitlines() %}
|
||||||
|
{{ line }}<br>
|
||||||
|
{% endfor %}
|
||||||
|
<br>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
<button onclick="copyToClipboard(document.getElementById('user_{{ trombi_user.id }}_coms'))">{% trans %}Copy comments{% endtrans %}</button>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block script %}
|
||||||
|
{{ super () }}
|
||||||
|
<script>
|
||||||
|
function copyToClipboard(el) {
|
||||||
|
var body = document.body, range, sel;
|
||||||
|
if (document.createRange && window.getSelection) {
|
||||||
|
range = document.createRange();
|
||||||
|
sel = window.getSelection();
|
||||||
|
sel.removeAllRanges();
|
||||||
|
try {
|
||||||
|
range.selectNodeContents(el);
|
||||||
|
sel.addRange(range);
|
||||||
|
} catch (e) {
|
||||||
|
range.selectNode(el);
|
||||||
|
sel.addRange(range);
|
||||||
|
}
|
||||||
|
document.execCommand("copy");
|
||||||
|
|
||||||
|
} else if (body.createTextRange) {
|
||||||
|
range = body.createTextRange();
|
||||||
|
range.moveToElementText(el);
|
||||||
|
range.select();
|
||||||
|
range.execCommand("Copy");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
@ -28,6 +28,7 @@ from trombi.views import *
|
|||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^(?P<club_id>[0-9]+)/new$', TrombiCreateView.as_view(), name='create'),
|
url(r'^(?P<club_id>[0-9]+)/new$', TrombiCreateView.as_view(), name='create'),
|
||||||
|
url(r'^(?P<trombi_id>[0-9]+)/export$', TrombiExportView.as_view(), name='export'),
|
||||||
url(r'^(?P<trombi_id>[0-9]+)/edit$', TrombiEditView.as_view(), name='edit'),
|
url(r'^(?P<trombi_id>[0-9]+)/edit$', TrombiEditView.as_view(), name='edit'),
|
||||||
url(r'^(?P<trombi_id>[0-9]+)/moderate_comments$', TrombiModerateCommentsView.as_view(), name='moderate_comments'),
|
url(r'^(?P<trombi_id>[0-9]+)/moderate_comments$', TrombiModerateCommentsView.as_view(), name='moderate_comments'),
|
||||||
url(r'^(?P<comment_id>[0-9]+)/moderate$', TrombiModerateCommentView.as_view(), name='moderate_comment'),
|
url(r'^(?P<comment_id>[0-9]+)/moderate$', TrombiModerateCommentView.as_view(), name='moderate_comment'),
|
||||||
|
@ -145,6 +145,11 @@ class TrombiDetailView(CanEditMixin, QuickNotifMixin, TrombiTabsMixin, DetailVie
|
|||||||
kwargs['form'] = AddUserForm()
|
kwargs['form'] = AddUserForm()
|
||||||
return kwargs
|
return kwargs
|
||||||
|
|
||||||
|
class TrombiExportView(CanEditMixin, TrombiTabsMixin, DetailView):
|
||||||
|
model = Trombi
|
||||||
|
template_name = 'trombi/export.jinja'
|
||||||
|
pk_url_kwarg = 'trombi_id'
|
||||||
|
current_tab = "admin_tools"
|
||||||
|
|
||||||
class TrombiDeleteUserView(CanEditPropMixin, TrombiTabsMixin, DeleteView):
|
class TrombiDeleteUserView(CanEditPropMixin, TrombiTabsMixin, DeleteView):
|
||||||
model = TrombiUser
|
model = TrombiUser
|
||||||
|
Loading…
Reference in New Issue
Block a user