82 lines
2.6 KiB
HTML
82 lines
2.6 KiB
HTML
{% extends "fargo/base.html" %}
|
||
{% load render_table from django_tables2 %}
|
||
{% load gadjo i18n staticfiles %}
|
||
|
||
{% block content %}
|
||
<script src="{% xstatic 'jquery-ui' 'jquery-ui.min.js' %}"></script>
|
||
<script src="{% static "js/gadjo.js" %}"></script>
|
||
|
||
<script>
|
||
$(function () {
|
||
$('tbody').on("click", "tr", function (event) {
|
||
var $target = $(event.target)
|
||
if ($target.is('a')) {
|
||
/* let it be */
|
||
return true;
|
||
}
|
||
if (! $target.is('tr')) {
|
||
$target = $target.parents('tr');
|
||
}
|
||
var url = $target.data('url');
|
||
if (url) {
|
||
window.location.href = url;
|
||
}
|
||
});
|
||
$('#send-file input[type=file]').on('change', function() {
|
||
$('#id_content input[type=file]').change();
|
||
});
|
||
$('#id_content').on('change', function() {
|
||
var fileSize = this.files[0].size;
|
||
if (fileSize > {{ max_document_size }}) {
|
||
$('.invalid-file-error').show();
|
||
}
|
||
else {
|
||
$('#send-file input[type=submit]').click();
|
||
}
|
||
});
|
||
$('#send-file button').on('click', function() {
|
||
$('#send-file input[type=file]').click();
|
||
return false;
|
||
});
|
||
})
|
||
</script>
|
||
|
||
<div class="cell">
|
||
<h2>{% if site_title %}{{ site_title }}{% else %}{% trans "Portfolio" %}{% endif %}</h2>
|
||
<div id="user-files">
|
||
{% render_table table "fargo/table.html" %}
|
||
|
||
{% if full %}
|
||
<div class="infonotice">
|
||
{% blocktrans count max_documents_per_user=max_documents_per_user trimmed %}
|
||
The limit of {{ max_documents_per_user }} document per user is reached.
|
||
You cannot add any more documents.
|
||
{% plural %}
|
||
The limit of {{ max_documents_per_user }} documents per user is reached.
|
||
You cannot add any more documents.
|
||
{% endblocktrans %}
|
||
</div>
|
||
{% else %}
|
||
<form id="send-file" method="post" enctype="multipart/form-data">
|
||
{% csrf_token %}
|
||
{{ form.non_field_errors }}
|
||
{{ form.content.errors }}
|
||
<div style="display: none">
|
||
{{ form.as_p }}
|
||
<input type="submit" name="submit" value="Upload">
|
||
</div>
|
||
<div class="invalid-file-error" style="display: none">
|
||
<p>
|
||
{% blocktrans with max_size_mb=max_document_size|filesizeformat %}
|
||
Error: an uploaded document can't exceed {{ max_size_mb }}.
|
||
{% endblocktrans %}
|
||
</p>
|
||
<p>{% trans "Please try again with a smaller document." %}</p>
|
||
</div>
|
||
<button>{% trans "Upload a new document" %}</button>
|
||
</form>
|
||
{% endif %}
|
||
</div>
|
||
</div>
|
||
{% endblock %}
|