Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +5 -0
- 1001-sala-de-aula-master/env/share/python-wheels/setuptools-20.7.0-py2.py3-none-any.whl +3 -0
- 1327-master/_1327/documents/migrations/0004_auto_20161213_2203.py +20 -0
- 1327-master/_1327/documents/migrations/0006_5_auto_20170227_1812.py +20 -0
- 1327-master/_1327/documents/migrations/0006_temporarydocumenttext_hash_value.py +21 -0
- 1327-master/_1327/documents/migrations/0007_auto_20170227_1729.py +25 -0
- 1327-master/_1327/documents/migrations/0008_auto_20170227_1748.py +33 -0
- 1327-master/_1327/documents/migrations/0009_auto_20170227_1748.py +23 -0
- 1327-master/_1327/documents/migrations/0010_add_on_delete.py +27 -0
- 1327-master/_1327/documents/templates/documents_base.html +111 -0
- 1327-master/_1327/documents/templates/documents_edit.html +459 -0
- 1327-master/_1327/documents/templates/documents_permissions.html +41 -0
- 1327-master/_1327/documents/templates/documents_preview.html +27 -0
- 1327-master/_1327/documents/templates/documents_versions.html +52 -0
- 1327-master/_1327/documents/templates/search_api.json +56 -0
- 1327-master/_1327/documents/templatetags/num_revisions.py +10 -0
- 1327-master/_1327/main/migrations/0002_add_staff_group.py +20 -0
- 1327-master/_1327/main/migrations/0003_menu_item_data.py +53 -0
- 1327-master/_1327/main/migrations/0004_add_university_network_group.py +20 -0
- 1327-master/_1327/main/migrations/0007_auto_20160711_1653.py +22 -0
- 1327-master/_1327/main/migrations/0008_auto_20160806_1303.py +19 -0
- 1327-master/_1327/main/migrations/0009_abbreviationexplanation.py +23 -0
- 1327-master/_1327/main/migrations/0010_menu_item_minutes.py +56 -0
- 1327-master/_1327/main/migrations/0011_add_student_group.py +22 -0
- 1327-master/_1327/main/migrations/0012_auto_20161029_2223.py +21 -0
- 1327-master/_1327/main/migrations/0013_edit_minutes_menu_item.py +37 -0
- 1327-master/_1327/main/migrations/0014_add_on_delete.py +21 -0
- 1327-master/_1327/main/templates/400.html +9 -0
- 1327-master/_1327/main/templates/404.html +9 -0
- 1327-master/_1327/main/templates/index.html +12 -0
- 1327-master/_1327/main/templates/menu_item_edit.html +75 -0
- 1327-master/_1327/main/templates/menu_items_index.html +94 -0
- 1327-master/_1327/minutes/migrations/0007_auto_20160927_1937.py +20 -0
- 1327-master/_1327/minutes/migrations/0008_add_on_delete.py +27 -0
- 1327-master/_1327/minutes/templates/minutes_meta_information.html +41 -0
- 1327-master/_1327/polls/forms.py +68 -0
- 1327-master/_1327/polls/tests.py +716 -0
- 1327-master/_1327/shortlinks/tests.py +58 -0
- 1327-master/_1327/shortlinks/utils.py +35 -0
- 1327-master/_1327/static/js/jquery.nestable.js +486 -0
- 1327-master/_1327/static/less/admin.less +33 -0
- 1327-master/_1327/static/less/variables.less +875 -0
- 1327-master/_1327/templates/admin/app_index.html +21 -0
- 1327-master/_1327/templates/admin/base.html +70 -0
- 1327-master/_1327/templates/admin/base_bootstrap-admin.html +51 -0
- 1327-master/_1327/templates/admin/base_site_bootstrap-admin.html +5 -0
- 1327-master/_1327/templates/admin/change_list.html +115 -0
- 1327-master/_1327/templates/admin/change_list_results.html +42 -0
- 1327-master/_1327/templates/admin/index.html +55 -0
- 1327-master/_1327/templates/admin/search_form.html +24 -0
.gitattributes
CHANGED
|
@@ -64,3 +64,8 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 64 |
1001-sala-de-aula-master/env/lib/python3.5/site-packages/pip/_vendor/distlib/t64.exe filter=lfs diff=lfs merge=lfs -text
|
| 65 |
1001-sala-de-aula-master/env/lib64/python3.5/site-packages/pip/_vendor/distlib/t64.exe filter=lfs diff=lfs merge=lfs -text
|
| 66 |
1001-sala-de-aula-master/env/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
1001-sala-de-aula-master/env/lib/python3.5/site-packages/pip/_vendor/distlib/t64.exe filter=lfs diff=lfs merge=lfs -text
|
| 65 |
1001-sala-de-aula-master/env/lib64/python3.5/site-packages/pip/_vendor/distlib/t64.exe filter=lfs diff=lfs merge=lfs -text
|
| 66 |
1001-sala-de-aula-master/env/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl filter=lfs diff=lfs merge=lfs -text
|
| 67 |
+
1001-sala-de-aula-master/env/share/python-wheels/setuptools-20.7.0-py2.py3-none-any.whl filter=lfs diff=lfs merge=lfs -text
|
| 68 |
+
2019-sohu-finals-master/data/bert10fold.txt filter=lfs diff=lfs merge=lfs -text
|
| 69 |
+
2019-sohu-finals-master/我想去北京-搜狐赛答辩(最终版).pptx filter=lfs diff=lfs merge=lfs -text
|
| 70 |
+
16_daoyun-master/16_到云签到系统_产品需求文档.docx filter=lfs diff=lfs merge=lfs -text
|
| 71 |
+
16_daoyun-master/16_到云签到系统_原型设计_0320.rp filter=lfs diff=lfs merge=lfs -text
|
1001-sala-de-aula-master/env/share/python-wheels/setuptools-20.7.0-py2.py3-none-any.whl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f9817c35d54076154b9e76b58e9e13fb0316db1698bcca85ad00586b1b960ed4
|
| 3 |
+
size 120358
|
1327-master/_1327/documents/migrations/0004_auto_20161213_2203.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
# Generated by Django 1.9.7 on 2016-12-13 21:03
|
| 3 |
+
from __future__ import unicode_literals
|
| 4 |
+
|
| 5 |
+
from django.db import migrations, models
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class Migration(migrations.Migration):
|
| 9 |
+
|
| 10 |
+
dependencies = [
|
| 11 |
+
('documents', '0003_auto_20160627_1743'),
|
| 12 |
+
]
|
| 13 |
+
|
| 14 |
+
operations = [
|
| 15 |
+
migrations.AlterField(
|
| 16 |
+
model_name='document',
|
| 17 |
+
name='url_title',
|
| 18 |
+
field=models.CharField(max_length=255, unique=True, verbose_name='url_title'),
|
| 19 |
+
),
|
| 20 |
+
]
|
1327-master/_1327/documents/migrations/0006_5_auto_20170227_1812.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
# Generated by Django 1.9.12 on 2017-02-27 17:12
|
| 3 |
+
from __future__ import unicode_literals
|
| 4 |
+
|
| 5 |
+
from django.db import migrations, models
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class Migration(migrations.Migration):
|
| 9 |
+
|
| 10 |
+
dependencies = [
|
| 11 |
+
('documents', '0006_temporarydocumenttext_hash_value'),
|
| 12 |
+
]
|
| 13 |
+
|
| 14 |
+
operations = [
|
| 15 |
+
migrations.AlterField(
|
| 16 |
+
model_name='temporarydocumenttext',
|
| 17 |
+
name='hash_value',
|
| 18 |
+
field=models.CharField(default='0', max_length=40, unique=False, verbose_name='Hash value'),
|
| 19 |
+
),
|
| 20 |
+
]
|
1327-master/_1327/documents/migrations/0006_temporarydocumenttext_hash_value.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
# Generated by Django 1.9.11 on 2017-01-16 20:15
|
| 3 |
+
from __future__ import unicode_literals
|
| 4 |
+
|
| 5 |
+
import _1327.documents.models
|
| 6 |
+
from django.db import migrations, models
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class Migration(migrations.Migration):
|
| 10 |
+
|
| 11 |
+
dependencies = [
|
| 12 |
+
('documents', '0005_attachment_hash_value'),
|
| 13 |
+
]
|
| 14 |
+
|
| 15 |
+
operations = [
|
| 16 |
+
migrations.AddField(
|
| 17 |
+
model_name='temporarydocumenttext',
|
| 18 |
+
name='hash_value',
|
| 19 |
+
field=models.CharField(default=getattr(_1327.documents.models.TemporaryDocumentText, 'get_hash', '0'), max_length=40, unique=True, verbose_name='Hash value'),
|
| 20 |
+
),
|
| 21 |
+
]
|
1327-master/_1327/documents/migrations/0007_auto_20170227_1729.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
# Generated by Django 1.9.12 on 2017-02-27 16:29
|
| 3 |
+
from __future__ import unicode_literals
|
| 4 |
+
|
| 5 |
+
import _1327.documents.models
|
| 6 |
+
from django.db import migrations, models
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class Migration(migrations.Migration):
|
| 10 |
+
|
| 11 |
+
dependencies = [
|
| 12 |
+
('documents', '0006_5_auto_20170227_1812'),
|
| 13 |
+
]
|
| 14 |
+
|
| 15 |
+
operations = [
|
| 16 |
+
migrations.RemoveField(
|
| 17 |
+
model_name='temporarydocumenttext',
|
| 18 |
+
name='hash_value',
|
| 19 |
+
),
|
| 20 |
+
migrations.AddField(
|
| 21 |
+
model_name='document',
|
| 22 |
+
name='hash_value',
|
| 23 |
+
field=models.CharField(default=_1327.documents.models.Document.get_hash, max_length=40, null=True, verbose_name='Hash value'),
|
| 24 |
+
),
|
| 25 |
+
]
|
1327-master/_1327/documents/migrations/0008_auto_20170227_1748.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
# Generated by Django 1.9.12 on 2017-02-27 16:48
|
| 3 |
+
from __future__ import unicode_literals
|
| 4 |
+
|
| 5 |
+
import datetime
|
| 6 |
+
import hashlib
|
| 7 |
+
|
| 8 |
+
from django.db import migrations, models
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def fill_hash_values(apps, schema_editor):
|
| 12 |
+
Document = apps.get_model("documents", "Document")
|
| 13 |
+
for document in Document.objects.all():
|
| 14 |
+
max_id = Document.objects.aggregate(models.Max('id'))['id__max'] or 0
|
| 15 |
+
hash_value = '{}_{}'.format(hashlib.md5(str(datetime.datetime.now()).encode()).hexdigest(), int(max_id) + 1)
|
| 16 |
+
document.hash_value = hash_value
|
| 17 |
+
document.save()
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def reverse_fill_hash_values(apps, schema_editor):
|
| 21 |
+
# no need to do anything here, but we need this function because Django won't let us reverse the migration otherwise
|
| 22 |
+
pass
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
class Migration(migrations.Migration):
|
| 26 |
+
|
| 27 |
+
dependencies = [
|
| 28 |
+
('documents', '0007_auto_20170227_1729'),
|
| 29 |
+
]
|
| 30 |
+
|
| 31 |
+
operations = [
|
| 32 |
+
migrations.RunPython(fill_hash_values, reverse_code=reverse_fill_hash_values),
|
| 33 |
+
]
|
1327-master/_1327/documents/migrations/0009_auto_20170227_1748.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
# Generated by Django 1.9.12 on 2017-02-27 16:48
|
| 3 |
+
from __future__ import unicode_literals
|
| 4 |
+
|
| 5 |
+
from django.db import migrations
|
| 6 |
+
|
| 7 |
+
import _1327.documents.models
|
| 8 |
+
from django.db import migrations, models
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
class Migration(migrations.Migration):
|
| 12 |
+
|
| 13 |
+
dependencies = [
|
| 14 |
+
('documents', '0008_auto_20170227_1748'),
|
| 15 |
+
]
|
| 16 |
+
|
| 17 |
+
operations = [
|
| 18 |
+
migrations.AlterField(
|
| 19 |
+
model_name='document',
|
| 20 |
+
name='hash_value',
|
| 21 |
+
field=models.CharField(default=_1327.documents.models.Document.get_hash, max_length=40, unique=True, verbose_name='Hash value'),
|
| 22 |
+
),
|
| 23 |
+
]
|
1327-master/_1327/documents/migrations/0010_add_on_delete.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
# Generated by Django 1.9.13 on 2017-07-09 11:23
|
| 3 |
+
from __future__ import unicode_literals
|
| 4 |
+
|
| 5 |
+
from django.conf import settings
|
| 6 |
+
from django.db import migrations, models
|
| 7 |
+
import django.db.models.deletion
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
class Migration(migrations.Migration):
|
| 11 |
+
|
| 12 |
+
dependencies = [
|
| 13 |
+
('documents', '0009_auto_20170227_1748'),
|
| 14 |
+
]
|
| 15 |
+
|
| 16 |
+
operations = [
|
| 17 |
+
migrations.AlterField(
|
| 18 |
+
model_name='temporarydocumenttext',
|
| 19 |
+
name='author',
|
| 20 |
+
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='temporary_documents', to=settings.AUTH_USER_MODEL),
|
| 21 |
+
),
|
| 22 |
+
migrations.AlterField(
|
| 23 |
+
model_name='temporarydocumenttext',
|
| 24 |
+
name='document',
|
| 25 |
+
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='document', to='documents.Document'),
|
| 26 |
+
),
|
| 27 |
+
]
|
1327-master/_1327/documents/templates/documents_base.html
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends view_page|yesno:"base_with_sidebar.html,base_with_sidebar_narrow.html" %}
|
| 2 |
+
{% load i18n %}
|
| 3 |
+
{% load bootstrap3 %}
|
| 4 |
+
{% load document_perms %}
|
| 5 |
+
{% load morefilters %}
|
| 6 |
+
|
| 7 |
+
{% block title %}
|
| 8 |
+
{{ document.title }}
|
| 9 |
+
{% endblock %}
|
| 10 |
+
|
| 11 |
+
{% block sidebar %}
|
| 12 |
+
{% include document.meta_information_html %}
|
| 13 |
+
<div class="divider hidden-print"></div>
|
| 14 |
+
{% block document_nav %}
|
| 15 |
+
{% if permission_overview %}
|
| 16 |
+
<div role="tablist" class="hidden-print">
|
| 17 |
+
<a class="btn btn-sm btn-sidebar {% if active_page == 'view' %}btn-warning{% else %}btn-default{% endif %}" href="{% url document.get_view_url_name document.url_title %}" role="tab">{% trans "View" %}</a>
|
| 18 |
+
<a class="btn btn-sm btn-sidebar {% if active_page == 'edit' %}btn-warning{% else %}btn-default{% endif %}" href="{% url document.get_edit_url_name document.url_title %}" role="tab">{% trans "Edit" %}</a>
|
| 19 |
+
<a class="btn btn-sm btn-sidebar {% if active_page == 'attachments' %}btn-warning{% else %}btn-default{% endif %}" href="{% url document.get_attachments_url_name document.url_title %}" role="tab">{% trans "Attachments" %}</a>
|
| 20 |
+
<a class="btn btn-sm btn-sidebar {% if active_page == 'versions' %}btn-warning{% else %}btn-default{% endif %}" href="{% url document.get_versions_url_name document.url_title %}" role="tab">{% trans "Versions" %}</a>
|
| 21 |
+
</div>
|
| 22 |
+
<div class="divider"></div>
|
| 23 |
+
{% if document.show_permissions_editor %}<a class="btn btn-sm btn-sidebar {% if active_page == 'permissions' %}btn-warning{% else %}btn-default{% endif %}" href="{% url document.get_permissions_url_name document.url_title %}" role="tab">{% trans "Permissions" %}</a>{% endif %}
|
| 24 |
+
{% if document.show_publish_button %}
|
| 25 |
+
<div class="btn-group btn-sidebar hidden-print">
|
| 26 |
+
<a class="btn btn-sm btn-default col-xs-9" href="{% url document.get_publish_url_name document.url_title 1 %}" role="tab">{% trans "Publish" %}</a>
|
| 27 |
+
<button type="button" class="btn btn-sm btn-default col-xs-3 dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
| 28 |
+
<span class="caret"></span>
|
| 29 |
+
<span class="sr-only">Toggle Dropdown</span>
|
| 30 |
+
</button>
|
| 31 |
+
<ul class="dropdown-menu dropdown-menu-right">
|
| 32 |
+
<li><a class="default" href="{% url document.get_publish_url_name document.url_title 1 %}">{% trans "Publish for Students and University Network" %}</a></li>
|
| 33 |
+
<li><a href="{% url document.get_publish_url_name document.url_title 4 %}">{% trans "Publish for Students only" %}</a></li>
|
| 34 |
+
</ul>
|
| 35 |
+
</div>
|
| 36 |
+
{% endif %}
|
| 37 |
+
{% with edit_groups=permission_overview|permission_filter:'edit'|join:', ' view_groups=permission_overview|permission_filter:'view'|join:', '%}
|
| 38 |
+
<div class="permission-icons hidden-print" data-toggle="tooltip" data-placement="top" data-container="body" data-html="true" title="<b>{% trans 'Edit' %}:</b> {% if edit_groups %}{{ edit_groups }}{% else %}—{% endif %}</br><b>{% trans 'View' %}:</b> {% if view_groups %}{{ view_groups }}{% else %}—{% endif %}">
|
| 39 |
+
<span class="glyphicon glyphicon-globe permission-icon-{{ permission_overview.0.1 }}" aria-hidden="true"></span>
|
| 40 |
+
<span class="glyphicon glyphicon-education permission-icon-{{ permission_overview.1.1 }}" aria-hidden="true"></span>
|
| 41 |
+
<span class="glyphicon glyphicon-user permission-icon-{{ permission_overview.2.1 }}" aria-hidden="true"></span>
|
| 42 |
+
<span class="glyphicon glyphicon-briefcase permission-icon-{{ permission_overview.3.1 }}" aria-hidden="true"></span>
|
| 43 |
+
{% if permission_overview|length > 4 %}
|
| 44 |
+
<span class="glyphicon glyphicon-option-horizontal permission-icon-more" aria-hidden="true"></span>
|
| 45 |
+
{% endif %}<br/>
|
| 46 |
+
</div>
|
| 47 |
+
{% endwith %}
|
| 48 |
+
<div class="divider"></div>
|
| 49 |
+
{% endif %}
|
| 50 |
+
{% endblock %}
|
| 51 |
+
{% if "<li>" in toc %}
|
| 52 |
+
<div class="hidden-print">
|
| 53 |
+
<p class="toc-heading">{% trans "Table of Contents" %}</p>
|
| 54 |
+
{{ toc|safe }}
|
| 55 |
+
</div>
|
| 56 |
+
{% if attachments %}
|
| 57 |
+
<div class="toc hidden-print">
|
| 58 |
+
<ul><li><a href="#attachments" title="{% trans "Attachments" %}">{% trans "Attachments" %}</a></li></ul>
|
| 59 |
+
</div>
|
| 60 |
+
{% endif %}
|
| 61 |
+
{% endif %}
|
| 62 |
+
{% endblock %}
|
| 63 |
+
|
| 64 |
+
{% block breadcrumbs %}
|
| 65 |
+
{{ block.super }}
|
| 66 |
+
{% for menu_item in main_menu %}
|
| 67 |
+
{% if menu_item.selected and menu_item.document != document %}
|
| 68 |
+
<li><span class="glyphicon glyphicon-menu-right" aria-hidden="true"></span> <a href="{{ menu_item.get_url }}">{{ menu_item.title }}</a></li>
|
| 69 |
+
{% for subitem in menu_item.submenu %}
|
| 70 |
+
{% if subitem.selected %}
|
| 71 |
+
<li><span class="glyphicon glyphicon-menu-right" aria-hidden="true"></span> {% if subitem.document != document %}<a href="{{ subitem.get_url }}">{% endif %}{{ subitem.title }}{% if subitem.document != document %}</a>{% endif %}</li>
|
| 72 |
+
{% for subsubitem in subitem.submenu %}
|
| 73 |
+
{% if subsubitem.selected %}
|
| 74 |
+
<li><span class="glyphicon glyphicon-menu-right" aria-hidden="true"></span> {{ subsubitem.title }}</li>
|
| 75 |
+
{% endif %}
|
| 76 |
+
{% endfor %}
|
| 77 |
+
{% endif %}
|
| 78 |
+
{% endfor %}
|
| 79 |
+
{% endif %}
|
| 80 |
+
{% endfor %}
|
| 81 |
+
{% endblock %}
|
| 82 |
+
|
| 83 |
+
{% block content %}
|
| 84 |
+
{% block document_content %}
|
| 85 |
+
<div>{{ text|safe }}</div>
|
| 86 |
+
{% if attachments %}
|
| 87 |
+
<div class="divider"></div>
|
| 88 |
+
<h2 id="attachments">{% trans "Attachments" %}</h2>
|
| 89 |
+
<ul>
|
| 90 |
+
{% for attachment in attachments %}
|
| 91 |
+
<li>
|
| 92 |
+
<a href="{% url 'documents:download_attachment' %}?hash_value={{ attachment.hash_value }}">{{ attachment.displayname }}</a>
|
| 93 |
+
</li>
|
| 94 |
+
{% endfor %}
|
| 95 |
+
</ul>
|
| 96 |
+
{% endif %}
|
| 97 |
+
{% endblock %}
|
| 98 |
+
{% endblock %}
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
{% block scripts %}
|
| 102 |
+
{{ block.super }}
|
| 103 |
+
<script type="text/javascript">
|
| 104 |
+
$(document).ready(function() {
|
| 105 |
+
// add link text to title of all elements in toc to enable tooltips with full text
|
| 106 |
+
$('.toc a').each(function() {
|
| 107 |
+
this.title = this.text;
|
| 108 |
+
});
|
| 109 |
+
});
|
| 110 |
+
</script>
|
| 111 |
+
{% endblock %}
|
1327-master/_1327/documents/templates/documents_edit.html
ADDED
|
@@ -0,0 +1,459 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends 'documents_base.html' %}
|
| 2 |
+
|
| 3 |
+
{% load static %}
|
| 4 |
+
{% load i18n %}
|
| 5 |
+
{% load bootstrap3 %}
|
| 6 |
+
{% load num_revisions %}
|
| 7 |
+
|
| 8 |
+
{% block document_content %}
|
| 9 |
+
<h2>{% trans "Edit page" %}</h2>
|
| 10 |
+
|
| 11 |
+
{% for autosave in form.autosaves %}
|
| 12 |
+
<div class="alert alert-danger alert-margin-bottom" role="alert">{% blocktrans with date=autosave.created %}This document was autosaved on {{ date }}{% endblocktrans %}, {% trans "you can restore unsaved changes:" %} <a href="{{ document.get_edit_url }}?restore={{ autosave.id }}" class="btn-sm btn-default">{% trans "Restore" %}</a></div>
|
| 13 |
+
{% endfor %}
|
| 14 |
+
|
| 15 |
+
{% for new_autosaved_page in new_autosaved_pages %}
|
| 16 |
+
<div class="alert alert-danger alert-margin-bottom" role="alert">{% blocktrans with date=new_autosaved_page.created %}There is a new document autosaved on {{ date }}{% endblocktrans %}, {% trans "you can restore this unsaved page:" %} <a href="{{ new_autosaved_page.document.get_edit_url }}?restore={{ new_autosaved_page.id }}" class="btn-sm btn-default">{% trans "Restore" %}</a></div>
|
| 17 |
+
{% endfor %}
|
| 18 |
+
|
| 19 |
+
<form action="{{ document.get_edit_url }}" method="post" class="form-horizontal" role="form" id="document-form">
|
| 20 |
+
{% bootstrap_form form layout='horizontal' %}
|
| 21 |
+
{% csrf_token %}
|
| 22 |
+
{% block inlineformset %}{% endblock %}
|
| 23 |
+
{% buttons %}
|
| 24 |
+
<div class="col-md-offset-2 col-md-9">
|
| 25 |
+
<button type="submit" class="btn btn-primary">
|
| 26 |
+
{% trans 'Save' %}
|
| 27 |
+
</button>
|
| 28 |
+
{% if document|num_revisions > 0 %}
|
| 29 |
+
<button type="button" class="btn btn-danger" id="deleteDocumentButton">
|
| 30 |
+
{% trans 'Delete' %}
|
| 31 |
+
</button>
|
| 32 |
+
{% endif %}
|
| 33 |
+
</div>
|
| 34 |
+
{% endbuttons %}
|
| 35 |
+
</form>
|
| 36 |
+
|
| 37 |
+
<h2>{% trans "Preview" %} <a id="shareText" class="hidden">Share</a></h2>
|
| 38 |
+
<div class="divider"></div>
|
| 39 |
+
<div id="text-preview"></div>
|
| 40 |
+
|
| 41 |
+
<div class="modal fade ontop" id="selectImageAttachment" tabindex="-1" role="dialog" aria-hidden="true">
|
| 42 |
+
<div class="modal-dialog">
|
| 43 |
+
<div class="modal-content">
|
| 44 |
+
<div class="modal-header">
|
| 45 |
+
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
| 46 |
+
<span aria-hidden="true">×</span>
|
| 47 |
+
</button>
|
| 48 |
+
<div class="modal-title">{% trans "Select Image:" %}</div>
|
| 49 |
+
</div>
|
| 50 |
+
<div class="modal-body">
|
| 51 |
+
<div class="alert alert-danger hidden" id="image-upload-error-display" role="alert">
|
| 52 |
+
{% trans "Error! Could not upload image." %}
|
| 53 |
+
</div>
|
| 54 |
+
<select class="form-control" id="attachmentModalSelect"></select>
|
| 55 |
+
<div class="divider"></div>
|
| 56 |
+
<h2>{% trans "Preview" %}</h2>
|
| 57 |
+
<div class="preview">
|
| 58 |
+
<img id="attachment-preview" style="width: 100%; height: 100%;" />
|
| 59 |
+
</div>
|
| 60 |
+
<div class="hidden" id="image-upload-area">
|
| 61 |
+
<h2>{% trans "Upload new image" %}</h2>
|
| 62 |
+
<div class="divider"></div>
|
| 63 |
+
<form enctype="multipart/form-data" id="image-upload-form" method="post" class="form-horizontal" role="form" enctype="multipart/form-data">
|
| 64 |
+
{% bootstrap_form attachment_form layout='horizontal' %}
|
| 65 |
+
{% csrf_token %}
|
| 66 |
+
{% buttons %}
|
| 67 |
+
<div class="col-md-offset-2 col-md-9">
|
| 68 |
+
<button type="submit" class="btn btn-primary">
|
| 69 |
+
{% trans 'Add Image' %}
|
| 70 |
+
</button>
|
| 71 |
+
</div>
|
| 72 |
+
{% endbuttons %}
|
| 73 |
+
</form>
|
| 74 |
+
</div>
|
| 75 |
+
</div>
|
| 76 |
+
|
| 77 |
+
<div class="modal-footer">
|
| 78 |
+
<button type="button" class="btn btn-info" id="addImage">{% trans "Add new Image" %}</button>
|
| 79 |
+
<button type="button" class="btn btn-primary" id="setImage">{% trans "OK" %}</button>
|
| 80 |
+
</div>
|
| 81 |
+
</div>
|
| 82 |
+
</div>
|
| 83 |
+
</div>
|
| 84 |
+
|
| 85 |
+
{% if document|num_revisions > 0 %}
|
| 86 |
+
<div class="modal fade ontop" id="deleteDocumentModal" tabindex="-1" role="dialog" aria-labelledby="deleteDocumentHeader">
|
| 87 |
+
<div class="modal-dialog" role="document">
|
| 88 |
+
<div class="modal-content">
|
| 89 |
+
<div class="modal-header">
|
| 90 |
+
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
| 91 |
+
<span aria-hidden="true">×</span>
|
| 92 |
+
</button>
|
| 93 |
+
<h4 class="modal-title" id="deleteDocumentHeader">{% trans "Do you really want to delete this document?" %}</h4>
|
| 94 |
+
</div>
|
| 95 |
+
<div class="modal-body">
|
| 96 |
+
<p>{% trans "If you delete this document you will also delete the following database items:" %}</p>
|
| 97 |
+
<div id="documentDeleteCascadeInfo"></div>
|
| 98 |
+
</div>
|
| 99 |
+
<div class="modal-footer">
|
| 100 |
+
<button type="button" class="btn btn-danger" id="deleteDocumentConfirmationButton">{% trans "Delete" %}</button>
|
| 101 |
+
</div>
|
| 102 |
+
</div>
|
| 103 |
+
</div>
|
| 104 |
+
</div>
|
| 105 |
+
{% endif %}
|
| 106 |
+
|
| 107 |
+
<div class="modal fade ontop" id="selectInternalLinkDestination" role="dialog" aria-hidden="true">
|
| 108 |
+
<div class="modal-dialog">
|
| 109 |
+
<div class="modal-content">
|
| 110 |
+
<div class="modal-header">
|
| 111 |
+
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
| 112 |
+
<span aria-hidden="true">×</span>
|
| 113 |
+
</button>
|
| 114 |
+
<div class="modal-title">{% trans "Select link target" %}</div>
|
| 115 |
+
</div>
|
| 116 |
+
<div class="modal-body">
|
| 117 |
+
<select class="form-control" id="selectInternalLinkModal"></select>
|
| 118 |
+
</div>
|
| 119 |
+
<div class="modal-footer">
|
| 120 |
+
<button type="button" class="btn btn-primary" id="setInternalLinkDestination">{% trans "OK" %}</button>
|
| 121 |
+
</div>
|
| 122 |
+
</div>
|
| 123 |
+
</div>
|
| 124 |
+
</div>
|
| 125 |
+
|
| 126 |
+
<div class="modal fade ontop" id="autosaveErrorDialog" role="dialog" aria-hidden="true">
|
| 127 |
+
<div class="modal-dialog">
|
| 128 |
+
<div class="modal-content">
|
| 129 |
+
<div class="modal-header">
|
| 130 |
+
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
| 131 |
+
<span aria-hidden="true">×</span>
|
| 132 |
+
</button>
|
| 133 |
+
<div class="modal-title">{% trans "Autosave failed" %}</div>
|
| 134 |
+
</div>
|
| 135 |
+
<div class="modal-body">
|
| 136 |
+
<span class="autosaveErrorDialogExplanation"></span>
|
| 137 |
+
</div>
|
| 138 |
+
<div class="modal-footer">
|
| 139 |
+
<button type="button" class="btn btn-primary autosaveErrorDialogClose">{% trans "Close" %}</button>
|
| 140 |
+
</div>
|
| 141 |
+
</div>
|
| 142 |
+
</div>
|
| 143 |
+
</div>
|
| 144 |
+
{% endblock %}
|
| 145 |
+
|
| 146 |
+
{% block scripts %}
|
| 147 |
+
{{ block.super }}
|
| 148 |
+
<!-- mandatory script include -->
|
| 149 |
+
<script type="text/javascript" src="{% static 'js/jquery.hotkeys.js' %}"></script>
|
| 150 |
+
<script type="text/javascript" src="{% static 'js/jquery.formset.js' %}"></script>
|
| 151 |
+
<script type="text/javascript" src="{% static 'bootstrap-markdown/js/bootstrap-markdown.js' %}"></script>
|
| 152 |
+
<script>
|
| 153 |
+
var efficient_render = debounce(function render() {
|
| 154 |
+
$.ajax({
|
| 155 |
+
url: "{% url 'documents:render' document.url_title %}",
|
| 156 |
+
type: "post",
|
| 157 |
+
data: {'text': $('#id_text').val()},
|
| 158 |
+
success: function(data, status, jqxhr) {
|
| 159 |
+
$('#text-preview').html(data);
|
| 160 |
+
}
|
| 161 |
+
});
|
| 162 |
+
}, 1000);
|
| 163 |
+
|
| 164 |
+
function addImageToText(editor, attachmentHash, modal) {
|
| 165 |
+
var chunk = "";
|
| 166 |
+
editor.replaceSelection(chunk);
|
| 167 |
+
var cursor = editor.getSelection();
|
| 168 |
+
|
| 169 |
+
editor.setSelection(cursor, cursor + chunk.length);
|
| 170 |
+
modal.modal('hide');
|
| 171 |
+
$('#id_text').trigger('change');
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
$("#id_text").removeClass('form-control').markdown({
|
| 175 |
+
autofocus:true,
|
| 176 |
+
resize:"both",
|
| 177 |
+
hiddenButtons: ["cmdPreview", "cmdImage"],
|
| 178 |
+
onChange: efficient_render,
|
| 179 |
+
onShow: function(e) {
|
| 180 |
+
this.onChange(e);
|
| 181 |
+
},
|
| 182 |
+
additionalButtons: [
|
| 183 |
+
// exchange the old image button by a new button
|
| 184 |
+
[{
|
| 185 |
+
name: "ImageGroup",
|
| 186 |
+
data: [{
|
| 187 |
+
name: "cmdAddImage",
|
| 188 |
+
toggle: false,
|
| 189 |
+
title: "Add Image",
|
| 190 |
+
icon: "glyphicon glyphicon-picture",
|
| 191 |
+
callback: function (e) {
|
| 192 |
+
// get all attachments
|
| 193 |
+
$.getJSON(
|
| 194 |
+
"{% url "documents:get_attachments" document.id %}",
|
| 195 |
+
{},
|
| 196 |
+
function (data, textStatus, jqXHR) {
|
| 197 |
+
// prepare the select in the modal
|
| 198 |
+
var select = $('#attachmentModalSelect');
|
| 199 |
+
if ($.isEmptyObject(data)) {
|
| 200 |
+
// if there are no pictures disable the select
|
| 201 |
+
select.attr('disabled', 'disabled');
|
| 202 |
+
return;
|
| 203 |
+
} else {
|
| 204 |
+
select.attr('disabled', false);
|
| 205 |
+
}
|
| 206 |
+
var options = select.prop('options');
|
| 207 |
+
$('option', select).remove();
|
| 208 |
+
$.each(data, function (val, text) {
|
| 209 |
+
options[options.length] = new Option(text, val);
|
| 210 |
+
});
|
| 211 |
+
// trigger the change event in order to show the preview of the pre selected
|
| 212 |
+
// image
|
| 213 |
+
select.trigger('change');
|
| 214 |
+
});
|
| 215 |
+
|
| 216 |
+
var modalItem = $('#selectImageAttachment');
|
| 217 |
+
modalItem.modal();
|
| 218 |
+
modalItem.on('hide.bs.modal', function () {
|
| 219 |
+
$('#image-upload-area').addClass('hidden');
|
| 220 |
+
$('#image-upload-error-display').addClass('hidden');
|
| 221 |
+
});
|
| 222 |
+
|
| 223 |
+
// set the click handler on the ok button that adds the image to the text
|
| 224 |
+
// and closes the modal
|
| 225 |
+
var setButton = $('#setImage');
|
| 226 |
+
setButton.off('click');
|
| 227 |
+
setButton.on("click", function (event) {
|
| 228 |
+
var select = $('#attachmentModalSelect');
|
| 229 |
+
if (select.attr('disabled')) {
|
| 230 |
+
modalItem.modal('hide');
|
| 231 |
+
return;
|
| 232 |
+
}
|
| 233 |
+
// find the right spot to insert the text and create the correct markdown
|
| 234 |
+
var attachmentHash = select.val();
|
| 235 |
+
addImageToText(e, attachmentHash, modalItem)
|
| 236 |
+
|
| 237 |
+
});
|
| 238 |
+
|
| 239 |
+
// enable image uploading
|
| 240 |
+
var imageUploadForm = $('#image-upload-form');
|
| 241 |
+
imageUploadForm.off('submit');
|
| 242 |
+
imageUploadForm.on('submit', function (event) {
|
| 243 |
+
event.preventDefault();
|
| 244 |
+
|
| 245 |
+
var filename = $(this).find('input[name=file]').val();
|
| 246 |
+
|
| 247 |
+
// determine whether selected file might be an image
|
| 248 |
+
var file_type_is_ok = false;
|
| 249 |
+
{% for image_type in supported_image_types %}
|
| 250 |
+
if (filename.toLowerCase().endsWith('{{ image_type }}')) {
|
| 251 |
+
file_type_is_ok = true;
|
| 252 |
+
}
|
| 253 |
+
{% endfor %}
|
| 254 |
+
|
| 255 |
+
if (!file_type_is_ok) {
|
| 256 |
+
$('#image-upload-error-display').removeClass('hidden');
|
| 257 |
+
return;
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
var formData = new FormData(this);
|
| 261 |
+
formData.append("document", {{ document.id }});
|
| 262 |
+
|
| 263 |
+
$.ajax({
|
| 264 |
+
url: "{% url 'documents:create_attachment' %}",
|
| 265 |
+
data: formData,
|
| 266 |
+
processData: false,
|
| 267 |
+
contentType: false,
|
| 268 |
+
type: 'POST',
|
| 269 |
+
success: function (data) {
|
| 270 |
+
addImageToText(e, data, modalItem);
|
| 271 |
+
},
|
| 272 |
+
error: function () {
|
| 273 |
+
$('#image-upload-error-display').removeClass('hidden');
|
| 274 |
+
}
|
| 275 |
+
});
|
| 276 |
+
});
|
| 277 |
+
}
|
| 278 |
+
}]
|
| 279 |
+
},
|
| 280 |
+
|
| 281 |
+
{
|
| 282 |
+
name: "InternalGroup",
|
| 283 |
+
data: [{
|
| 284 |
+
name: "cmdAddInternalLink",
|
| 285 |
+
toggle: false,
|
| 286 |
+
title: "Add internal link",
|
| 287 |
+
icon: "glyphicon glyphicon-circle-arrow-right",
|
| 288 |
+
callback: function (e) {
|
| 289 |
+
|
| 290 |
+
var modalItem = $('#selectInternalLinkDestination');
|
| 291 |
+
modalItem.modal();
|
| 292 |
+
|
| 293 |
+
// set the click handler on the ok button that adds the markdown to the text
|
| 294 |
+
// and closes the modal
|
| 295 |
+
var setButton = $('#setInternalLinkDestination');
|
| 296 |
+
setButton.off('click');
|
| 297 |
+
setButton.on("click", function (event) {
|
| 298 |
+
modalItem.modal('hide');
|
| 299 |
+
// find the right spot to insert the text and create the correct markdown
|
| 300 |
+
var markdown = $('#selectInternalLinkModal').val();
|
| 301 |
+
if (markdown !== null) {
|
| 302 |
+
linkText = markdown.match(/\[(.*?)\]/)[1]; // we want the text inside the [ ]
|
| 303 |
+
selected = e.getSelection();
|
| 304 |
+
e.replaceSelection(markdown);
|
| 305 |
+
cursor = selected.start;
|
| 306 |
+
e.setSelection(cursor + 1, cursor + linkText.length + 1); // +1 because we do not want to select the starting [
|
| 307 |
+
if(selected.length > 0) { // if there was selected text, we want to use this a link text
|
| 308 |
+
e.replaceSelection(selected.text);
|
| 309 |
+
e.setSelection(cursor + 1, cursor + selected.length + 1);
|
| 310 |
+
}
|
| 311 |
+
$("#id_text").focus();
|
| 312 |
+
}
|
| 313 |
+
});
|
| 314 |
+
}
|
| 315 |
+
}]
|
| 316 |
+
}]
|
| 317 |
+
]
|
| 318 |
+
});
|
| 319 |
+
|
| 320 |
+
// handler to update the preview in the modal
|
| 321 |
+
$('#attachmentModalSelect').on('change', function (event) {
|
| 322 |
+
var attachmentHash = $(this).val();
|
| 323 |
+
$('#attachment-preview').attr('src', "{% url 'documents:download_attachment' %}?hash_value=" + attachmentHash + "&embed=True");
|
| 324 |
+
});
|
| 325 |
+
|
| 326 |
+
$('#addImage').on('click', function (event) {
|
| 327 |
+
$('#image-upload-area').removeClass('hidden');
|
| 328 |
+
});
|
| 329 |
+
|
| 330 |
+
{% if document|num_revisions > 0 %}
|
| 331 |
+
function createCascadeList(cascade, domObject) {
|
| 332 |
+
for(var i = 0; i < cascade.length; i++) {
|
| 333 |
+
var cascadeItem = cascade[i];
|
| 334 |
+
if (cascadeItem.constructor === Array) {
|
| 335 |
+
var sublist = $('<ul>');
|
| 336 |
+
createCascadeList(cascadeItem, sublist);
|
| 337 |
+
domObject.append(sublist);
|
| 338 |
+
}
|
| 339 |
+
else {
|
| 340 |
+
domObject.append($('<li></li>').text(cascadeItem.type + ": " + cascadeItem.name));
|
| 341 |
+
}
|
| 342 |
+
}
|
| 343 |
+
}
|
| 344 |
+
|
| 345 |
+
var deleteDocumentModal = $('#deleteDocumentModal');
|
| 346 |
+
deleteDocumentModal.modal({
|
| 347 |
+
show: false
|
| 348 |
+
});
|
| 349 |
+
|
| 350 |
+
$('#deleteDocumentButton').on('click', function (event) {
|
| 351 |
+
$.getJSON(
|
| 352 |
+
"{% url "documents:get_delete_cascade" document.url_title %}",
|
| 353 |
+
{},
|
| 354 |
+
function (data, textStatus, jqXHR) {
|
| 355 |
+
deleteDocumentModal.modal('show');
|
| 356 |
+
// prepare the select in the modal
|
| 357 |
+
var cascadeInfo = $('#documentDeleteCascadeInfo');
|
| 358 |
+
|
| 359 |
+
// delete old content
|
| 360 |
+
cascadeInfo.children().each(function (index, element) {
|
| 361 |
+
element.remove();
|
| 362 |
+
});
|
| 363 |
+
|
| 364 |
+
// create new content by traversing provided data
|
| 365 |
+
var cascadeList = $('<ul>');
|
| 366 |
+
createCascadeList(data, cascadeList);
|
| 367 |
+
cascadeInfo.append(cascadeList);
|
| 368 |
+
});
|
| 369 |
+
});
|
| 370 |
+
|
| 371 |
+
$("#deleteDocumentConfirmationButton").on('click', function (event) {
|
| 372 |
+
$.post(
|
| 373 |
+
"{% url "documents:delete_document" document.url_title %}",
|
| 374 |
+
{},
|
| 375 |
+
function (data, textStatus, jqXHR) {
|
| 376 |
+
deleteDocumentModal.modal('hide');
|
| 377 |
+
window.location.replace("/");
|
| 378 |
+
}
|
| 379 |
+
);
|
| 380 |
+
});
|
| 381 |
+
{% endif %}
|
| 382 |
+
|
| 383 |
+
var text = $('#id_text').val();
|
| 384 |
+
function save() {
|
| 385 |
+
if(text != $('#id_text').val()) {
|
| 386 |
+
text = $('#id_text').val();
|
| 387 |
+
|
| 388 |
+
var form = $('#document-form');
|
| 389 |
+
var serializedData = form.serialize();
|
| 390 |
+
|
| 391 |
+
$.ajax({
|
| 392 |
+
url: "{% url 'documents:autosave' document.url_title %}",
|
| 393 |
+
type: "post",
|
| 394 |
+
data: serializedData,
|
| 395 |
+
success: function(data, textStatus, jqXHR) {
|
| 396 |
+
data = JSON.parse(data);
|
| 397 |
+
var url = data.preview_url;
|
| 398 |
+
var destinationElement = $('#shareText');
|
| 399 |
+
destinationElement.attr('href', url);
|
| 400 |
+
destinationElement.removeClass('hidden');
|
| 401 |
+
},
|
| 402 |
+
error: function(jqXHR, textStatus, errorThrown) {
|
| 403 |
+
var reasonDisplay = $('.autosaveErrorDialogExplanation');
|
| 404 |
+
var statusCode = jqXHR.status;
|
| 405 |
+
var reason = "";
|
| 406 |
+
switch (statusCode) {
|
| 407 |
+
case 403:
|
| 408 |
+
reason = "{% trans "Probably you are logged out!" %}";
|
| 409 |
+
break;
|
| 410 |
+
case 404:
|
| 411 |
+
reason = "{% trans "The document you are editing does not exist!" %}";
|
| 412 |
+
break;
|
| 413 |
+
default:
|
| 414 |
+
reason = "{% trans "There was an unknown error!" %}";
|
| 415 |
+
break;
|
| 416 |
+
}
|
| 417 |
+
reasonDisplay.html(reason);
|
| 418 |
+
|
| 419 |
+
var errorDisplay = $('#autosaveErrorDialog');
|
| 420 |
+
errorDisplay.modal();
|
| 421 |
+
$('.autosaveErrorDialogClose').on('click', function() {
|
| 422 |
+
errorDisplay.modal('hide');
|
| 423 |
+
});
|
| 424 |
+
}
|
| 425 |
+
});
|
| 426 |
+
}
|
| 427 |
+
setTimeout(function() { save(); }, 10000);
|
| 428 |
+
}
|
| 429 |
+
save();
|
| 430 |
+
|
| 431 |
+
// Activate Select2 if present on page
|
| 432 |
+
$(".select2-selection").select2({
|
| 433 |
+
language: "{{ LANGUAGE_CODE }}",
|
| 434 |
+
placeholder: "{% trans 'Please select...' %}"
|
| 435 |
+
});
|
| 436 |
+
|
| 437 |
+
$(".select2-selection-clearable").select2({
|
| 438 |
+
language: "{{ LANGUAGE_CODE }}",
|
| 439 |
+
placeholder: "{% trans 'Please select...' %}",
|
| 440 |
+
allowClear: true
|
| 441 |
+
});
|
| 442 |
+
|
| 443 |
+
$("#selectInternalLinkModal").select2({
|
| 444 |
+
language: "{{ LANGUAGE_CODE }}",
|
| 445 |
+
placeholder: "{% trans 'Please select...' %}",
|
| 446 |
+
ajax: {
|
| 447 |
+
url: '/documents/search',
|
| 448 |
+
delay: 250,
|
| 449 |
+
dataType: 'json'
|
| 450 |
+
},
|
| 451 |
+
minimumInputLength: 1
|
| 452 |
+
});
|
| 453 |
+
|
| 454 |
+
{% block additional_scripts %}{% endblock %}
|
| 455 |
+
|
| 456 |
+
// add datepicker to date inputs
|
| 457 |
+
$("input[name*='date']:not([readonly='True'])").datepicker( $.datepicker.regional["{{ LANGUAGE_CODE }}"] );
|
| 458 |
+
</script>
|
| 459 |
+
{% endblock %}
|
1327-master/_1327/documents/templates/documents_permissions.html
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends 'documents_base.html' %}
|
| 2 |
+
|
| 3 |
+
{% load static %}
|
| 4 |
+
{% load i18n %}
|
| 5 |
+
|
| 6 |
+
{% block title %}
|
| 7 |
+
{{ document.title }}
|
| 8 |
+
{% endblock %}
|
| 9 |
+
|
| 10 |
+
{% block document_content %}
|
| 11 |
+
<h2>{% trans "Edit Permissions" %}</h2>
|
| 12 |
+
|
| 13 |
+
<form method="POST">
|
| 14 |
+
{% csrf_token %}
|
| 15 |
+
{{ formset.management_form }}
|
| 16 |
+
<div class="form-group">
|
| 17 |
+
{% for dict in formset.errors %}
|
| 18 |
+
{% for error in dict.values %}
|
| 19 |
+
<div class="alert alert-danger" role="alert">
|
| 20 |
+
{{ error }}
|
| 21 |
+
</div>
|
| 22 |
+
{% endfor %}
|
| 23 |
+
{% endfor %}
|
| 24 |
+
</div>
|
| 25 |
+
<div class="form-group">
|
| 26 |
+
<table class="table table-striped vertically-aligned table-narrow" >
|
| 27 |
+
<thead>
|
| 28 |
+
{{ formset_header }}
|
| 29 |
+
</thead>
|
| 30 |
+
<tbody>
|
| 31 |
+
{% for form in formset %}
|
| 32 |
+
{{ form.as_table }}
|
| 33 |
+
{% endfor %}
|
| 34 |
+
</tbody>
|
| 35 |
+
</table>
|
| 36 |
+
</div>
|
| 37 |
+
<div class="form-group">
|
| 38 |
+
<button type="submit" class="btn btn-primary">{% trans "Save" %}</button>
|
| 39 |
+
</div>
|
| 40 |
+
</form>
|
| 41 |
+
{% endblock %}
|
1327-master/_1327/documents/templates/documents_preview.html
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends "base_without_sidebar.html" %}
|
| 2 |
+
{% load i18n %}
|
| 3 |
+
{% load bootstrap3 %}
|
| 4 |
+
|
| 5 |
+
{% block title %}
|
| 6 |
+
{{ title }}
|
| 7 |
+
{% endblock %}
|
| 8 |
+
|
| 9 |
+
{% block content %}
|
| 10 |
+
<div class="content">{{ text|safe }}</div>
|
| 11 |
+
{% endblock %}
|
| 12 |
+
|
| 13 |
+
{% block scripts %}
|
| 14 |
+
{{ block.super }}
|
| 15 |
+
|
| 16 |
+
<script>
|
| 17 |
+
var websocketMethod = location.protocol == 'http:' ? 'ws://' : 'wss://';
|
| 18 |
+
var socket = new WebSocket(websocketMethod + window.location.host + '{{ preview_url }}/{{ hash_value }}');
|
| 19 |
+
socket.onmessage = function(e) {
|
| 20 |
+
$('.content').html(e.data);
|
| 21 |
+
};
|
| 22 |
+
// Call onopen directly if socket is already open
|
| 23 |
+
if (socket.readyState == WebSocket.OPEN) socket.onopen();
|
| 24 |
+
|
| 25 |
+
</script>
|
| 26 |
+
|
| 27 |
+
{% endblock %}
|
1327-master/_1327/documents/templates/documents_versions.html
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends 'documents_base.html' %}
|
| 2 |
+
{% load static %}
|
| 3 |
+
{% load i18n %}
|
| 4 |
+
{% load compile_static %}
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
{% block title %}
|
| 8 |
+
{{ document.title }}
|
| 9 |
+
{% endblock %}
|
| 10 |
+
|
| 11 |
+
{% block css %}
|
| 12 |
+
{{ block.super }}
|
| 13 |
+
<link rel="stylesheet" href="{% static 'less/diffview.less'|compile %}" />
|
| 14 |
+
{% endblock %}
|
| 15 |
+
|
| 16 |
+
{% block document_content %}
|
| 17 |
+
<h2>{% trans "Diff page versions" %}</h2>
|
| 18 |
+
|
| 19 |
+
<table class="table table-striped">
|
| 20 |
+
<thead>
|
| 21 |
+
<tr>
|
| 22 |
+
<th colspan="2">{% trans "Revision" %}</th>
|
| 23 |
+
<th colspan="2">{% trans "Compare" %}</th>
|
| 24 |
+
<th></th>
|
| 25 |
+
</tr>
|
| 26 |
+
</thead>
|
| 27 |
+
<tbody>
|
| 28 |
+
{% for id, version, data in versions %}
|
| 29 |
+
<tr>
|
| 30 |
+
<td>{{ id }}</td>
|
| 31 |
+
<td>{{ version.revision.date_created|date:'d.m.Y, H:i' }}, {{ version.revision.comment }} {% trans 'by' %} {{ version.revision.user }}</td>
|
| 32 |
+
<td><input type="radio" class="version-control" name="compare-a" value="{{ id }}"></td>
|
| 33 |
+
<td><input type="radio" class="version-control" name="compare-b" value="{{ id }}"></td>
|
| 34 |
+
<td>
|
| 35 |
+
{% if not forloop.last %}
|
| 36 |
+
<button type="button" class="btn btn-default version-revert-button" data-toggle="modal" data-target="#confirmation-modal" data-revision-id="{{ version.pk }}" data-revision-name="{{ version.revision.date_created|date:'d.m.Y, H:i' }}, {{ version.revision.comment }} {% trans 'by' %} {{ version.revision.user }}" {% if not can_be_reverted %}disabled{% endif %}>{% trans "Revert to this version" %}</button>
|
| 37 |
+
{% endif %}
|
| 38 |
+
</td>
|
| 39 |
+
</tr>
|
| 40 |
+
{% endfor %}
|
| 41 |
+
</tbody>
|
| 42 |
+
</table>
|
| 43 |
+
|
| 44 |
+
<div class="row">
|
| 45 |
+
<div class="col-sm-12 diffview" id="diffDisplay"></div>
|
| 46 |
+
</div>
|
| 47 |
+
{% endblock %}
|
| 48 |
+
|
| 49 |
+
{% block scripts %}
|
| 50 |
+
{{ block.super }}
|
| 51 |
+
{% include 'diffviewer_scripts.html' %}
|
| 52 |
+
{% endblock %}
|
1327-master/_1327/documents/templates/search_api.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% load static %}
|
| 2 |
+
{% load i18n %}
|
| 3 |
+
|
| 4 |
+
[
|
| 5 |
+
{% if minutes %}
|
| 6 |
+
{
|
| 7 |
+
"text": "{% trans 'Minutes' %}",
|
| 8 |
+
"children": [
|
| 9 |
+
{% for minute in minutes %}
|
| 10 |
+
{
|
| 11 |
+
{% if id_only %}
|
| 12 |
+
"id": {{ minute.id }},
|
| 13 |
+
{% else %}
|
| 14 |
+
"id": "[{{ minute.title }}](document:{{ minute.id }})",
|
| 15 |
+
{% endif %}
|
| 16 |
+
"text": "{{ minute.title }} ({{ minute.date|date:"d.m.Y" }})"
|
| 17 |
+
}{% if not forloop.last %},{% endif %}
|
| 18 |
+
{% endfor %}
|
| 19 |
+
]
|
| 20 |
+
}{% if information_documents or polls %},{% endif %}
|
| 21 |
+
{% endif %}
|
| 22 |
+
{% if information_documents %}
|
| 23 |
+
{
|
| 24 |
+
"text": "{% trans 'Information Documents' %}",
|
| 25 |
+
"children": [
|
| 26 |
+
{% for information_document in information_documents %}
|
| 27 |
+
{
|
| 28 |
+
{% if id_only %}
|
| 29 |
+
"id": {{ information_document.id }},
|
| 30 |
+
{% else %}
|
| 31 |
+
"id": "[{{ information_document.title }}](document:{{ information_document.id }})",
|
| 32 |
+
{% endif %}
|
| 33 |
+
"text": "{{ information_document.title }}"
|
| 34 |
+
}{% if not forloop.last %},{% endif %}
|
| 35 |
+
{% endfor %}
|
| 36 |
+
]
|
| 37 |
+
}{% if polls %},{% endif %}
|
| 38 |
+
{% endif %}
|
| 39 |
+
{% if polls %}
|
| 40 |
+
{
|
| 41 |
+
"text": "{% trans 'Polls' %}",
|
| 42 |
+
"children": [
|
| 43 |
+
{% for poll in polls %}
|
| 44 |
+
{
|
| 45 |
+
{% if id_only %}
|
| 46 |
+
"id": {{ poll.id }},
|
| 47 |
+
{% else %}
|
| 48 |
+
"id": "[{{ poll.title }}](poll:{{ poll.id }})",
|
| 49 |
+
{% endif %}
|
| 50 |
+
"text": "{{ poll.title }}"
|
| 51 |
+
}{% if not forloop.last %},{% endif %}
|
| 52 |
+
{% endfor %}
|
| 53 |
+
]
|
| 54 |
+
}
|
| 55 |
+
{% endif %}
|
| 56 |
+
]
|
1327-master/_1327/documents/templatetags/num_revisions.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django import template
|
| 2 |
+
from reversion.models import Version
|
| 3 |
+
|
| 4 |
+
register = template.Library()
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
@register.filter
|
| 8 |
+
def num_revisions(document):
|
| 9 |
+
versions = Version.objects.get_for_object(document)
|
| 10 |
+
return len(versions)
|
1327-master/_1327/main/migrations/0002_add_staff_group.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
from __future__ import unicode_literals
|
| 3 |
+
|
| 4 |
+
from django.db import migrations
|
| 5 |
+
from django.contrib.auth.models import Group
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def add_staff_group(apps, schema_editor):
|
| 9 |
+
Group.objects.create(name="Staff")
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
class Migration(migrations.Migration):
|
| 13 |
+
|
| 14 |
+
dependencies = [
|
| 15 |
+
('main', '0001_initial'),
|
| 16 |
+
]
|
| 17 |
+
|
| 18 |
+
operations = [
|
| 19 |
+
migrations.RunPython(add_staff_group),
|
| 20 |
+
]
|
1327-master/_1327/main/migrations/0003_menu_item_data.py
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
from __future__ import unicode_literals
|
| 3 |
+
|
| 4 |
+
from django.db import migrations
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def initial_data(apps, schema_editor):
|
| 8 |
+
# We can't import the MenuItem model directly as it may be a newer
|
| 9 |
+
# version than this migration expects. We use the historical version.
|
| 10 |
+
# We can't import the MenuItem model directly as it may be a newer
|
| 11 |
+
# version than this migration expects. We use the historical version.
|
| 12 |
+
MenuItem = apps.get_model("main", "MenuItem")
|
| 13 |
+
|
| 14 |
+
MenuItem.objects.all().delete()
|
| 15 |
+
|
| 16 |
+
menu_item = MenuItem()
|
| 17 |
+
menu_item.title = "Main Page"
|
| 18 |
+
menu_item.link = 'index'
|
| 19 |
+
menu_item.order = 1
|
| 20 |
+
menu_item.menu_type = 1 # MenuItem.MAIN_MENU
|
| 21 |
+
menu_item.save()
|
| 22 |
+
|
| 23 |
+
menu_item = MenuItem()
|
| 24 |
+
menu_item.title = "Minutes"
|
| 25 |
+
menu_item.link = 'minutes:list'
|
| 26 |
+
menu_item.order = 2
|
| 27 |
+
menu_item.menu_type = 1 # MenuItem.MAIN_MENU
|
| 28 |
+
menu_item.save()
|
| 29 |
+
|
| 30 |
+
menu_item = MenuItem()
|
| 31 |
+
menu_item.title = "Admin"
|
| 32 |
+
menu_item.link = 'admin:index'
|
| 33 |
+
menu_item.order = 1
|
| 34 |
+
menu_item.menu_type = 2 # MenuItem.FOOTER
|
| 35 |
+
menu_item.save()
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
def delete_menu_data(apps, schema_editor):
|
| 39 |
+
MenuItem = apps.get_model("main", "MenuItem")
|
| 40 |
+
|
| 41 |
+
for item in MenuItem.objects.all():
|
| 42 |
+
item.delete()
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
class Migration(migrations.Migration):
|
| 46 |
+
dependencies = [
|
| 47 |
+
('main', '0002_add_staff_group'),
|
| 48 |
+
]
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
operations = [
|
| 52 |
+
migrations.RunPython(initial_data, delete_menu_data),
|
| 53 |
+
]
|
1327-master/_1327/main/migrations/0004_add_university_network_group.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
from __future__ import unicode_literals
|
| 3 |
+
|
| 4 |
+
from django.db import migrations
|
| 5 |
+
from django.contrib.auth.models import Group
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def add_university_network_group(apps, schema_editor):
|
| 9 |
+
Group.objects.create(name="University Network")
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
class Migration(migrations.Migration):
|
| 13 |
+
|
| 14 |
+
dependencies = [
|
| 15 |
+
('main', '0003_menu_item_data'),
|
| 16 |
+
]
|
| 17 |
+
|
| 18 |
+
operations = [
|
| 19 |
+
migrations.RunPython(add_university_network_group),
|
| 20 |
+
]
|
1327-master/_1327/main/migrations/0007_auto_20160711_1653.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
from __future__ import unicode_literals
|
| 3 |
+
|
| 4 |
+
from django.db import migrations, models
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
class Migration(migrations.Migration):
|
| 8 |
+
|
| 9 |
+
dependencies = [
|
| 10 |
+
('main', '0006_merge'),
|
| 11 |
+
]
|
| 12 |
+
|
| 13 |
+
operations = [
|
| 14 |
+
migrations.AlterModelOptions(
|
| 15 |
+
name='menuitem',
|
| 16 |
+
options={'permissions': (('view_menuitem', 'User/Group is allowed to view this menu item'),), 'ordering': ['order']},
|
| 17 |
+
),
|
| 18 |
+
migrations.RemoveField(
|
| 19 |
+
model_name='menuitem',
|
| 20 |
+
name='staff_only',
|
| 21 |
+
),
|
| 22 |
+
]
|
1327-master/_1327/main/migrations/0008_auto_20160806_1303.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
# Generated by Django 1.9.9 on 2016-08-06 11:03
|
| 3 |
+
from __future__ import unicode_literals
|
| 4 |
+
|
| 5 |
+
from django.db import migrations
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class Migration(migrations.Migration):
|
| 9 |
+
|
| 10 |
+
dependencies = [
|
| 11 |
+
('main', '0007_auto_20160711_1653'),
|
| 12 |
+
]
|
| 13 |
+
|
| 14 |
+
operations = [
|
| 15 |
+
migrations.AlterModelOptions(
|
| 16 |
+
name='menuitem',
|
| 17 |
+
options={'ordering': ['order'], 'permissions': (('view_menuitem', 'User/Group is allowed to view this menu item'), ('changechildren_menuitem', 'User/Group is allowed to change children items'))},
|
| 18 |
+
),
|
| 19 |
+
]
|
1327-master/_1327/main/migrations/0009_abbreviationexplanation.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
# Generated by Django 1.9.8 on 2016-08-15 16:33
|
| 3 |
+
from __future__ import unicode_literals
|
| 4 |
+
|
| 5 |
+
from django.db import migrations, models
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class Migration(migrations.Migration):
|
| 9 |
+
|
| 10 |
+
dependencies = [
|
| 11 |
+
('main', '0008_auto_20160806_1303'),
|
| 12 |
+
]
|
| 13 |
+
|
| 14 |
+
operations = [
|
| 15 |
+
migrations.CreateModel(
|
| 16 |
+
name='AbbreviationExplanation',
|
| 17 |
+
fields=[
|
| 18 |
+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
| 19 |
+
('abbreviation', models.CharField(max_length=255, unique=True, verbose_name='Abbreviation')),
|
| 20 |
+
('explanation', models.CharField(max_length=255, verbose_name='Explanation')),
|
| 21 |
+
],
|
| 22 |
+
),
|
| 23 |
+
]
|
1327-master/_1327/main/migrations/0010_menu_item_minutes.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
from __future__ import unicode_literals
|
| 3 |
+
|
| 4 |
+
from django.conf import settings
|
| 5 |
+
from django.contrib.auth.models import Group
|
| 6 |
+
from django.db import migrations
|
| 7 |
+
|
| 8 |
+
def initial_data(apps, schema_editor):
|
| 9 |
+
# We can't import the MenuItem model directly as it may be a newer
|
| 10 |
+
# version than this migration expects. We use the historical version.
|
| 11 |
+
# We can't import the MenuItem model directly as it may be a newer
|
| 12 |
+
# version than this migration expects. We use the historical version.
|
| 13 |
+
MenuItem = apps.get_model("main", "MenuItem")
|
| 14 |
+
|
| 15 |
+
MenuItem.objects.all().delete()
|
| 16 |
+
|
| 17 |
+
menu_item = MenuItem()
|
| 18 |
+
menu_item.title = "Main Page"
|
| 19 |
+
menu_item.link = 'index'
|
| 20 |
+
menu_item.order = 1
|
| 21 |
+
menu_item.menu_type = 1 # MenuItem.MAIN_MENU
|
| 22 |
+
menu_item.save()
|
| 23 |
+
|
| 24 |
+
staff = Group.objects.get(name=settings.STAFF_GROUP_NAME)
|
| 25 |
+
|
| 26 |
+
menu_item = MenuItem()
|
| 27 |
+
menu_item.title = "Minutes"
|
| 28 |
+
menu_item.link = 'minutes:list?' + str(staff.pk)
|
| 29 |
+
menu_item.order = 2
|
| 30 |
+
menu_item.menu_type = 1 # MenuItem.MAIN_MENU
|
| 31 |
+
menu_item.save()
|
| 32 |
+
|
| 33 |
+
menu_item = MenuItem()
|
| 34 |
+
menu_item.title = "Admin"
|
| 35 |
+
menu_item.link = 'admin:index'
|
| 36 |
+
menu_item.order = 1
|
| 37 |
+
menu_item.menu_type = 2 # MenuItem.FOOTER
|
| 38 |
+
menu_item.save()
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
def delete_menu_data(apps, schema_editor):
|
| 42 |
+
MenuItem = apps.get_model("main", "MenuItem")
|
| 43 |
+
|
| 44 |
+
for item in MenuItem.objects.all():
|
| 45 |
+
item.delete()
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
class Migration(migrations.Migration):
|
| 49 |
+
dependencies = [
|
| 50 |
+
('main', '0009_abbreviationexplanation'),
|
| 51 |
+
]
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
operations = [
|
| 55 |
+
migrations.RunPython(initial_data, delete_menu_data),
|
| 56 |
+
]
|
1327-master/_1327/main/migrations/0011_add_student_group.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
from __future__ import unicode_literals
|
| 3 |
+
|
| 4 |
+
from django.db import migrations
|
| 5 |
+
from django.contrib.auth.models import Group
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def add_student_group(apps, schema_editor):
|
| 9 |
+
Group.objects.create(name="Student")
|
| 10 |
+
|
| 11 |
+
def remove_student_group(apps, schema_editor):
|
| 12 |
+
Group.objects.get(name="Student").delete()
|
| 13 |
+
|
| 14 |
+
class Migration(migrations.Migration):
|
| 15 |
+
|
| 16 |
+
dependencies = [
|
| 17 |
+
('main', '0010_menu_item_minutes'),
|
| 18 |
+
]
|
| 19 |
+
|
| 20 |
+
operations = [
|
| 21 |
+
migrations.RunPython(add_student_group, remove_student_group),
|
| 22 |
+
]
|
1327-master/_1327/main/migrations/0012_auto_20161029_2223.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
# Generated by Django 1.9.7 on 2016-10-29 20:23
|
| 3 |
+
from __future__ import unicode_literals
|
| 4 |
+
|
| 5 |
+
from django.db import migrations, models
|
| 6 |
+
import django.db.models.deletion
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class Migration(migrations.Migration):
|
| 10 |
+
|
| 11 |
+
dependencies = [
|
| 12 |
+
('main', '0011_add_student_group'),
|
| 13 |
+
]
|
| 14 |
+
|
| 15 |
+
operations = [
|
| 16 |
+
migrations.AlterField(
|
| 17 |
+
model_name='menuitem',
|
| 18 |
+
name='document',
|
| 19 |
+
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='menu_items', to='documents.Document', verbose_name='Document'),
|
| 20 |
+
),
|
| 21 |
+
]
|
1327-master/_1327/main/migrations/0013_edit_minutes_menu_item.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
from __future__ import unicode_literals
|
| 3 |
+
|
| 4 |
+
from django.db import migrations
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def adapt_links(MenuItem, old_link, new_link, split_str='?'):
|
| 8 |
+
menu_items = MenuItem.objects.filter(link__contains=old_link).all()
|
| 9 |
+
|
| 10 |
+
for menu_item in menu_items:
|
| 11 |
+
id = menu_item.link.split(split_str)[-1]
|
| 12 |
+
menu_item.link = '{}{}'.format(new_link, id)
|
| 13 |
+
menu_item.save()
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def adapt_minutes_link(apps, schema_editor):
|
| 17 |
+
# We can't import the MenuItem model directly as it may be a newer
|
| 18 |
+
# version than this migration expects. We use the historical version.
|
| 19 |
+
MenuItem = apps.get_model("main", "MenuItem")
|
| 20 |
+
|
| 21 |
+
adapt_links(MenuItem, 'minutes:list?', 'minutes:list?groupid=')
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def reverse_minutes_link_adaption(apps, schema_editor):
|
| 25 |
+
MenuItem = apps.get_model("main", "MenuItem")
|
| 26 |
+
|
| 27 |
+
adapt_links(MenuItem, 'minutes:list?groupid=', 'minutes:list?', split_str='?groupid=')
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
class Migration(migrations.Migration):
|
| 31 |
+
dependencies = [
|
| 32 |
+
('main', '0012_auto_20161029_2223'),
|
| 33 |
+
]
|
| 34 |
+
|
| 35 |
+
operations = [
|
| 36 |
+
migrations.RunPython(adapt_minutes_link, reverse_minutes_link_adaption),
|
| 37 |
+
]
|
1327-master/_1327/main/migrations/0014_add_on_delete.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
# Generated by Django 1.11.3 on 2017-07-16 08:07
|
| 3 |
+
from __future__ import unicode_literals
|
| 4 |
+
|
| 5 |
+
from django.db import migrations, models
|
| 6 |
+
import django.db.models.deletion
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class Migration(migrations.Migration):
|
| 10 |
+
|
| 11 |
+
dependencies = [
|
| 12 |
+
('main', '0013_edit_minutes_menu_item'),
|
| 13 |
+
]
|
| 14 |
+
|
| 15 |
+
operations = [
|
| 16 |
+
migrations.AlterField(
|
| 17 |
+
model_name='menuitem',
|
| 18 |
+
name='document',
|
| 19 |
+
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='menu_items', to='documents.Document', verbose_name='Document'),
|
| 20 |
+
),
|
| 21 |
+
]
|
1327-master/_1327/main/templates/400.html
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends "base_without_sidebar.html" %}
|
| 2 |
+
{% load i18n %}
|
| 3 |
+
|
| 4 |
+
{% block title %}400 – {% trans "Bad request" %}{% endblock title %}
|
| 5 |
+
{% block content %}
|
| 6 |
+
{{ block.super }}
|
| 7 |
+
|
| 8 |
+
{% trans "The request was not valid. Please refrain from tempering with the request data ;)" %}
|
| 9 |
+
{% endblock %}
|
1327-master/_1327/main/templates/404.html
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends "base_without_sidebar.html" %}
|
| 2 |
+
{% load i18n %}
|
| 3 |
+
|
| 4 |
+
{% block title %}404 – {% trans "Page not found" %}{% endblock title %}
|
| 5 |
+
{% block content %}
|
| 6 |
+
{{ block.super }}
|
| 7 |
+
|
| 8 |
+
{% trans "The page you requested does not exist. Please check the URL or use the menu above to find your page." %}
|
| 9 |
+
{% endblock %}
|
1327-master/_1327/main/templates/index.html
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends "base_without_sidebar.html" %}
|
| 2 |
+
|
| 3 |
+
{% block title %}Main page{% endblock title %}
|
| 4 |
+
{% block content %}
|
| 5 |
+
{{ block.super }}
|
| 6 |
+
|
| 7 |
+
<p>This is the Default Main Page. If you want a real MainPage you have to do the following:</p>
|
| 8 |
+
<ol>
|
| 9 |
+
<li>Create a new Document and fill in all text and image you want.</li>
|
| 10 |
+
<li>Ask a superuser to set the newly created document as MainPage in the config file.</li>
|
| 11 |
+
</ol>
|
| 12 |
+
{% endblock %}
|
1327-master/_1327/main/templates/menu_item_edit.html
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends 'base_without_sidebar.html' %}
|
| 2 |
+
|
| 3 |
+
{% load i18n %}
|
| 4 |
+
{% load guardian_tags %}
|
| 5 |
+
{% load bootstrap3 %}
|
| 6 |
+
|
| 7 |
+
{% block title %}
|
| 8 |
+
{% if form.instance.pk %}
|
| 9 |
+
{% trans "Edit menu item" %}
|
| 10 |
+
{% else %}
|
| 11 |
+
{% trans "Create menu item" %}
|
| 12 |
+
{% endif %}
|
| 13 |
+
{% endblock %}
|
| 14 |
+
|
| 15 |
+
{% block content %}
|
| 16 |
+
<form method="post" class="form-horizontal" role="form" enctype="multipart/form-data">
|
| 17 |
+
{% bootstrap_form form layout='horizontal' %}
|
| 18 |
+
{% csrf_token %}
|
| 19 |
+
{% if formset %}
|
| 20 |
+
{{ formset.management_form }}
|
| 21 |
+
<div class="form-group">
|
| 22 |
+
<label class="col-md-2 control-label">{% trans "Permissions" %}</label>
|
| 23 |
+
<div class="col-md-9">
|
| 24 |
+
{% for dict in formset.errors %}
|
| 25 |
+
{% for error in dict.values %}
|
| 26 |
+
<div class="alert alert-danger" role="alert">
|
| 27 |
+
{{ error }}
|
| 28 |
+
</div>
|
| 29 |
+
{% endfor %}
|
| 30 |
+
{% endfor %}
|
| 31 |
+
<table class="table table-striped vertically-aligned table-narrow" >
|
| 32 |
+
<thead>
|
| 33 |
+
{{ formset_header }}
|
| 34 |
+
</thead>
|
| 35 |
+
<tbody>
|
| 36 |
+
{% for form in formset %}
|
| 37 |
+
{{ form.as_table }}
|
| 38 |
+
{% endfor %}
|
| 39 |
+
</tbody>
|
| 40 |
+
</table>
|
| 41 |
+
</div>
|
| 42 |
+
</div>
|
| 43 |
+
{% endif %}
|
| 44 |
+
{% buttons %}
|
| 45 |
+
<div class="col-md-offset-2 col-md-9">
|
| 46 |
+
<button type="submit" class="btn btn-primary">{% trans 'Save' %}</button>
|
| 47 |
+
</div>
|
| 48 |
+
{% endbuttons %}
|
| 49 |
+
</form>
|
| 50 |
+
{% endblock %}
|
| 51 |
+
|
| 52 |
+
{% block scripts %}
|
| 53 |
+
{{ block.super }}
|
| 54 |
+
<script type="text/javascript">
|
| 55 |
+
$(document).ready(function() {
|
| 56 |
+
$("#id_parent,#id_menu_type").select2({
|
| 57 |
+
language: "{{ LANGUAGE_CODE }}",
|
| 58 |
+
placeholder: "{% trans 'Please select...' %}",
|
| 59 |
+
allowClear: true,
|
| 60 |
+
minimumResultsForSearch: 3
|
| 61 |
+
});
|
| 62 |
+
$("#id_document").select2({
|
| 63 |
+
language: "{{ LANGUAGE_CODE }}",
|
| 64 |
+
placeholder: "{% trans 'Please select...' %}",
|
| 65 |
+
allowClear: true,
|
| 66 |
+
ajax: {
|
| 67 |
+
url: '/documents/search?id_only=True',
|
| 68 |
+
delay: 250,
|
| 69 |
+
dataType: 'json'
|
| 70 |
+
},
|
| 71 |
+
minimumInputLength: 1
|
| 72 |
+
});
|
| 73 |
+
});
|
| 74 |
+
</script>
|
| 75 |
+
{% endblock %}
|
1327-master/_1327/main/templates/menu_items_index.html
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends 'base_without_sidebar.html' %}
|
| 2 |
+
|
| 3 |
+
{% load i18n %}
|
| 4 |
+
{% load guardian_tags %}
|
| 5 |
+
{% load main_templatetags %}
|
| 6 |
+
{% load static %}
|
| 7 |
+
|
| 8 |
+
{% block title %}
|
| 9 |
+
{% trans "Menu items" %}
|
| 10 |
+
{% endblock %}
|
| 11 |
+
|
| 12 |
+
{% block content %}
|
| 13 |
+
<h3>{% trans "Main menu items" %}</h3>
|
| 14 |
+
<div class="dd" id="main-menu-items">
|
| 15 |
+
{% include_menu_items_list main_menu_items user %}
|
| 16 |
+
</div>
|
| 17 |
+
|
| 18 |
+
{% if footer_items %}
|
| 19 |
+
<h3>{% trans "Footer items" %}</h3>
|
| 20 |
+
<div class="dd" id="footer-items">
|
| 21 |
+
{% include_menu_items_list footer_items user %}
|
| 22 |
+
</div>
|
| 23 |
+
{% endif %}
|
| 24 |
+
|
| 25 |
+
<a type="button" class="btn btn-primary" href="{% url 'menu_item_create' %}">{% trans 'Create new menu item' %}</a>
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
<div class="modal fade" id="confirmMenuItemDeleteModal" tabindex="-1" role="dialog" aria-hidden="true">
|
| 29 |
+
<div class="modal-dialog">
|
| 30 |
+
<div class="modal-content">
|
| 31 |
+
<div class="modal-header">
|
| 32 |
+
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
| 33 |
+
<span aria-hidden="true">×</span>
|
| 34 |
+
</button>
|
| 35 |
+
<h4 class="modal-title">{% trans "Delete menu item" %}</h4>
|
| 36 |
+
</div>
|
| 37 |
+
<div class="modal-body">
|
| 38 |
+
{% trans "Do you really want to delete this menu item? All subitems will also be deleted." %}
|
| 39 |
+
</div>
|
| 40 |
+
<div class="modal-footer">
|
| 41 |
+
<a type="button" id="btn-delete" class="btn btn-danger">{% trans "Delete" %}</a>
|
| 42 |
+
<button type="button" class="btn btn-default" data-dismiss="modal">{% trans "Cancel" %}</button>
|
| 43 |
+
</div>
|
| 44 |
+
</div>
|
| 45 |
+
</div>
|
| 46 |
+
</div>
|
| 47 |
+
{% endblock %}
|
| 48 |
+
|
| 49 |
+
{% block scripts %}
|
| 50 |
+
{{ block.super }}
|
| 51 |
+
<script type="text/javascript" src="{% static 'js/jquery.nestable.js' %}"></script>
|
| 52 |
+
<script type="text/javascript">
|
| 53 |
+
$(document).ready(function(){
|
| 54 |
+
$('#main-menu-items').nestable({
|
| 55 |
+
maxDepth: 3
|
| 56 |
+
});
|
| 57 |
+
$('#main-menu-items').on('change', function() {
|
| 58 |
+
changeMenuOrder();
|
| 59 |
+
});
|
| 60 |
+
|
| 61 |
+
$('#footer-items').nestable({
|
| 62 |
+
maxDepth: 1
|
| 63 |
+
});
|
| 64 |
+
$('#footer-items').on('change', function() {
|
| 65 |
+
changeMenuOrder();
|
| 66 |
+
});
|
| 67 |
+
});
|
| 68 |
+
|
| 69 |
+
var changeMenuOrder = function () {
|
| 70 |
+
var main_menu_items = $('#main-menu-items').nestable('serialize');
|
| 71 |
+
var footer_items = $('#footer-items').nestable('serialize');
|
| 72 |
+
var data = JSON.stringify({'main_menu_items': main_menu_items, 'footer_items': footer_items});
|
| 73 |
+
$.ajax({
|
| 74 |
+
type: "POST",
|
| 75 |
+
url: '{% url "menu_items_update_order" %}',
|
| 76 |
+
data: data,
|
| 77 |
+
success: function(){ location.reload(); }
|
| 78 |
+
});
|
| 79 |
+
};
|
| 80 |
+
|
| 81 |
+
function show_delete_modal(item_id) {
|
| 82 |
+
$('#confirmMenuItemDeleteModal #btn-delete').unbind().click(function(){ delete_modal_action(item_id); });
|
| 83 |
+
$('#confirmMenuItemDeleteModal').modal();
|
| 84 |
+
}
|
| 85 |
+
function delete_modal_action(item_id) {
|
| 86 |
+
$.ajax({
|
| 87 |
+
type: "POST",
|
| 88 |
+
url: "{% url 'menu_item_delete' %}",
|
| 89 |
+
data: {"item_id": item_id},
|
| 90 |
+
success: function(){ location.reload(); }
|
| 91 |
+
});
|
| 92 |
+
};
|
| 93 |
+
</script>
|
| 94 |
+
{% endblock %}
|
1327-master/_1327/minutes/migrations/0007_auto_20160927_1937.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
# Generated by Django 1.9.8 on 2016-09-27 17:37
|
| 3 |
+
from __future__ import unicode_literals
|
| 4 |
+
|
| 5 |
+
from django.db import migrations, models
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class Migration(migrations.Migration):
|
| 9 |
+
|
| 10 |
+
dependencies = [
|
| 11 |
+
('minutes', '0006_auto_20160927_1615'),
|
| 12 |
+
]
|
| 13 |
+
|
| 14 |
+
operations = [
|
| 15 |
+
migrations.AlterField(
|
| 16 |
+
model_name='minutesdocument',
|
| 17 |
+
name='state',
|
| 18 |
+
field=models.IntegerField(choices=[(0, 'Unpublished'), (1, 'Published for Students and University Network'), (2, 'Internal'), (3, 'Custom'), (4, 'Published for Students only')], default=0, verbose_name='State'),
|
| 19 |
+
),
|
| 20 |
+
]
|
1327-master/_1327/minutes/migrations/0008_add_on_delete.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
# Generated by Django 1.9.13 on 2017-07-09 11:23
|
| 3 |
+
from __future__ import unicode_literals
|
| 4 |
+
|
| 5 |
+
from django.conf import settings
|
| 6 |
+
from django.db import migrations, models
|
| 7 |
+
import django.db.models.deletion
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
class Migration(migrations.Migration):
|
| 11 |
+
|
| 12 |
+
dependencies = [
|
| 13 |
+
('minutes', '0007_auto_20160927_1937'),
|
| 14 |
+
]
|
| 15 |
+
|
| 16 |
+
operations = [
|
| 17 |
+
migrations.AlterField(
|
| 18 |
+
model_name='minutesdocument',
|
| 19 |
+
name='author',
|
| 20 |
+
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='documents', to=settings.AUTH_USER_MODEL),
|
| 21 |
+
),
|
| 22 |
+
migrations.AlterField(
|
| 23 |
+
model_name='minutesdocument',
|
| 24 |
+
name='moderator',
|
| 25 |
+
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='moderations', to=settings.AUTH_USER_MODEL, verbose_name='Moderator'),
|
| 26 |
+
),
|
| 27 |
+
]
|
1327-master/_1327/minutes/templates/minutes_meta_information.html
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% load i18n %}
|
| 2 |
+
{% load morefilters %}
|
| 3 |
+
|
| 4 |
+
<dl class="meta-information">
|
| 5 |
+
<dt>{% trans "Date" %}</dt>
|
| 6 |
+
<dd>{{ document.date|date:"d.m.Y" }}</dd>
|
| 7 |
+
{% if document.moderator %}
|
| 8 |
+
<dt>{% trans "Moderator" %}</dt>
|
| 9 |
+
<dd>{{ document.moderator }}</dd>
|
| 10 |
+
{% endif %}
|
| 11 |
+
<dt>{% trans "Minutes taker" %}</dt>
|
| 12 |
+
<dd>{{ document.author }}</dd>
|
| 13 |
+
<dt>{% trans "Participants" %}</dt>
|
| 14 |
+
{% for participant in document.participants.all|sort_users_by_name %}
|
| 15 |
+
<dd>{{ participant }}</dd>
|
| 16 |
+
{% endfor %}
|
| 17 |
+
<dt>{% trans "Guests" %}</dt>
|
| 18 |
+
{% for guest in document.guests.all %}
|
| 19 |
+
<dd>{{ guest.name }}</dd>
|
| 20 |
+
{% empty %}
|
| 21 |
+
<dd><i>{% trans "No Guests" %}</i></dd>
|
| 22 |
+
{% endfor %}
|
| 23 |
+
|
| 24 |
+
<dt {% if document.labels.all|length == 0 %}class="hidden-print"{% endif %}>{% trans "Labels" %}</dt>
|
| 25 |
+
<dd {% if document.labels.all|length == 0 %}class="hidden-print"{% endif %}>
|
| 26 |
+
{% for label in document.labels.all %}
|
| 27 |
+
<span class="label {{ label.class_for_text_color }}" style="background-color: {{ label.color }};">{{ label.title }}</span>
|
| 28 |
+
{% endfor %}
|
| 29 |
+
{% if document.state == document.UNPUBLISHED %}
|
| 30 |
+
<span class="label label-danger">{% trans "Unpublished" %}</span>
|
| 31 |
+
{% elif document.state == document.INTERNAL %}
|
| 32 |
+
<span class="label label-warning">{% trans "Internal" %}</span>
|
| 33 |
+
{% elif document.labels.all|length == 0 %}
|
| 34 |
+
<i>{% trans "No Labels" %}</i>
|
| 35 |
+
{% endif %}
|
| 36 |
+
</dd>
|
| 37 |
+
{% if permission_overview %}
|
| 38 |
+
<dt class="hidden-print">{% trans "Last change" %}</dt>
|
| 39 |
+
<dd class="hidden-print">{{ document.last_change|date:"d.m.Y, H:i" }}</dd>
|
| 40 |
+
{% endif %}
|
| 41 |
+
</dl>
|
1327-master/_1327/polls/forms.py
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django import forms
|
| 2 |
+
from django.conf import settings
|
| 3 |
+
from django.contrib.auth.models import Group
|
| 4 |
+
from django.core.exceptions import ValidationError
|
| 5 |
+
from django.forms import inlineformset_factory
|
| 6 |
+
from django.utils.translation import ugettext_lazy as _
|
| 7 |
+
|
| 8 |
+
from _1327.documents.forms import AtLeastNFormSet, DocumentForm
|
| 9 |
+
from .models import Choice, Poll
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
class PollForm(DocumentForm):
|
| 13 |
+
vote_groups = forms.ModelMultipleChoiceField(Group.objects.exclude(name=settings.ANONYMOUS_GROUP_NAME).exclude(name=settings.UNIVERSITY_GROUP_NAME), label=_('Vote permissions'), disabled=False, required=False)
|
| 14 |
+
|
| 15 |
+
class Meta:
|
| 16 |
+
model = Poll
|
| 17 |
+
fields = ['title', 'url_title', 'text', 'start_date', 'end_date', 'max_allowed_number_of_answers', 'show_results_immediately', 'comment', 'group', 'vote_groups']
|
| 18 |
+
|
| 19 |
+
def __init__(self, *args, **kwargs):
|
| 20 |
+
creation = kwargs.get('creation', None)
|
| 21 |
+
super().__init__(*args, **kwargs)
|
| 22 |
+
|
| 23 |
+
if creation:
|
| 24 |
+
self.fields['vote_groups'].widget.attrs['class'] = 'select2-selection'
|
| 25 |
+
else:
|
| 26 |
+
self.fields['vote_groups'].widget = forms.HiddenInput()
|
| 27 |
+
self.fields['vote_groups'].required = False
|
| 28 |
+
|
| 29 |
+
def clean(self):
|
| 30 |
+
super().clean()
|
| 31 |
+
start_date = self.cleaned_data.get('start_date')
|
| 32 |
+
end_date = self.cleaned_data.get('end_date')
|
| 33 |
+
if start_date and end_date:
|
| 34 |
+
if start_date > end_date:
|
| 35 |
+
self.add_error('start_date', forms.ValidationError(_("The start date must be before or on the end date.")))
|
| 36 |
+
|
| 37 |
+
@classmethod
|
| 38 |
+
def get_formset_factory(cls):
|
| 39 |
+
return inlineformset_factory(
|
| 40 |
+
Poll,
|
| 41 |
+
Choice,
|
| 42 |
+
form=ChoiceForm,
|
| 43 |
+
extra=1,
|
| 44 |
+
can_delete=True,
|
| 45 |
+
min_num=2,
|
| 46 |
+
validate_min=True,
|
| 47 |
+
formset=AtLeastNFormSet,
|
| 48 |
+
)
|
| 49 |
+
|
| 50 |
+
def clean_vote_groups(self):
|
| 51 |
+
groups = self.cleaned_data['vote_groups']
|
| 52 |
+
for group in groups:
|
| 53 |
+
if group.name == settings.ANONYMOUS_GROUP_NAME or group.name == settings.UNIVERSITY_GROUP_NAME:
|
| 54 |
+
raise ValidationError(_("Anonymous and university network groups are not allowed to vote!"))
|
| 55 |
+
return groups
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
Poll.Form = PollForm
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
class ChoiceForm(forms.ModelForm):
|
| 62 |
+
class Meta:
|
| 63 |
+
model = Choice
|
| 64 |
+
exclude = ["poll", "votes"]
|
| 65 |
+
widgets = {
|
| 66 |
+
"description": forms.TextInput(),
|
| 67 |
+
"index": forms.HiddenInput(),
|
| 68 |
+
}
|
1327-master/_1327/polls/tests.py
ADDED
|
@@ -0,0 +1,716 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import datetime
|
| 2 |
+
|
| 3 |
+
from django.contrib.auth.models import Group
|
| 4 |
+
from django.db import transaction
|
| 5 |
+
from django.template.defaultfilters import floatformat
|
| 6 |
+
from django.test import TestCase
|
| 7 |
+
from django.urls import reverse
|
| 8 |
+
from django_webtest import WebTest
|
| 9 |
+
from guardian.shortcuts import assign_perm, get_perms
|
| 10 |
+
from model_mommy import mommy
|
| 11 |
+
from reversion import revisions
|
| 12 |
+
from reversion.models import Version
|
| 13 |
+
|
| 14 |
+
from _1327.polls.models import Choice, Poll
|
| 15 |
+
from _1327.user_management.models import UserProfile
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class PollModelTests(TestCase):
|
| 19 |
+
|
| 20 |
+
def test_percentage(self):
|
| 21 |
+
num_votes = 10
|
| 22 |
+
num_choices = 3
|
| 23 |
+
num_participants = 5
|
| 24 |
+
|
| 25 |
+
user = mommy.make(UserProfile, _quantity=num_participants)
|
| 26 |
+
poll = mommy.make(Poll, participants=user)
|
| 27 |
+
|
| 28 |
+
mommy.make(Choice, poll=poll, _quantity=num_choices, votes=num_votes)
|
| 29 |
+
|
| 30 |
+
expected_percentage = num_votes * 100 / num_participants
|
| 31 |
+
for choice in poll.choices.all():
|
| 32 |
+
self.assertAlmostEqual(choice.percentage(), expected_percentage, 2)
|
| 33 |
+
|
| 34 |
+
def test_percentage_with_no_participants(self):
|
| 35 |
+
poll = mommy.make(Poll)
|
| 36 |
+
|
| 37 |
+
num_choices = 3
|
| 38 |
+
mommy.make(Choice, poll=poll, _quantity=num_choices, votes=0)
|
| 39 |
+
|
| 40 |
+
expected_percentage = 0
|
| 41 |
+
for choice in poll.choices.all():
|
| 42 |
+
self.assertAlmostEqual(choice.percentage(), expected_percentage, 2)
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
class PollViewTests(WebTest):
|
| 46 |
+
csrf_checks = False
|
| 47 |
+
|
| 48 |
+
@classmethod
|
| 49 |
+
def setUpTestData(cls):
|
| 50 |
+
cls.user = mommy.make(UserProfile, is_superuser=True)
|
| 51 |
+
cls.poll = mommy.make(
|
| 52 |
+
Poll,
|
| 53 |
+
start_date=datetime.date.today(),
|
| 54 |
+
end_date=datetime.date.today() + datetime.timedelta(days=3),
|
| 55 |
+
)
|
| 56 |
+
mommy.make(
|
| 57 |
+
Choice,
|
| 58 |
+
poll=cls.poll,
|
| 59 |
+
_quantity=3,
|
| 60 |
+
)
|
| 61 |
+
cls.group = mommy.make(Group)
|
| 62 |
+
cls.poll.set_all_permissions(cls.group)
|
| 63 |
+
cls.user.groups.add(cls.group)
|
| 64 |
+
assign_perm("polls.add_poll", cls.group)
|
| 65 |
+
|
| 66 |
+
def test_view_all_running_poll_with_insufficient_permissions(self):
|
| 67 |
+
response = self.app.get(reverse('polls:index'))
|
| 68 |
+
self.assertEqual(response.status_code, 200)
|
| 69 |
+
self.assertIn(b"There are no polls you can vote for.", response.body)
|
| 70 |
+
self.assertIn(b"There are no results you can see.", response.body)
|
| 71 |
+
|
| 72 |
+
def test_view_all_running_poll_with_sufficient_permissions(self):
|
| 73 |
+
response = self.app.get(reverse('polls:index'), user=self.user)
|
| 74 |
+
self.assertEqual(response.status_code, 200)
|
| 75 |
+
self.assertIn(self.poll.title.encode('utf-8'), response.body)
|
| 76 |
+
self.assertIn(b"There are no results you can see.", response.body)
|
| 77 |
+
|
| 78 |
+
def test_view_all_running_and_not_running(self):
|
| 79 |
+
finished_poll = mommy.make(
|
| 80 |
+
Poll,
|
| 81 |
+
start_date=datetime.date.today() - datetime.timedelta(days=10),
|
| 82 |
+
end_date=datetime.date.today() - datetime.timedelta(days=1),
|
| 83 |
+
)
|
| 84 |
+
|
| 85 |
+
response = self.app.get(reverse('polls:index'), user=self.user)
|
| 86 |
+
self.assertEqual(response.status_code, 200)
|
| 87 |
+
self.assertIn(self.poll.title.encode('utf-8'), response.body)
|
| 88 |
+
self.assertIn(finished_poll.title.encode('utf-8'), response.body)
|
| 89 |
+
|
| 90 |
+
def test_view_all_already_participated(self):
|
| 91 |
+
self.poll.participants.add(self.user)
|
| 92 |
+
self.poll.save()
|
| 93 |
+
|
| 94 |
+
response = self.app.get(reverse('polls:index'), user=self.user)
|
| 95 |
+
self.assertEqual(response.status_code, 200)
|
| 96 |
+
self.assertIn(b"There are no polls you can vote for.", response.body)
|
| 97 |
+
self.assertIn(self.poll.title.encode('utf-8'), response.body)
|
| 98 |
+
|
| 99 |
+
def test_view_all_future_poll(self):
|
| 100 |
+
self.poll.start_date += datetime.timedelta(days=1)
|
| 101 |
+
self.poll.save()
|
| 102 |
+
|
| 103 |
+
response = self.app.get(reverse('polls:index'))
|
| 104 |
+
self.assertEqual(response.status_code, 200)
|
| 105 |
+
self.assertIn(b"There are no polls you can vote for.", response.body)
|
| 106 |
+
self.assertIn(b"There are no results you can see.", response.body)
|
| 107 |
+
|
| 108 |
+
response = self.app.get(reverse('polls:index'), user=self.user)
|
| 109 |
+
self.assertEqual(response.status_code, 200)
|
| 110 |
+
self.assertIn(b"Upcoming polls", response.body)
|
| 111 |
+
self.assertIn(b"There are no polls you can vote for.", response.body)
|
| 112 |
+
self.assertIn(b"There are no results you can see.", response.body)
|
| 113 |
+
|
| 114 |
+
def test_create_poll(self):
|
| 115 |
+
response = self.app.get(reverse('documents:create', args=['poll']), user=self.user)
|
| 116 |
+
self.assertEqual(response.status_code, 200)
|
| 117 |
+
|
| 118 |
+
form = response.forms['document-form']
|
| 119 |
+
form['choices-0-description'] = 'test description'
|
| 120 |
+
form['choices-0-index'] = 0
|
| 121 |
+
form['choices-0-text'] = 'test choice'
|
| 122 |
+
form['choices-1-description'] = 'test description 2'
|
| 123 |
+
form['choices-1-index'] = 1
|
| 124 |
+
form['choices-1-text'] = 'test choice 2'
|
| 125 |
+
form['title'] = 'TestPoll'
|
| 126 |
+
form['text'] = 'Sample Text'
|
| 127 |
+
form['max_allowed_number_of_answers'] = 1
|
| 128 |
+
form['start_date'] = '2016-01-01'
|
| 129 |
+
form['end_date'] = '2088-01-01'
|
| 130 |
+
form['comment'] = 'sample comment'
|
| 131 |
+
form['group'] = self.group.pk
|
| 132 |
+
|
| 133 |
+
self.assertFalse("Hidden" in str(form.fields['vote_groups'][0]))
|
| 134 |
+
|
| 135 |
+
response = form.submit()
|
| 136 |
+
self.assertEqual(response.status_code, 302)
|
| 137 |
+
|
| 138 |
+
poll = Poll.objects.get(title='TestPoll')
|
| 139 |
+
self.assertEqual(poll.choices.count(), 2)
|
| 140 |
+
|
| 141 |
+
def test_group_field_hidden_when_user_has_one_group(self):
|
| 142 |
+
response = self.app.get(reverse('documents:create', args=['poll']), user=self.user)
|
| 143 |
+
self.assertEqual(response.status_code, 200)
|
| 144 |
+
|
| 145 |
+
form = response.forms['document-form']
|
| 146 |
+
self.assertTrue("Hidden" in str(form.fields['group'][0]))
|
| 147 |
+
|
| 148 |
+
def test_group_field_not_hidden_when_user_has_multiple_groups(self):
|
| 149 |
+
other_group = mommy.make(Group)
|
| 150 |
+
self.user.groups.add(other_group)
|
| 151 |
+
assign_perm("polls.add_poll", other_group)
|
| 152 |
+
response = self.app.get(reverse('documents:create', args=['poll']), user=self.user)
|
| 153 |
+
self.assertEqual(response.status_code, 200)
|
| 154 |
+
|
| 155 |
+
form = response.forms['document-form']
|
| 156 |
+
self.assertFalse("Hidden" in str(form.fields['group'][0]))
|
| 157 |
+
|
| 158 |
+
def test_create_poll_with_permissions(self):
|
| 159 |
+
response = self.app.get(reverse('documents:create', args=['poll']), user=self.user)
|
| 160 |
+
self.assertEqual(response.status_code, 200)
|
| 161 |
+
|
| 162 |
+
form = response.forms['document-form']
|
| 163 |
+
form['choices-0-description'] = 'test description'
|
| 164 |
+
form['choices-0-index'] = 0
|
| 165 |
+
form['choices-0-text'] = 'test choice'
|
| 166 |
+
form['choices-1-description'] = 'test description 2'
|
| 167 |
+
form['choices-1-index'] = 1
|
| 168 |
+
form['choices-1-text'] = 'test choice 2'
|
| 169 |
+
form['title'] = 'TestPoll'
|
| 170 |
+
form['text'] = 'Sample Text'
|
| 171 |
+
form['max_allowed_number_of_answers'] = 1
|
| 172 |
+
form['start_date'] = '2016-01-01'
|
| 173 |
+
form['end_date'] = '2088-01-01'
|
| 174 |
+
form['comment'] = 'sample comment'
|
| 175 |
+
form['group'] = self.group.pk
|
| 176 |
+
form['vote_groups'] = [self.group.pk]
|
| 177 |
+
|
| 178 |
+
response = form.submit()
|
| 179 |
+
self.assertEqual(response.status_code, 302)
|
| 180 |
+
|
| 181 |
+
poll = Poll.objects.get(title='TestPoll')
|
| 182 |
+
self.assertEqual(poll.choices.count(), 2)
|
| 183 |
+
group_permissions = ["polls.{}".format(name) for name in get_perms(self.group, poll)]
|
| 184 |
+
self.assertEqual(len(group_permissions), 5)
|
| 185 |
+
self.assertIn(poll.edit_permission_name, group_permissions)
|
| 186 |
+
self.assertIn(poll.vote_permission_name, group_permissions)
|
| 187 |
+
self.assertIn(poll.view_permission_name, group_permissions)
|
| 188 |
+
self.assertIn(poll.delete_permission_name, group_permissions)
|
| 189 |
+
|
| 190 |
+
def test_create_poll_user_has_no_permission(self):
|
| 191 |
+
user = mommy.make(UserProfile)
|
| 192 |
+
|
| 193 |
+
response = self.app.get(reverse('documents:create', args=['poll']), user=user, expect_errors=True)
|
| 194 |
+
self.assertEqual(response.status_code, 403)
|
| 195 |
+
|
| 196 |
+
response = self.app.post(reverse('documents:create', args=['poll']), user=user, expect_errors=True)
|
| 197 |
+
self.assertEqual(response.status_code, 403)
|
| 198 |
+
|
| 199 |
+
def test_edit_poll(self):
|
| 200 |
+
response = self.app.get(reverse(self.poll.get_edit_url_name(), args=[self.poll.url_title]), user=self.user)
|
| 201 |
+
self.assertEqual(response.status_code, 200)
|
| 202 |
+
|
| 203 |
+
choice_text = 'test choice'
|
| 204 |
+
choice_description = 'test description'
|
| 205 |
+
poll_description = 'Description'
|
| 206 |
+
|
| 207 |
+
form = response.forms['document-form']
|
| 208 |
+
form['choices-3-description'] = choice_description
|
| 209 |
+
form['choices-3-index'] = 3
|
| 210 |
+
form['choices-3-text'] = choice_text
|
| 211 |
+
form['choices-0-text'] = choice_text
|
| 212 |
+
form['text'] = poll_description
|
| 213 |
+
form['comment'] = 'sample comment'
|
| 214 |
+
|
| 215 |
+
self.assertTrue("Hidden" in str(form.fields['vote_groups'][0]))
|
| 216 |
+
|
| 217 |
+
response = form.submit()
|
| 218 |
+
self.assertEqual(response.status_code, 302)
|
| 219 |
+
|
| 220 |
+
poll = Poll.objects.get(id=self.poll.id)
|
| 221 |
+
self.assertEqual(poll.text, poll_description)
|
| 222 |
+
self.assertEqual(poll.choices.count(), 4)
|
| 223 |
+
self.assertEqual(poll.choices.first().text, choice_text)
|
| 224 |
+
self.assertEqual(poll.choices.last().text, choice_text)
|
| 225 |
+
self.assertEqual(poll.choices.last().description, choice_description)
|
| 226 |
+
|
| 227 |
+
def test_edit_poll_delete_choice(self):
|
| 228 |
+
response = self.app.get(reverse(self.poll.get_edit_url_name(), args=[self.poll.url_title]), user=self.user)
|
| 229 |
+
self.assertEqual(response.status_code, 200)
|
| 230 |
+
|
| 231 |
+
form = response.forms['document-form']
|
| 232 |
+
form['choices-0-DELETE'] = True
|
| 233 |
+
form['comment'] = 'sample comment'
|
| 234 |
+
|
| 235 |
+
response = form.submit()
|
| 236 |
+
self.assertEqual(response.status_code, 302)
|
| 237 |
+
|
| 238 |
+
poll = Poll.objects.get(id=self.poll.id)
|
| 239 |
+
self.assertEqual(poll.choices.count(), 2)
|
| 240 |
+
|
| 241 |
+
def test_edit_poll_user_has_no_permission(self):
|
| 242 |
+
user = mommy.make(UserProfile)
|
| 243 |
+
|
| 244 |
+
response = self.app.get(reverse(self.poll.get_edit_url_name(), args=[self.poll.url_title]), user=user, expect_errors=True)
|
| 245 |
+
self.assertEqual(response.status_code, 403)
|
| 246 |
+
|
| 247 |
+
response = self.app.post(reverse(self.poll.get_edit_url_name(), args=[self.poll.url_title]), user=user, expect_errors=True)
|
| 248 |
+
self.assertEqual(response.status_code, 403)
|
| 249 |
+
|
| 250 |
+
def test_deletion_no_superuser(self):
|
| 251 |
+
user = mommy.make(UserProfile)
|
| 252 |
+
assign_perm(self.poll.edit_permission_name, user, self.poll)
|
| 253 |
+
|
| 254 |
+
response = self.app.get(reverse('documents:get_delete_cascade', args=[self.poll.url_title]), user=user)
|
| 255 |
+
self.assertIn(self.poll.title, response.body.decode('utf-8'))
|
| 256 |
+
|
| 257 |
+
response = self.app.get(reverse('documents:delete_document', args=[self.poll.url_title]), user=user)
|
| 258 |
+
self.assertEqual(response.status_code, 200)
|
| 259 |
+
self.assertEqual(Poll.objects.count(), 0)
|
| 260 |
+
|
| 261 |
+
def test_no_description_column_if_no_description(self):
|
| 262 |
+
response = self.app.get(reverse(self.poll.get_view_url_name(), args=[self.poll.url_title]), user=self.user)
|
| 263 |
+
self.assertNotIn("Description", response.body.decode('utf-8'))
|
| 264 |
+
choice = self.poll.choices.first()
|
| 265 |
+
choice.description = "test"
|
| 266 |
+
choice.save()
|
| 267 |
+
response = self.app.get(reverse(self.poll.get_view_url_name(), args=[self.poll.url_title]), user=self.user)
|
| 268 |
+
self.assertIn("Description", response.body.decode('utf-8'))
|
| 269 |
+
|
| 270 |
+
|
| 271 |
+
class PollResultTests(WebTest):
|
| 272 |
+
csrf_checks = False
|
| 273 |
+
|
| 274 |
+
@classmethod
|
| 275 |
+
def setUpTestData(cls):
|
| 276 |
+
cls.user = mommy.make(UserProfile)
|
| 277 |
+
cls.poll = mommy.make(
|
| 278 |
+
Poll,
|
| 279 |
+
start_date=datetime.date.today(),
|
| 280 |
+
end_date=datetime.date.today() + datetime.timedelta(days=3),
|
| 281 |
+
)
|
| 282 |
+
mommy.make(
|
| 283 |
+
Choice,
|
| 284 |
+
poll=cls.poll,
|
| 285 |
+
votes=10,
|
| 286 |
+
_quantity=3,
|
| 287 |
+
)
|
| 288 |
+
|
| 289 |
+
def setUp(self):
|
| 290 |
+
self.user.refresh_from_db()
|
| 291 |
+
self.poll.refresh_from_db()
|
| 292 |
+
|
| 293 |
+
def assign_vote_perm(self, user, obj):
|
| 294 |
+
assign_perm('polls.{vote}'.format(vote=Poll.VOTE_PERMISSION_NAME), user, obj)
|
| 295 |
+
user.save()
|
| 296 |
+
|
| 297 |
+
def assign_view_perm(self, user, obj):
|
| 298 |
+
assign_perm('polls.{view}'.format(view=Poll.VIEW_PERMISSION_NAME), user, obj)
|
| 299 |
+
user.save()
|
| 300 |
+
|
| 301 |
+
def assign_view_vote_perms(self, user, obj):
|
| 302 |
+
self.assign_view_perm(user, obj)
|
| 303 |
+
self.assign_vote_perm(user, obj)
|
| 304 |
+
|
| 305 |
+
def test_view_with_insufficient_permissions(self):
|
| 306 |
+
response = self.app.get(
|
| 307 |
+
reverse(self.poll.get_view_url_name(), args=[self.poll.url_title]),
|
| 308 |
+
expect_errors=True,
|
| 309 |
+
user=self.user,
|
| 310 |
+
)
|
| 311 |
+
self.assertEqual(response.status_code, 403)
|
| 312 |
+
|
| 313 |
+
def test_view_result_without_vote(self):
|
| 314 |
+
self.assign_view_vote_perms(self.user, self.poll)
|
| 315 |
+
response = self.app.get(reverse(self.poll.get_view_url_name(), args=[self.poll.url_title]), user=self.user)
|
| 316 |
+
self.assertTemplateUsed(response, 'polls_vote.html')
|
| 317 |
+
|
| 318 |
+
def test_view_after_vote(self):
|
| 319 |
+
self.assign_view_vote_perms(self.user, self.poll)
|
| 320 |
+
self.poll.participants.add(self.user)
|
| 321 |
+
|
| 322 |
+
response = self.app.get(reverse(self.poll.get_view_url_name(), args=[self.poll.url_title]), user=self.user)
|
| 323 |
+
self.assertEqual(response.status_code, 200)
|
| 324 |
+
self.assertTemplateUsed(response, 'polls_results.html')
|
| 325 |
+
|
| 326 |
+
for choice in self.poll.choices.all():
|
| 327 |
+
self.assertIn(choice.text.encode('utf-8'), response.body)
|
| 328 |
+
self.assertIn(floatformat(choice.percentage()).encode('utf-8'), response.body)
|
| 329 |
+
self.assertIn(str(choice.votes).encode('utf-8'), response.body)
|
| 330 |
+
|
| 331 |
+
def test_view_with_description_of_poll(self):
|
| 332 |
+
self.assign_view_vote_perms(self.user, self.poll)
|
| 333 |
+
self.poll.text = b"a nice description"
|
| 334 |
+
self.poll.participants.add(self.user)
|
| 335 |
+
self.poll.save()
|
| 336 |
+
|
| 337 |
+
response = self.app.get(reverse(self.poll.get_view_url_name(), args=[self.poll.url_title]), user=self.user)
|
| 338 |
+
self.assertEqual(response.status_code, 200)
|
| 339 |
+
self.assertIn(self.poll.text, response.body)
|
| 340 |
+
|
| 341 |
+
def test_view_before_poll_has_started(self):
|
| 342 |
+
self.assign_view_vote_perms(self.user, self.poll)
|
| 343 |
+
self.poll.start_date += datetime.timedelta(weeks=1)
|
| 344 |
+
self.poll.save()
|
| 345 |
+
|
| 346 |
+
response = self.app.get(reverse(self.poll.get_view_url_name(), args=[self.poll.url_title]), user=self.user)
|
| 347 |
+
self.assertEqual(response.status_code, 200)
|
| 348 |
+
self.assertTemplateUsed(response, 'polls_index.html')
|
| 349 |
+
|
| 350 |
+
def test_view_poll_without_vote_permission(self):
|
| 351 |
+
self.assign_view_perm(self.user, self.poll)
|
| 352 |
+
|
| 353 |
+
response = self.app.get(reverse(self.poll.get_view_url_name(), args=[self.poll.url_title]), user=self.user, expect_errors=True)
|
| 354 |
+
self.assertEqual(response.status_code, 200)
|
| 355 |
+
self.assertTemplateUsed(response, 'polls_results.html')
|
| 356 |
+
|
| 357 |
+
def test_vote_poll_without_vote_permission(self):
|
| 358 |
+
self.assign_view_perm(self.user, self.poll)
|
| 359 |
+
|
| 360 |
+
response = self.app.get(reverse(self.poll.get_view_url_name(), args=[self.poll.url_title]), user=self.user, expect_errors=True)
|
| 361 |
+
self.assertEqual(response.status_code, 200)
|
| 362 |
+
self.assertTemplateUsed(response, 'polls_results.html')
|
| 363 |
+
|
| 364 |
+
|
| 365 |
+
class PollVoteTests(WebTest):
|
| 366 |
+
csrf_checks = False
|
| 367 |
+
|
| 368 |
+
@classmethod
|
| 369 |
+
def setUpTestData(cls):
|
| 370 |
+
cls.user = mommy.make(UserProfile, is_superuser=True)
|
| 371 |
+
cls.poll = mommy.make(
|
| 372 |
+
Poll,
|
| 373 |
+
start_date=datetime.date.today(),
|
| 374 |
+
end_date=datetime.date.today() + datetime.timedelta(days=3),
|
| 375 |
+
)
|
| 376 |
+
mommy.make(
|
| 377 |
+
Choice,
|
| 378 |
+
poll=cls.poll,
|
| 379 |
+
votes=10,
|
| 380 |
+
_quantity=3,
|
| 381 |
+
)
|
| 382 |
+
|
| 383 |
+
def setUp(self):
|
| 384 |
+
self.user.refresh_from_db()
|
| 385 |
+
self.poll.refresh_from_db()
|
| 386 |
+
|
| 387 |
+
def test_vote_with_insufficient_permissions(self):
|
| 388 |
+
user_without_perms = mommy.make(UserProfile)
|
| 389 |
+
response = self.app.get(
|
| 390 |
+
reverse(self.poll.get_view_url_name(), args=[self.poll.url_title]),
|
| 391 |
+
expect_errors=True,
|
| 392 |
+
user=user_without_perms,
|
| 393 |
+
)
|
| 394 |
+
self.assertEqual(response.status_code, 403)
|
| 395 |
+
|
| 396 |
+
user = mommy.make(UserProfile)
|
| 397 |
+
assign_perm(Poll.VIEW_PERMISSION_NAME, user, self.poll)
|
| 398 |
+
|
| 399 |
+
response = self.app.get(reverse(self.poll.get_view_url_name(), args=[self.poll.url_title]), user=user, expect_errors=True)
|
| 400 |
+
self.assertEqual(response.status_code, 200)
|
| 401 |
+
self.assertTemplateUsed(response, 'polls_results.html')
|
| 402 |
+
|
| 403 |
+
def test_vote_with_sufficient_permissions(self):
|
| 404 |
+
response = self.app.get(reverse(self.poll.get_view_url_name(), args=[self.poll.url_title]), user=self.user)
|
| 405 |
+
self.assertEqual(response.status_code, 200)
|
| 406 |
+
|
| 407 |
+
user = mommy.make(UserProfile)
|
| 408 |
+
assign_perm(Poll.VIEW_PERMISSION_NAME, user, self.poll)
|
| 409 |
+
assign_perm('vote_poll', user, self.poll)
|
| 410 |
+
user.save()
|
| 411 |
+
response = self.app.get(reverse(self.poll.get_view_url_name(), args=[self.poll.url_title]), user=user)
|
| 412 |
+
self.assertEqual(response.status_code, 200)
|
| 413 |
+
self.assertTemplateUsed(response, 'polls_vote.html')
|
| 414 |
+
|
| 415 |
+
def test_vote_poll_finished(self):
|
| 416 |
+
self.poll.end_date = datetime.date.today() - datetime.timedelta(days=1)
|
| 417 |
+
self.poll.save()
|
| 418 |
+
|
| 419 |
+
response = self.app.get(reverse(self.poll.get_view_url_name(), args=[self.poll.url_title]), user=self.user)
|
| 420 |
+
self.assertTemplateUsed(response, 'polls_results.html')
|
| 421 |
+
|
| 422 |
+
def test_vote_poll_already_voted(self):
|
| 423 |
+
self.poll.participants.add(self.user)
|
| 424 |
+
self.poll.save()
|
| 425 |
+
|
| 426 |
+
response = self.app.get(reverse(self.poll.get_view_url_name(), args=[self.poll.url_title]), user=self.user)
|
| 427 |
+
self.assertTemplateUsed(response, 'polls_results.html')
|
| 428 |
+
response = self.app.post(reverse(self.poll.get_view_url_name(), args=[self.poll.url_title]), user=self.user)
|
| 429 |
+
self.assertTemplateUsed(response, 'polls_results.html')
|
| 430 |
+
|
| 431 |
+
def test_start_vote_multiple_choice_poll(self):
|
| 432 |
+
self.poll.max_allowed_number_of_answers = 2
|
| 433 |
+
self.poll.save()
|
| 434 |
+
|
| 435 |
+
response = self.app.get(reverse(self.poll.get_view_url_name(), args=[self.poll.url_title]) + '/', user=self.user)
|
| 436 |
+
self.assertEqual(response.status_code, 301)
|
| 437 |
+
|
| 438 |
+
response = self.app.get(reverse(self.poll.get_view_url_name(), args=[self.poll.url_title]), user=self.user)
|
| 439 |
+
self.assertEqual(response.status_code, 200)
|
| 440 |
+
self.assertIn(b"checkbox", response.body)
|
| 441 |
+
self.assertNotIn(b"radio", response.body)
|
| 442 |
+
|
| 443 |
+
def test_start_vote_single_choice_poll(self):
|
| 444 |
+
self.poll.max_allowed_number_of_answers = 1
|
| 445 |
+
self.poll.save()
|
| 446 |
+
|
| 447 |
+
response = self.app.get(reverse(self.poll.get_view_url_name(), args=[self.poll.url_title]), user=self.user)
|
| 448 |
+
self.assertEqual(response.status_code, 200)
|
| 449 |
+
self.assertIn(b"radio", response.body)
|
| 450 |
+
self.assertNotIn(b"checkbox", response.body)
|
| 451 |
+
|
| 452 |
+
def test_choices_in_response(self):
|
| 453 |
+
response = self.app.get(reverse(self.poll.get_view_url_name(), args=[self.poll.url_title]), user=self.user)
|
| 454 |
+
self.assertEqual(response.status_code, 200)
|
| 455 |
+
for choice in self.poll.choices.all():
|
| 456 |
+
self.assertIn(choice.text.encode('utf-8'), response.body)
|
| 457 |
+
|
| 458 |
+
def test_vote_without_submitting_a_choice(self):
|
| 459 |
+
response = self.app.post(reverse(self.poll.get_view_url_name(), args=[self.poll.url_title]), user=self.user)
|
| 460 |
+
self.assertRedirects(response, reverse(self.poll.get_view_url_name(), args=[self.poll.url_title]))
|
| 461 |
+
|
| 462 |
+
def test_vote_single_choice_submitting_more_than_one_choice(self):
|
| 463 |
+
self.poll.max_allowed_number_of_answers = 1
|
| 464 |
+
self.poll.save()
|
| 465 |
+
|
| 466 |
+
data = [('choice', choice.id) for choice in self.poll.choices.all()]
|
| 467 |
+
|
| 468 |
+
response = self.app.post(reverse(self.poll.get_view_url_name(), args=[self.poll.url_title]), params=data, user=self.user)
|
| 469 |
+
self.assertRedirects(response, reverse(self.poll.get_view_url_name(), args=[self.poll.url_title]))
|
| 470 |
+
|
| 471 |
+
def test_vote_single_choice_correctly(self):
|
| 472 |
+
self.poll.max_allowed_number_of_answers = 1
|
| 473 |
+
self.poll.save()
|
| 474 |
+
|
| 475 |
+
choice = self.poll.choices.first()
|
| 476 |
+
data = [('choice', choice.id)]
|
| 477 |
+
votes = choice.votes
|
| 478 |
+
|
| 479 |
+
response = self.app.post(reverse(self.poll.get_view_url_name(), args=[self.poll.url_title]), params=data, user=self.user)
|
| 480 |
+
self.assertEqual(response.status_code, 302)
|
| 481 |
+
|
| 482 |
+
choice = self.poll.choices.first()
|
| 483 |
+
self.assertEqual(choice.votes, votes + 1)
|
| 484 |
+
self.assertEqual(self.poll.participants.count(), 1)
|
| 485 |
+
|
| 486 |
+
response = response.follow()
|
| 487 |
+
self.assertTemplateUsed(response, 'polls_results.html')
|
| 488 |
+
|
| 489 |
+
def test_vote_multiple_choice_correctly(self):
|
| 490 |
+
self.poll.max_allowed_number_of_answers = self.poll.choices.count()
|
| 491 |
+
self.poll.save()
|
| 492 |
+
data = []
|
| 493 |
+
votes = []
|
| 494 |
+
for choice in self.poll.choices.all():
|
| 495 |
+
data.append(('choice', choice.id))
|
| 496 |
+
votes.append(choice.votes)
|
| 497 |
+
|
| 498 |
+
response = self.app.post(reverse(self.poll.get_view_url_name(), args=[self.poll.url_title]), params=data, user=self.user)
|
| 499 |
+
self.assertEqual(response.status_code, 302)
|
| 500 |
+
for i, choice in enumerate(self.poll.choices.all()):
|
| 501 |
+
self.assertEqual(choice.votes, votes[i] + 1)
|
| 502 |
+
|
| 503 |
+
self.assertEqual(self.poll.participants.count(), 1)
|
| 504 |
+
response = response.follow()
|
| 505 |
+
self.assertTemplateUsed(response, 'polls_results.html')
|
| 506 |
+
|
| 507 |
+
def test_view_before_poll_has_started(self):
|
| 508 |
+
self.poll.start_date += datetime.timedelta(weeks=1)
|
| 509 |
+
self.poll.save()
|
| 510 |
+
|
| 511 |
+
response = self.app.get(reverse(self.poll.get_view_url_name(), args=[self.poll.url_title]), user=self.user)
|
| 512 |
+
self.assertEqual(response.status_code, 200)
|
| 513 |
+
self.assertTemplateUsed(response, 'polls_index.html')
|
| 514 |
+
|
| 515 |
+
def test_view_poll_before_end(self):
|
| 516 |
+
self.poll.participants.add(self.user)
|
| 517 |
+
self.poll.show_results_immediately = True
|
| 518 |
+
self.poll.save()
|
| 519 |
+
|
| 520 |
+
response = self.app.get(reverse(self.poll.get_view_url_name(), args=[self.poll.url_title]), user=self.user)
|
| 521 |
+
self.assertEqual(response.status_code, 200)
|
| 522 |
+
self.assertTemplateUsed(response, 'polls_results.html')
|
| 523 |
+
|
| 524 |
+
self.poll.show_results_immediately = False
|
| 525 |
+
self.poll.save()
|
| 526 |
+
|
| 527 |
+
response = self.app.get(reverse(self.poll.get_view_url_name(), args=[self.poll.url_title]), user=self.user)
|
| 528 |
+
self.assertRedirects(response, reverse('polls:index'))
|
| 529 |
+
|
| 530 |
+
def test_vote_poll_with_results_that_can_not_be_seen_immediately(self):
|
| 531 |
+
self.poll.show_results_immediately = False
|
| 532 |
+
self.poll.save()
|
| 533 |
+
|
| 534 |
+
response = self.app.get(reverse(self.poll.get_view_url_name(), args=[self.poll.url_title]), user=self.user)
|
| 535 |
+
self.assertEqual(response.status_code, 200)
|
| 536 |
+
self.assertTemplateUsed(response, 'polls_vote.html')
|
| 537 |
+
|
| 538 |
+
form = response.form
|
| 539 |
+
form['choice'] = self.poll.choices.first().pk
|
| 540 |
+
|
| 541 |
+
response = form.submit()
|
| 542 |
+
self.assertRedirects(response, reverse('polls:index'))
|
| 543 |
+
|
| 544 |
+
|
| 545 |
+
class PollEditTests(WebTest):
|
| 546 |
+
csrf_checks = False
|
| 547 |
+
|
| 548 |
+
@classmethod
|
| 549 |
+
def setUpTestData(cls):
|
| 550 |
+
cls.user = mommy.make(UserProfile, is_superuser=True)
|
| 551 |
+
cls.poll = mommy.make(
|
| 552 |
+
Poll,
|
| 553 |
+
start_date=datetime.date.today(),
|
| 554 |
+
end_date=datetime.date.today() + datetime.timedelta(days=3),
|
| 555 |
+
)
|
| 556 |
+
mommy.make(
|
| 557 |
+
Choice,
|
| 558 |
+
poll=cls.poll,
|
| 559 |
+
votes=10,
|
| 560 |
+
_quantity=3,
|
| 561 |
+
)
|
| 562 |
+
cls.group = mommy.make(Group)
|
| 563 |
+
cls.poll.set_all_permissions(cls.group)
|
| 564 |
+
cls.user.groups.add(cls.group)
|
| 565 |
+
assign_perm("polls.add_poll", cls.group)
|
| 566 |
+
|
| 567 |
+
def test_create_two_polls_without_changing_url_title(self):
|
| 568 |
+
response = self.app.get(reverse('documents:create', args=['poll']), user=self.user)
|
| 569 |
+
self.assertEqual(response.status_code, 200)
|
| 570 |
+
|
| 571 |
+
form = response.forms['document-form']
|
| 572 |
+
form['title'] = 'new awesome title'
|
| 573 |
+
form['choices-0-text'] = 'test choice'
|
| 574 |
+
form['choices-1-text'] = 'test choice 2'
|
| 575 |
+
form['text'] = 'Description'
|
| 576 |
+
form['comment'] = 'sample comment'
|
| 577 |
+
form['group'] = self.group.pk
|
| 578 |
+
response = form.submit().follow()
|
| 579 |
+
self.assertEqual(response.status_code, 200)
|
| 580 |
+
self.assertEqual(Poll.objects.count(), 2)
|
| 581 |
+
|
| 582 |
+
response = self.app.get(reverse('documents:create', args=['poll']), user=self.user)
|
| 583 |
+
self.assertEqual(response.status_code, 200)
|
| 584 |
+
|
| 585 |
+
def test_submit_with_too_few_forms(self):
|
| 586 |
+
response = self.app.get(reverse(self.poll.get_edit_url_name(), args=[self.poll.url_title]) + '/', user=self.user)
|
| 587 |
+
self.assertEqual(response.status_code, 301)
|
| 588 |
+
|
| 589 |
+
response = self.app.get(reverse(self.poll.get_edit_url_name(), args=[self.poll.url_title]), user=self.user)
|
| 590 |
+
self.assertEqual(response.status_code, 200)
|
| 591 |
+
|
| 592 |
+
form = response.forms['document-form']
|
| 593 |
+
form['comment'] = 'sample comment'
|
| 594 |
+
form['choices-0-DELETE'] = True
|
| 595 |
+
form['choices-1-DELETE'] = True
|
| 596 |
+
form['choices-2-DELETE'] = True
|
| 597 |
+
|
| 598 |
+
response = form.submit()
|
| 599 |
+
self.assertTemplateUsed(response, 'polls_edit.html')
|
| 600 |
+
self.assertEqual(Choice.objects.filter(poll=self.poll).count(), 3)
|
| 601 |
+
|
| 602 |
+
form = response.forms['document-form']
|
| 603 |
+
form['comment'] = 'sample comment'
|
| 604 |
+
form['choices-0-DELETE'] = True
|
| 605 |
+
form['choices-1-DELETE'] = True
|
| 606 |
+
form['choices-2-DELETE'] = False
|
| 607 |
+
|
| 608 |
+
response = form.submit()
|
| 609 |
+
self.assertTemplateUsed(response, 'polls_edit.html')
|
| 610 |
+
self.assertEqual(Choice.objects.filter(poll=self.poll).count(), 3)
|
| 611 |
+
|
| 612 |
+
def test_submit_with_sufficient_forms(self):
|
| 613 |
+
response = self.app.get(reverse(self.poll.get_edit_url_name(), args=[self.poll.url_title]), user=self.user)
|
| 614 |
+
|
| 615 |
+
form = response.forms['document-form']
|
| 616 |
+
form['comment'] = 'sample comment'
|
| 617 |
+
form['choices-0-DELETE'] = True
|
| 618 |
+
form['choices-1-DELETE'] = False
|
| 619 |
+
form['choices-2-DELETE'] = False
|
| 620 |
+
|
| 621 |
+
form.submit()
|
| 622 |
+
self.assertEqual(Choice.objects.filter(poll=self.poll).count(), 2)
|
| 623 |
+
|
| 624 |
+
def test_submit_more_forms(self):
|
| 625 |
+
response = self.app.get(reverse(self.poll.get_edit_url_name(), args=[self.poll.url_title]), user=self.user)
|
| 626 |
+
|
| 627 |
+
form = response.forms['document-form']
|
| 628 |
+
form['comment'] = 'sample comment'
|
| 629 |
+
form['choices-3-text'] = 'choice 4'
|
| 630 |
+
|
| 631 |
+
form.submit()
|
| 632 |
+
self.assertEqual(Choice.objects.filter(poll=self.poll).count(), 4)
|
| 633 |
+
|
| 634 |
+
|
| 635 |
+
class PollRevertionTests(WebTest):
|
| 636 |
+
csrf_checks = False
|
| 637 |
+
extra_environ = {'HTTP_ACCEPT_LANGUAGE': 'en'}
|
| 638 |
+
|
| 639 |
+
@classmethod
|
| 640 |
+
def setUpTestData(cls):
|
| 641 |
+
cls.user = mommy.make(UserProfile, is_superuser=True)
|
| 642 |
+
|
| 643 |
+
cls.poll = mommy.prepare(Poll, text='text', start_date=datetime.date.today(), end_date=datetime.date.today())
|
| 644 |
+
with transaction.atomic(), revisions.create_revision():
|
| 645 |
+
cls.poll.save()
|
| 646 |
+
revisions.set_user(cls.user)
|
| 647 |
+
revisions.set_comment('test version')
|
| 648 |
+
|
| 649 |
+
cls.poll.text = 'very goood and nice text'
|
| 650 |
+
with transaction.atomic(), revisions.create_revision():
|
| 651 |
+
cls.poll.save()
|
| 652 |
+
revisions.set_user(cls.user)
|
| 653 |
+
revisions.set_comment('change text')
|
| 654 |
+
|
| 655 |
+
def test_revert_poll_no_votes(self):
|
| 656 |
+
poll = Poll.objects.get()
|
| 657 |
+
self.assertTrue(poll.can_be_reverted)
|
| 658 |
+
versions = Version.objects.get_for_object(poll)
|
| 659 |
+
self.assertEqual(len(versions), 2)
|
| 660 |
+
|
| 661 |
+
response = self.app.post(
|
| 662 |
+
reverse('documents:revert') + '/',
|
| 663 |
+
params={'id': versions[1].pk, 'url_title': poll.url_title},
|
| 664 |
+
user=self.user,
|
| 665 |
+
xhr=True
|
| 666 |
+
)
|
| 667 |
+
self.assertEqual(response.status_code, 301)
|
| 668 |
+
|
| 669 |
+
response = self.app.post(
|
| 670 |
+
reverse('documents:revert'),
|
| 671 |
+
params={'id': versions[1].pk, 'url_title': poll.url_title},
|
| 672 |
+
user=self.user,
|
| 673 |
+
xhr=True
|
| 674 |
+
)
|
| 675 |
+
self.assertEqual(response.status_code, 200)
|
| 676 |
+
|
| 677 |
+
versions = Version.objects.get_for_object(poll)
|
| 678 |
+
self.assertEqual(len(versions), 3)
|
| 679 |
+
|
| 680 |
+
response = self.app.get(reverse('versions', args=[poll.url_title]), user=self.user)
|
| 681 |
+
self.assertEqual(response.status_code, 200)
|
| 682 |
+
self.assertNotIn('This Document can not be reverted!', response.body.decode('utf-8'))
|
| 683 |
+
|
| 684 |
+
def test_revert_poll_after_vote(self):
|
| 685 |
+
poll = Poll.objects.get()
|
| 686 |
+
|
| 687 |
+
self.assertTrue(poll.can_be_reverted)
|
| 688 |
+
poll.participants.add(self.user)
|
| 689 |
+
self.assertFalse(poll.can_be_reverted)
|
| 690 |
+
|
| 691 |
+
versions = Version.objects.get_for_object(poll)
|
| 692 |
+
self.assertEqual(len(versions), 2)
|
| 693 |
+
|
| 694 |
+
response = self.app.post(
|
| 695 |
+
reverse('documents:revert') + '/',
|
| 696 |
+
params={'id': versions[1].pk, 'url_title': poll.url_title},
|
| 697 |
+
user=self.user,
|
| 698 |
+
xhr=True
|
| 699 |
+
)
|
| 700 |
+
self.assertEqual(response.status_code, 301)
|
| 701 |
+
|
| 702 |
+
response = self.app.post(
|
| 703 |
+
reverse('documents:revert'),
|
| 704 |
+
params={'id': versions[1].pk, 'url_title': poll.url_title},
|
| 705 |
+
user=self.user,
|
| 706 |
+
xhr=True,
|
| 707 |
+
status=400
|
| 708 |
+
)
|
| 709 |
+
self.assertEqual(response.status_code, 400)
|
| 710 |
+
|
| 711 |
+
new_versions = Version.objects.get_for_object(poll)
|
| 712 |
+
self.assertEqual(len(versions), len(new_versions))
|
| 713 |
+
|
| 714 |
+
response = self.app.get(reverse('versions', args=[poll.url_title]), user=self.user)
|
| 715 |
+
self.assertEqual(response.status_code, 200)
|
| 716 |
+
self.assertIn('This Document can not be reverted!', response.body.decode('utf-8'))
|
1327-master/_1327/shortlinks/tests.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.test import TestCase
|
| 2 |
+
from django_webtest import WebTest
|
| 3 |
+
from guardian.shortcuts import assign_perm
|
| 4 |
+
from model_mommy import mommy
|
| 5 |
+
|
| 6 |
+
from _1327.information_pages.models import InformationDocument
|
| 7 |
+
from _1327.user_management.models import UserProfile
|
| 8 |
+
from .models import Shortlink
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
class TestShortlink(TestCase):
|
| 12 |
+
|
| 13 |
+
def test_slugification(self):
|
| 14 |
+
shortlink = Shortlink(url_title="test", link="https://example.com")
|
| 15 |
+
shortlink.save()
|
| 16 |
+
self.assertEqual(shortlink.url_title, "test")
|
| 17 |
+
|
| 18 |
+
shortlink.url_title = "etc//TEST-testtest/"
|
| 19 |
+
shortlink.save()
|
| 20 |
+
self.assertEqual(shortlink.url_title, "etc/test-testtest")
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
class TestShortlinkWeb(WebTest):
|
| 24 |
+
|
| 25 |
+
@classmethod
|
| 26 |
+
def setUpTestData(cls):
|
| 27 |
+
cls.user = mommy.make(UserProfile)
|
| 28 |
+
cls.document = mommy.make(InformationDocument, text="Internal shortlink example")
|
| 29 |
+
assign_perm(InformationDocument.VIEW_PERMISSION_NAME, cls.user, cls.document)
|
| 30 |
+
|
| 31 |
+
def test_follow_shortlink_external(self):
|
| 32 |
+
url = "https://github.com"
|
| 33 |
+
shortlink = Shortlink(url_title="test", link=url)
|
| 34 |
+
shortlink.save()
|
| 35 |
+
|
| 36 |
+
self.assertEqual(shortlink.visit_count, 0)
|
| 37 |
+
|
| 38 |
+
response = self.app.get("/test", user=self.user)
|
| 39 |
+
self.assertEqual(response.status_code, 302)
|
| 40 |
+
self.assertEqual(response.location, url)
|
| 41 |
+
|
| 42 |
+
shortlink = Shortlink.objects.get(url_title="test")
|
| 43 |
+
self.assertEqual(shortlink.visit_count, 1)
|
| 44 |
+
|
| 45 |
+
def test_follow_shortlink_internal(self):
|
| 46 |
+
shortlink = Shortlink(url_title="test", document=self.document)
|
| 47 |
+
shortlink.save()
|
| 48 |
+
|
| 49 |
+
self.assertEqual(shortlink.visit_count, 0)
|
| 50 |
+
|
| 51 |
+
response = self.app.get("/test", user=self.user)
|
| 52 |
+
self.assertEqual(response.status_code, 302)
|
| 53 |
+
response = response.follow()
|
| 54 |
+
self.assertEqual(response.status_code, 200)
|
| 55 |
+
self.assertIn(self.document.text.encode("utf-8"), response.body)
|
| 56 |
+
|
| 57 |
+
shortlink = Shortlink.objects.get(url_title="test")
|
| 58 |
+
self.assertEqual(shortlink.visit_count, 1)
|
1327-master/_1327/shortlinks/utils.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.template import loader
|
| 2 |
+
from guardian.shortcuts import get_objects_for_user
|
| 3 |
+
|
| 4 |
+
from _1327.information_pages.models import InformationDocument
|
| 5 |
+
from _1327.minutes.models import MinutesDocument
|
| 6 |
+
from _1327.polls.models import Poll
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
def get_document_selection(request):
|
| 10 |
+
minutes = get_objects_for_user(
|
| 11 |
+
request.user,
|
| 12 |
+
MinutesDocument.VIEW_PERMISSION_NAME,
|
| 13 |
+
klass=MinutesDocument.objects.all()
|
| 14 |
+
)
|
| 15 |
+
information_documents = get_objects_for_user(
|
| 16 |
+
request.user,
|
| 17 |
+
InformationDocument.VIEW_PERMISSION_NAME,
|
| 18 |
+
klass=InformationDocument.objects.all()
|
| 19 |
+
)
|
| 20 |
+
polls = get_objects_for_user(
|
| 21 |
+
request.user,
|
| 22 |
+
Poll.VIEW_PERMISSION_NAME,
|
| 23 |
+
klass=Poll.objects.all()
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
template = loader.get_template("search_api.json")
|
| 27 |
+
return template.render(
|
| 28 |
+
{
|
| 29 |
+
'minutes': minutes,
|
| 30 |
+
'information_documents': information_documents,
|
| 31 |
+
'polls': polls,
|
| 32 |
+
'id_only': True,
|
| 33 |
+
},
|
| 34 |
+
request,
|
| 35 |
+
)
|
1327-master/_1327/static/js/jquery.nestable.js
ADDED
|
@@ -0,0 +1,486 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*!
|
| 2 |
+
* Nestable jQuery Plugin - Copyright (c) 2012 David Bushell - http://dbushell.com/
|
| 3 |
+
* Dual-licensed under the BSD or MIT licenses
|
| 4 |
+
*/
|
| 5 |
+
;(function($, window, document, undefined)
|
| 6 |
+
{
|
| 7 |
+
var hasTouch = 'ontouchstart' in document;
|
| 8 |
+
|
| 9 |
+
/**
|
| 10 |
+
* Detect CSS pointer-events property
|
| 11 |
+
* events are normally disabled on the dragging element to avoid conflicts
|
| 12 |
+
* https://github.com/ausi/Feature-detection-technique-for-pointer-events/blob/master/modernizr-pointerevents.js
|
| 13 |
+
*/
|
| 14 |
+
var hasPointerEvents = (function()
|
| 15 |
+
{
|
| 16 |
+
var el = document.createElement('div'),
|
| 17 |
+
docEl = document.documentElement;
|
| 18 |
+
if (!('pointerEvents' in el.style)) {
|
| 19 |
+
return false;
|
| 20 |
+
}
|
| 21 |
+
el.style.pointerEvents = 'auto';
|
| 22 |
+
el.style.pointerEvents = 'x';
|
| 23 |
+
docEl.appendChild(el);
|
| 24 |
+
var supports = window.getComputedStyle && window.getComputedStyle(el, '').pointerEvents === 'auto';
|
| 25 |
+
docEl.removeChild(el);
|
| 26 |
+
return !!supports;
|
| 27 |
+
})();
|
| 28 |
+
|
| 29 |
+
var defaults = {
|
| 30 |
+
listNodeName : 'ol',
|
| 31 |
+
itemNodeName : 'li',
|
| 32 |
+
rootClass : 'dd',
|
| 33 |
+
listClass : 'dd-list',
|
| 34 |
+
itemClass : 'dd-item',
|
| 35 |
+
dragClass : 'dd-dragel',
|
| 36 |
+
handleClass : 'dd-handle',
|
| 37 |
+
collapsedClass : 'dd-collapsed',
|
| 38 |
+
placeClass : 'dd-placeholder',
|
| 39 |
+
noDragClass : 'dd-nodrag',
|
| 40 |
+
emptyClass : 'dd-empty',
|
| 41 |
+
expandBtnHTML : '<button data-action="expand" type="button">Expand</button>',
|
| 42 |
+
collapseBtnHTML : '<button data-action="collapse" type="button">Collapse</button>',
|
| 43 |
+
group : 0,
|
| 44 |
+
maxDepth : 5,
|
| 45 |
+
threshold : 20
|
| 46 |
+
};
|
| 47 |
+
|
| 48 |
+
function Plugin(element, options)
|
| 49 |
+
{
|
| 50 |
+
this.w = $(document);
|
| 51 |
+
this.el = $(element);
|
| 52 |
+
this.options = $.extend({}, defaults, options);
|
| 53 |
+
this.init();
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
Plugin.prototype = {
|
| 57 |
+
|
| 58 |
+
init: function()
|
| 59 |
+
{
|
| 60 |
+
var list = this;
|
| 61 |
+
|
| 62 |
+
list.reset();
|
| 63 |
+
|
| 64 |
+
list.el.data('nestable-group', this.options.group);
|
| 65 |
+
|
| 66 |
+
list.placeEl = $('<div class="' + list.options.placeClass + '"/>');
|
| 67 |
+
|
| 68 |
+
$.each(this.el.find(list.options.itemNodeName), function(k, el) {
|
| 69 |
+
list.setParent($(el));
|
| 70 |
+
});
|
| 71 |
+
|
| 72 |
+
list.el.on('click', 'button', function(e) {
|
| 73 |
+
if (list.dragEl) {
|
| 74 |
+
return;
|
| 75 |
+
}
|
| 76 |
+
var target = $(e.currentTarget),
|
| 77 |
+
action = target.data('action'),
|
| 78 |
+
item = target.parent(list.options.itemNodeName);
|
| 79 |
+
if (action === 'collapse') {
|
| 80 |
+
list.collapseItem(item);
|
| 81 |
+
}
|
| 82 |
+
if (action === 'expand') {
|
| 83 |
+
list.expandItem(item);
|
| 84 |
+
}
|
| 85 |
+
});
|
| 86 |
+
|
| 87 |
+
var onStartEvent = function(e)
|
| 88 |
+
{
|
| 89 |
+
var handle = $(e.target);
|
| 90 |
+
if (!handle.hasClass(list.options.handleClass)) {
|
| 91 |
+
if (handle.closest('.' + list.options.noDragClass).length) {
|
| 92 |
+
return;
|
| 93 |
+
}
|
| 94 |
+
handle = handle.closest('.' + list.options.handleClass);
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
if (!handle.length || list.dragEl) {
|
| 98 |
+
return;
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
list.isTouch = /^touch/.test(e.type);
|
| 102 |
+
if (list.isTouch && e.touches.length !== 1) {
|
| 103 |
+
return;
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
e.preventDefault();
|
| 107 |
+
list.dragStart(e.touches ? e.touches[0] : e);
|
| 108 |
+
};
|
| 109 |
+
|
| 110 |
+
var onMoveEvent = function(e)
|
| 111 |
+
{
|
| 112 |
+
if (list.dragEl) {
|
| 113 |
+
e.preventDefault();
|
| 114 |
+
list.dragMove(e.touches ? e.touches[0] : e);
|
| 115 |
+
}
|
| 116 |
+
};
|
| 117 |
+
|
| 118 |
+
var onEndEvent = function(e)
|
| 119 |
+
{
|
| 120 |
+
if (list.dragEl) {
|
| 121 |
+
e.preventDefault();
|
| 122 |
+
list.dragStop(e.touches ? e.touches[0] : e);
|
| 123 |
+
}
|
| 124 |
+
};
|
| 125 |
+
|
| 126 |
+
if (hasTouch) {
|
| 127 |
+
list.el[0].addEventListener('touchstart', onStartEvent, false);
|
| 128 |
+
window.addEventListener('touchmove', onMoveEvent, false);
|
| 129 |
+
window.addEventListener('touchend', onEndEvent, false);
|
| 130 |
+
window.addEventListener('touchcancel', onEndEvent, false);
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
list.el.on('mousedown', onStartEvent);
|
| 134 |
+
list.w.on('mousemove', onMoveEvent);
|
| 135 |
+
list.w.on('mouseup', onEndEvent);
|
| 136 |
+
|
| 137 |
+
},
|
| 138 |
+
|
| 139 |
+
serialize: function()
|
| 140 |
+
{
|
| 141 |
+
var data,
|
| 142 |
+
depth = 0,
|
| 143 |
+
list = this;
|
| 144 |
+
step = function(level, depth)
|
| 145 |
+
{
|
| 146 |
+
var array = [ ],
|
| 147 |
+
items = level.children(list.options.itemNodeName);
|
| 148 |
+
items.each(function()
|
| 149 |
+
{
|
| 150 |
+
var li = $(this),
|
| 151 |
+
item = $.extend({}, li.data()),
|
| 152 |
+
sub = li.children(list.options.listNodeName);
|
| 153 |
+
if (sub.length) {
|
| 154 |
+
item.children = step(sub, depth + 1);
|
| 155 |
+
}
|
| 156 |
+
array.push(item);
|
| 157 |
+
});
|
| 158 |
+
return array;
|
| 159 |
+
};
|
| 160 |
+
data = step(list.el.find(list.options.listNodeName).first(), depth);
|
| 161 |
+
return data;
|
| 162 |
+
},
|
| 163 |
+
|
| 164 |
+
serialise: function()
|
| 165 |
+
{
|
| 166 |
+
return this.serialize();
|
| 167 |
+
},
|
| 168 |
+
|
| 169 |
+
reset: function()
|
| 170 |
+
{
|
| 171 |
+
this.mouse = {
|
| 172 |
+
offsetX : 0,
|
| 173 |
+
offsetY : 0,
|
| 174 |
+
startX : 0,
|
| 175 |
+
startY : 0,
|
| 176 |
+
lastX : 0,
|
| 177 |
+
lastY : 0,
|
| 178 |
+
nowX : 0,
|
| 179 |
+
nowY : 0,
|
| 180 |
+
distX : 0,
|
| 181 |
+
distY : 0,
|
| 182 |
+
dirAx : 0,
|
| 183 |
+
dirX : 0,
|
| 184 |
+
dirY : 0,
|
| 185 |
+
lastDirX : 0,
|
| 186 |
+
lastDirY : 0,
|
| 187 |
+
distAxX : 0,
|
| 188 |
+
distAxY : 0
|
| 189 |
+
};
|
| 190 |
+
this.isTouch = false;
|
| 191 |
+
this.moving = false;
|
| 192 |
+
this.dragEl = null;
|
| 193 |
+
this.dragRootEl = null;
|
| 194 |
+
this.dragDepth = 0;
|
| 195 |
+
this.hasNewRoot = false;
|
| 196 |
+
this.pointEl = null;
|
| 197 |
+
},
|
| 198 |
+
|
| 199 |
+
expandItem: function(li)
|
| 200 |
+
{
|
| 201 |
+
li.removeClass(this.options.collapsedClass);
|
| 202 |
+
li.children('[data-action="expand"]').hide();
|
| 203 |
+
li.children('[data-action="collapse"]').show();
|
| 204 |
+
li.children(this.options.listNodeName).show();
|
| 205 |
+
},
|
| 206 |
+
|
| 207 |
+
collapseItem: function(li)
|
| 208 |
+
{
|
| 209 |
+
var lists = li.children(this.options.listNodeName);
|
| 210 |
+
if (lists.length) {
|
| 211 |
+
li.addClass(this.options.collapsedClass);
|
| 212 |
+
li.children('[data-action="collapse"]').hide();
|
| 213 |
+
li.children('[data-action="expand"]').show();
|
| 214 |
+
li.children(this.options.listNodeName).hide();
|
| 215 |
+
}
|
| 216 |
+
},
|
| 217 |
+
|
| 218 |
+
expandAll: function()
|
| 219 |
+
{
|
| 220 |
+
var list = this;
|
| 221 |
+
list.el.find(list.options.itemNodeName).each(function() {
|
| 222 |
+
list.expandItem($(this));
|
| 223 |
+
});
|
| 224 |
+
},
|
| 225 |
+
|
| 226 |
+
collapseAll: function()
|
| 227 |
+
{
|
| 228 |
+
var list = this;
|
| 229 |
+
list.el.find(list.options.itemNodeName).each(function() {
|
| 230 |
+
list.collapseItem($(this));
|
| 231 |
+
});
|
| 232 |
+
},
|
| 233 |
+
|
| 234 |
+
setParent: function(li)
|
| 235 |
+
{
|
| 236 |
+
if (li.children(this.options.listNodeName).length) {
|
| 237 |
+
li.prepend($(this.options.expandBtnHTML));
|
| 238 |
+
li.prepend($(this.options.collapseBtnHTML));
|
| 239 |
+
}
|
| 240 |
+
li.children('[data-action="expand"]').hide();
|
| 241 |
+
},
|
| 242 |
+
|
| 243 |
+
unsetParent: function(li)
|
| 244 |
+
{
|
| 245 |
+
li.removeClass(this.options.collapsedClass);
|
| 246 |
+
li.children('[data-action]').remove();
|
| 247 |
+
li.children(this.options.listNodeName).remove();
|
| 248 |
+
},
|
| 249 |
+
|
| 250 |
+
dragStart: function(e)
|
| 251 |
+
{
|
| 252 |
+
var mouse = this.mouse,
|
| 253 |
+
target = $(e.target),
|
| 254 |
+
dragItem = target.closest(this.options.itemNodeName);
|
| 255 |
+
|
| 256 |
+
this.placeEl.css('height', dragItem.height());
|
| 257 |
+
|
| 258 |
+
mouse.offsetX = e.offsetX !== undefined ? e.offsetX : e.pageX - target.offset().left;
|
| 259 |
+
mouse.offsetY = e.offsetY !== undefined ? e.offsetY : e.pageY - target.offset().top;
|
| 260 |
+
mouse.startX = mouse.lastX = e.pageX;
|
| 261 |
+
mouse.startY = mouse.lastY = e.pageY;
|
| 262 |
+
|
| 263 |
+
this.dragRootEl = this.el;
|
| 264 |
+
|
| 265 |
+
this.dragEl = $(document.createElement(this.options.listNodeName)).addClass(this.options.listClass + ' ' + this.options.dragClass);
|
| 266 |
+
this.dragEl.css('width', dragItem.width());
|
| 267 |
+
|
| 268 |
+
dragItem.after(this.placeEl);
|
| 269 |
+
dragItem[0].parentNode.removeChild(dragItem[0]);
|
| 270 |
+
dragItem.appendTo(this.dragEl);
|
| 271 |
+
|
| 272 |
+
$(document.body).append(this.dragEl);
|
| 273 |
+
this.dragEl.css({
|
| 274 |
+
'left' : e.pageX - mouse.offsetX,
|
| 275 |
+
'top' : e.pageY - mouse.offsetY
|
| 276 |
+
});
|
| 277 |
+
// total depth of dragging item
|
| 278 |
+
var i, depth,
|
| 279 |
+
items = this.dragEl.find(this.options.itemNodeName);
|
| 280 |
+
for (i = 0; i < items.length; i++) {
|
| 281 |
+
depth = $(items[i]).parents(this.options.listNodeName).length;
|
| 282 |
+
if (depth > this.dragDepth) {
|
| 283 |
+
this.dragDepth = depth;
|
| 284 |
+
}
|
| 285 |
+
}
|
| 286 |
+
},
|
| 287 |
+
|
| 288 |
+
dragStop: function(e)
|
| 289 |
+
{
|
| 290 |
+
var el = this.dragEl.children(this.options.itemNodeName).first();
|
| 291 |
+
el[0].parentNode.removeChild(el[0]);
|
| 292 |
+
this.placeEl.replaceWith(el);
|
| 293 |
+
|
| 294 |
+
this.dragEl.remove();
|
| 295 |
+
this.el.trigger('change');
|
| 296 |
+
if (this.hasNewRoot) {
|
| 297 |
+
this.dragRootEl.trigger('change');
|
| 298 |
+
}
|
| 299 |
+
this.reset();
|
| 300 |
+
},
|
| 301 |
+
|
| 302 |
+
dragMove: function(e)
|
| 303 |
+
{
|
| 304 |
+
var list, parent, prev, next, depth,
|
| 305 |
+
opt = this.options,
|
| 306 |
+
mouse = this.mouse;
|
| 307 |
+
|
| 308 |
+
this.dragEl.css({
|
| 309 |
+
'left' : e.pageX - mouse.offsetX,
|
| 310 |
+
'top' : e.pageY - mouse.offsetY
|
| 311 |
+
});
|
| 312 |
+
|
| 313 |
+
// mouse position last events
|
| 314 |
+
mouse.lastX = mouse.nowX;
|
| 315 |
+
mouse.lastY = mouse.nowY;
|
| 316 |
+
// mouse position this events
|
| 317 |
+
mouse.nowX = e.pageX;
|
| 318 |
+
mouse.nowY = e.pageY;
|
| 319 |
+
// distance mouse moved between events
|
| 320 |
+
mouse.distX = mouse.nowX - mouse.lastX;
|
| 321 |
+
mouse.distY = mouse.nowY - mouse.lastY;
|
| 322 |
+
// direction mouse was moving
|
| 323 |
+
mouse.lastDirX = mouse.dirX;
|
| 324 |
+
mouse.lastDirY = mouse.dirY;
|
| 325 |
+
// direction mouse is now moving (on both axis)
|
| 326 |
+
mouse.dirX = mouse.distX === 0 ? 0 : mouse.distX > 0 ? 1 : -1;
|
| 327 |
+
mouse.dirY = mouse.distY === 0 ? 0 : mouse.distY > 0 ? 1 : -1;
|
| 328 |
+
// axis mouse is now moving on
|
| 329 |
+
var newAx = Math.abs(mouse.distX) > Math.abs(mouse.distY) ? 1 : 0;
|
| 330 |
+
|
| 331 |
+
// do nothing on first move
|
| 332 |
+
if (!mouse.moving) {
|
| 333 |
+
mouse.dirAx = newAx;
|
| 334 |
+
mouse.moving = true;
|
| 335 |
+
return;
|
| 336 |
+
}
|
| 337 |
+
|
| 338 |
+
// calc distance moved on this axis (and direction)
|
| 339 |
+
if (mouse.dirAx !== newAx) {
|
| 340 |
+
mouse.distAxX = 0;
|
| 341 |
+
mouse.distAxY = 0;
|
| 342 |
+
} else {
|
| 343 |
+
mouse.distAxX += Math.abs(mouse.distX);
|
| 344 |
+
if (mouse.dirX !== 0 && mouse.dirX !== mouse.lastDirX) {
|
| 345 |
+
mouse.distAxX = 0;
|
| 346 |
+
}
|
| 347 |
+
mouse.distAxY += Math.abs(mouse.distY);
|
| 348 |
+
if (mouse.dirY !== 0 && mouse.dirY !== mouse.lastDirY) {
|
| 349 |
+
mouse.distAxY = 0;
|
| 350 |
+
}
|
| 351 |
+
}
|
| 352 |
+
mouse.dirAx = newAx;
|
| 353 |
+
|
| 354 |
+
/**
|
| 355 |
+
* move horizontal
|
| 356 |
+
*/
|
| 357 |
+
if (mouse.dirAx && mouse.distAxX >= opt.threshold) {
|
| 358 |
+
// reset move distance on x-axis for new phase
|
| 359 |
+
mouse.distAxX = 0;
|
| 360 |
+
prev = this.placeEl.prev(opt.itemNodeName);
|
| 361 |
+
// increase horizontal level if previous sibling exists and is not collapsed
|
| 362 |
+
if (mouse.distX > 0 && prev.length && !prev.hasClass(opt.collapsedClass)) {
|
| 363 |
+
// cannot increase level when item above is collapsed
|
| 364 |
+
list = prev.find(opt.listNodeName).last();
|
| 365 |
+
// check if depth limit has reached
|
| 366 |
+
depth = this.placeEl.parents(opt.listNodeName).length;
|
| 367 |
+
var pointElRoot = this.pointEl.closest('.' + opt.rootClass);
|
| 368 |
+
max_depth = pointElRoot.data().nestable.options.maxDepth;
|
| 369 |
+
if (depth + this.dragDepth <= max_depth) {
|
| 370 |
+
// create new sub-level if one doesn't exist
|
| 371 |
+
if (!list.length) {
|
| 372 |
+
list = $('<' + opt.listNodeName + '/>').addClass(opt.listClass);
|
| 373 |
+
list.append(this.placeEl);
|
| 374 |
+
prev.append(list);
|
| 375 |
+
this.setParent(prev);
|
| 376 |
+
} else {
|
| 377 |
+
// else append to next level up
|
| 378 |
+
list = prev.children(opt.listNodeName).last();
|
| 379 |
+
list.append(this.placeEl);
|
| 380 |
+
}
|
| 381 |
+
}
|
| 382 |
+
}
|
| 383 |
+
// decrease horizontal level
|
| 384 |
+
if (mouse.distX < 0) {
|
| 385 |
+
// we can't decrease a level if an item preceeds the current one
|
| 386 |
+
next = this.placeEl.next(opt.itemNodeName);
|
| 387 |
+
if (!next.length) {
|
| 388 |
+
parent = this.placeEl.parent();
|
| 389 |
+
this.placeEl.closest(opt.itemNodeName).after(this.placeEl);
|
| 390 |
+
if (!parent.children().length) {
|
| 391 |
+
this.unsetParent(parent.parent());
|
| 392 |
+
}
|
| 393 |
+
}
|
| 394 |
+
}
|
| 395 |
+
}
|
| 396 |
+
|
| 397 |
+
var isEmpty = false;
|
| 398 |
+
|
| 399 |
+
// find list item under cursor
|
| 400 |
+
if (!hasPointerEvents) {
|
| 401 |
+
this.dragEl[0].style.visibility = 'hidden';
|
| 402 |
+
}
|
| 403 |
+
this.pointEl = $(document.elementFromPoint(e.pageX - document.body.scrollLeft, e.pageY - (window.pageYOffset || document.documentElement.scrollTop)));
|
| 404 |
+
if (!hasPointerEvents) {
|
| 405 |
+
this.dragEl[0].style.visibility = 'visible';
|
| 406 |
+
}
|
| 407 |
+
if (this.pointEl.hasClass(opt.handleClass)) {
|
| 408 |
+
this.pointEl = this.pointEl.parent(opt.itemNodeName);
|
| 409 |
+
}
|
| 410 |
+
if (this.pointEl.hasClass(opt.emptyClass)) {
|
| 411 |
+
isEmpty = true;
|
| 412 |
+
}
|
| 413 |
+
else if (!this.pointEl.length || !this.pointEl.hasClass(opt.itemClass)) {
|
| 414 |
+
return;
|
| 415 |
+
}
|
| 416 |
+
|
| 417 |
+
// find parent list of item under cursor
|
| 418 |
+
var pointElRoot = this.pointEl.closest('.' + opt.rootClass),
|
| 419 |
+
isNewRoot = this.dragRootEl.data('nestable-id') !== pointElRoot.data('nestable-id');
|
| 420 |
+
|
| 421 |
+
/**
|
| 422 |
+
* move vertical
|
| 423 |
+
*/
|
| 424 |
+
if (!mouse.dirAx || isNewRoot || isEmpty) {
|
| 425 |
+
// check if groups match if dragging over new root
|
| 426 |
+
if (isNewRoot && opt.group !== pointElRoot.data('nestable-group')) {
|
| 427 |
+
return;
|
| 428 |
+
}
|
| 429 |
+
// check depth limit
|
| 430 |
+
depth = this.dragDepth - 1 + this.pointEl.parents(opt.listNodeName).length;
|
| 431 |
+
if (depth > opt.maxDepth) {
|
| 432 |
+
return;
|
| 433 |
+
}
|
| 434 |
+
var before = e.pageY < (this.pointEl.offset().top + this.pointEl.height() / 2);
|
| 435 |
+
parent = this.placeEl.parent();
|
| 436 |
+
// if empty create new list to replace empty placeholder
|
| 437 |
+
if (isEmpty) {
|
| 438 |
+
list = $(document.createElement(opt.listNodeName)).addClass(opt.listClass);
|
| 439 |
+
list.append(this.placeEl);
|
| 440 |
+
this.pointEl.replaceWith(list);
|
| 441 |
+
}
|
| 442 |
+
else if (before) {
|
| 443 |
+
this.pointEl.before(this.placeEl);
|
| 444 |
+
}
|
| 445 |
+
else {
|
| 446 |
+
this.pointEl.after(this.placeEl);
|
| 447 |
+
}
|
| 448 |
+
if (!parent.children().length) {
|
| 449 |
+
this.unsetParent(parent.parent());
|
| 450 |
+
}
|
| 451 |
+
if (!this.dragRootEl.find(opt.itemNodeName).length && !this.dragRootEl.find('.' + opt.emptyClass).length) {
|
| 452 |
+
this.dragRootEl.append('<div class="' + opt.emptyClass + '"/>');
|
| 453 |
+
}
|
| 454 |
+
// parent root list has changed
|
| 455 |
+
if (isNewRoot) {
|
| 456 |
+
this.dragRootEl = pointElRoot;
|
| 457 |
+
this.hasNewRoot = this.el[0] !== this.dragRootEl[0];
|
| 458 |
+
}
|
| 459 |
+
}
|
| 460 |
+
}
|
| 461 |
+
|
| 462 |
+
};
|
| 463 |
+
|
| 464 |
+
$.fn.nestable = function(params)
|
| 465 |
+
{
|
| 466 |
+
var lists = this,
|
| 467 |
+
retval = this;
|
| 468 |
+
|
| 469 |
+
lists.each(function()
|
| 470 |
+
{
|
| 471 |
+
var plugin = $(this).data("nestable");
|
| 472 |
+
|
| 473 |
+
if (!plugin) {
|
| 474 |
+
$(this).data("nestable", new Plugin(this, params));
|
| 475 |
+
$(this).data("nestable-id", new Date().getTime());
|
| 476 |
+
} else {
|
| 477 |
+
if (typeof params === 'string' && typeof plugin[params] === 'function') {
|
| 478 |
+
retval = plugin[params]();
|
| 479 |
+
}
|
| 480 |
+
}
|
| 481 |
+
});
|
| 482 |
+
|
| 483 |
+
return retval || lists;
|
| 484 |
+
};
|
| 485 |
+
|
| 486 |
+
})(window.jQuery || window.Zepto, window, document);
|
1327-master/_1327/static/less/admin.less
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@import "variables.less";
|
| 2 |
+
|
| 3 |
+
// change_list actions
|
| 4 |
+
.actions {
|
| 5 |
+
display: inline-block;
|
| 6 |
+
margin: 0;
|
| 7 |
+
}
|
| 8 |
+
.actions select {
|
| 9 |
+
display: inherit;
|
| 10 |
+
width: inherit;
|
| 11 |
+
}
|
| 12 |
+
.action-counter {
|
| 13 |
+
margin-left: 5px;
|
| 14 |
+
vertical-align: sub;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
// change_list table display
|
| 18 |
+
th.action-checkbox-column {
|
| 19 |
+
width: 1.5em;
|
| 20 |
+
text-align:center;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
td.action-checkbox {
|
| 24 |
+
text-align:center;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
#result_list {
|
| 28 |
+
margin-bottom: 0;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
.form-actions {
|
| 32 |
+
margin-bottom: @grid-gutter-width / 2;
|
| 33 |
+
}
|
1327-master/_1327/static/less/variables.less
ADDED
|
@@ -0,0 +1,875 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//
|
| 2 |
+
// Variables
|
| 3 |
+
// --------------------------------------------------
|
| 4 |
+
|
| 5 |
+
// Non-Bootstrap variables
|
| 6 |
+
@hpi-yellow: #f6a800;
|
| 7 |
+
@hpi-orange: #dd6108;
|
| 8 |
+
@hpi-red: #b1063a;
|
| 9 |
+
@hpi-gray: #5a6065;
|
| 10 |
+
@hpi-blue: #007a9e;
|
| 11 |
+
@white: #ffffff;
|
| 12 |
+
@green: #69a700;
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
@headline-height: 50px;
|
| 16 |
+
@footer-height: 40px;
|
| 17 |
+
|
| 18 |
+
//== Colors
|
| 19 |
+
//
|
| 20 |
+
//## Gray and brand colors for use across Bootstrap.
|
| 21 |
+
|
| 22 |
+
@gray-base: #000;
|
| 23 |
+
@gray-darker: darken(@brand-primary, 30%);
|
| 24 |
+
@gray-dark: darken(@brand-primary, 20%);
|
| 25 |
+
@gray: @brand-primary;
|
| 26 |
+
@gray-light: lighten(@brand-primary, 35%);
|
| 27 |
+
@gray-lighter: lighten(@brand-primary, 55%);
|
| 28 |
+
|
| 29 |
+
@brand-default: @gray-light;
|
| 30 |
+
@brand-primary: @hpi-gray;
|
| 31 |
+
@brand-success: @green;
|
| 32 |
+
@brand-info: @hpi-blue;
|
| 33 |
+
@brand-warning: @hpi-yellow;
|
| 34 |
+
@brand-danger: @hpi-red;
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
//== Scaffolding
|
| 38 |
+
//
|
| 39 |
+
//## Settings for some of the most global styles.
|
| 40 |
+
|
| 41 |
+
//** Background color for `<body>`.
|
| 42 |
+
@body-bg: @gray-lighter;
|
| 43 |
+
//** Global text color on `<body>`.
|
| 44 |
+
@text-color: @gray-darker;
|
| 45 |
+
|
| 46 |
+
//** Global textual link color.
|
| 47 |
+
@link-color: @brand-danger;
|
| 48 |
+
//** Link hover color set via `darken()` function.
|
| 49 |
+
@link-hover-color: @brand-warning;
|
| 50 |
+
//** Link hover decoration.
|
| 51 |
+
@link-hover-decoration: underline;
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
//== Typography
|
| 55 |
+
//
|
| 56 |
+
//## Font, line-height, and color for body text, headings, and more.
|
| 57 |
+
|
| 58 |
+
@font-family-sans-serif: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
| 59 |
+
@font-family-serif: Georgia, "Times New Roman", Times, serif;
|
| 60 |
+
//** Default monospace fonts for `<code>`, `<kbd>`, and `<pre>`.
|
| 61 |
+
@font-family-monospace: Menlo, Monaco, Consolas, "Courier New", monospace;
|
| 62 |
+
@font-family-base: @font-family-sans-serif;
|
| 63 |
+
|
| 64 |
+
@font-size-base: 14px;
|
| 65 |
+
@font-size-large: ceil((@font-size-base * 1.25)); // ~18px
|
| 66 |
+
@font-size-small: ceil((@font-size-base * 0.85)); // ~12px
|
| 67 |
+
|
| 68 |
+
@font-size-h1: floor((@font-size-base * 2.6)); // ~36px
|
| 69 |
+
@font-size-h2: floor((@font-size-base * 2.15)); // ~30px
|
| 70 |
+
@font-size-h3: ceil((@font-size-base * 1.7)); // ~24px
|
| 71 |
+
@font-size-h4: ceil((@font-size-base * 1.25)); // ~18px
|
| 72 |
+
@font-size-h5: @font-size-base;
|
| 73 |
+
@font-size-h6: ceil((@font-size-base * 0.85)); // ~12px
|
| 74 |
+
|
| 75 |
+
//** Unit-less `line-height` for use in components like buttons.
|
| 76 |
+
@line-height-base: 1.428571429; // 20/14
|
| 77 |
+
//** Computed "line-height" (`font-size` * `line-height`) for use with `margin`, `padding`, etc.
|
| 78 |
+
@line-height-computed: floor((@font-size-base * @line-height-base)); // ~20px
|
| 79 |
+
|
| 80 |
+
//** By default, this inherits from the `<body>`.
|
| 81 |
+
@headings-font-family: inherit;
|
| 82 |
+
@headings-font-weight: 500;
|
| 83 |
+
@headings-line-height: 1.1;
|
| 84 |
+
@headings-color: inherit;
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
//== Iconography
|
| 88 |
+
//
|
| 89 |
+
//## Specify custom location and filename of the included Glyphicons icon font. Useful for those including Bootstrap via Bower.
|
| 90 |
+
|
| 91 |
+
//** Load fonts from this directory.
|
| 92 |
+
@icon-font-path: "../bootstrap/fonts/";
|
| 93 |
+
//** File name for all font files.
|
| 94 |
+
@icon-font-name: "glyphicons-halflings-regular";
|
| 95 |
+
//** Element ID within SVG icon file.
|
| 96 |
+
@icon-font-svg-id: "glyphicons_halflingsregular";
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
//== Components
|
| 100 |
+
//
|
| 101 |
+
//## Define common padding and border radius sizes and more. Values based on 14px text and 1.428 line-height (~20px to start).
|
| 102 |
+
|
| 103 |
+
@padding-base-vertical: 6px;
|
| 104 |
+
@padding-base-horizontal: 12px;
|
| 105 |
+
|
| 106 |
+
@padding-large-vertical: 10px;
|
| 107 |
+
@padding-large-horizontal: 16px;
|
| 108 |
+
|
| 109 |
+
@padding-small-vertical: 5px;
|
| 110 |
+
@padding-small-horizontal: 10px;
|
| 111 |
+
|
| 112 |
+
@padding-xs-vertical: 1px;
|
| 113 |
+
@padding-xs-horizontal: 5px;
|
| 114 |
+
|
| 115 |
+
@line-height-large: 1.3333333; // extra decimals for Win 8.1 Chrome
|
| 116 |
+
@line-height-small: 1.5;
|
| 117 |
+
|
| 118 |
+
@border-radius-base: 0;
|
| 119 |
+
@border-radius-large: 0;
|
| 120 |
+
@border-radius-small: 0;
|
| 121 |
+
|
| 122 |
+
//** Global color for active items (e.g., navs or dropdowns).
|
| 123 |
+
@component-active-color: #fff;
|
| 124 |
+
//** Global background color for active items (e.g., navs or dropdowns).
|
| 125 |
+
@component-active-bg: @brand-primary;
|
| 126 |
+
|
| 127 |
+
//** Width of the `border` for generating carets that indicator dropdowns.
|
| 128 |
+
@caret-width-base: 4px;
|
| 129 |
+
//** Carets increase slightly in size for larger components.
|
| 130 |
+
@caret-width-large: 5px;
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
//== Tables
|
| 134 |
+
//
|
| 135 |
+
//## Customizes the `.table` component with basic values, each used across all table variations.
|
| 136 |
+
|
| 137 |
+
//** Padding for `<th>`s and `<td>`s.
|
| 138 |
+
@table-cell-padding: 8px;
|
| 139 |
+
//** Padding for cells in `.table-condensed`.
|
| 140 |
+
@table-condensed-cell-padding: 5px;
|
| 141 |
+
|
| 142 |
+
//** Default background color used for all tables.
|
| 143 |
+
@table-bg: transparent;
|
| 144 |
+
//** Background color used for `.table-striped`.
|
| 145 |
+
@table-bg-accent: @white;
|
| 146 |
+
@table-bg-accent-even: @gray-lighter; // this is a custom variable and not used by bootstrap
|
| 147 |
+
//** Background color used for `.table-hover`.
|
| 148 |
+
@table-bg-hover: #f5f5f5;
|
| 149 |
+
@table-bg-active: @table-bg-hover;
|
| 150 |
+
|
| 151 |
+
//** Border color for table and cell borders.
|
| 152 |
+
@table-border-color: #ddd;
|
| 153 |
+
|
| 154 |
+
|
| 155 |
+
//== Buttons
|
| 156 |
+
//
|
| 157 |
+
//## For each of Bootstrap's buttons, define text, background and border color.
|
| 158 |
+
|
| 159 |
+
@btn-font-weight: normal;
|
| 160 |
+
|
| 161 |
+
@btn-default-color: @gray-darker;
|
| 162 |
+
@btn-default-bg: @gray-lighter;
|
| 163 |
+
@btn-default-border: darken(@gray-light, 10%);
|
| 164 |
+
|
| 165 |
+
@btn-primary-color: @gray-lighter;
|
| 166 |
+
@btn-primary-bg: @gray;
|
| 167 |
+
@btn-primary-border: darken(@gray, 10%);
|
| 168 |
+
|
| 169 |
+
@btn-success-color: @gray-lighter;
|
| 170 |
+
@btn-success-bg: @brand-success;
|
| 171 |
+
@btn-success-border: darken(@brand-success, 10%);
|
| 172 |
+
|
| 173 |
+
@btn-info-color: @gray-lighter;
|
| 174 |
+
@btn-info-bg: @brand-info;
|
| 175 |
+
@btn-info-border: darken(@brand-info, 10%);
|
| 176 |
+
|
| 177 |
+
@btn-warning-color: @gray-darker;
|
| 178 |
+
@btn-warning-bg: @brand-warning;
|
| 179 |
+
@btn-warning-border: darken(@brand-warning, 10%);
|
| 180 |
+
|
| 181 |
+
@btn-danger-color: @gray-lighter;
|
| 182 |
+
@btn-danger-bg: @brand-danger;
|
| 183 |
+
@btn-danger-border: darken(@brand-danger, 10%);
|
| 184 |
+
|
| 185 |
+
@btn-link-disabled-color: @gray-light;
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
//== Forms
|
| 189 |
+
//
|
| 190 |
+
//##
|
| 191 |
+
|
| 192 |
+
//** `<input>` background color
|
| 193 |
+
@input-bg: #fff;
|
| 194 |
+
//** `<input disabled>` background color
|
| 195 |
+
@input-bg-disabled: @gray-lighter;
|
| 196 |
+
|
| 197 |
+
//** Text color for `<input>`s
|
| 198 |
+
@input-color: @gray;
|
| 199 |
+
//** `<input>` border color
|
| 200 |
+
@input-border: #ccc;
|
| 201 |
+
|
| 202 |
+
// TODO: Rename `@input-border-radius` to `@input-border-radius-base` in v4
|
| 203 |
+
//** Default `.form-control` border radius
|
| 204 |
+
// This has no effect on `<select>`s in some browsers, due to the limited stylability of `<select>`s in CSS.
|
| 205 |
+
@input-border-radius: @border-radius-base;
|
| 206 |
+
//** Large `.form-control` border radius
|
| 207 |
+
@input-border-radius-large: @border-radius-large;
|
| 208 |
+
//** Small `.form-control` border radius
|
| 209 |
+
@input-border-radius-small: @border-radius-small;
|
| 210 |
+
|
| 211 |
+
//** Border color for inputs on focus
|
| 212 |
+
@input-border-focus: #66afe9;
|
| 213 |
+
|
| 214 |
+
//** Placeholder text color
|
| 215 |
+
@input-color-placeholder: #999;
|
| 216 |
+
|
| 217 |
+
//** Default `.form-control` height
|
| 218 |
+
@input-height-base: (@line-height-computed + (@padding-base-vertical * 2) + 2);
|
| 219 |
+
//** Large `.form-control` height
|
| 220 |
+
@input-height-large: (ceil(@font-size-large * @line-height-large) + (@padding-large-vertical * 2) + 2);
|
| 221 |
+
//** Small `.form-control` height
|
| 222 |
+
@input-height-small: (floor(@font-size-small * @line-height-small) + (@padding-small-vertical * 2) + 2);
|
| 223 |
+
|
| 224 |
+
//** `.form-group` margin
|
| 225 |
+
@form-group-margin-bottom: 15px;
|
| 226 |
+
|
| 227 |
+
@legend-color: @gray-dark;
|
| 228 |
+
@legend-border-color: #e5e5e5;
|
| 229 |
+
|
| 230 |
+
//** Background color for textual input addons
|
| 231 |
+
@input-group-addon-bg: @gray-lighter;
|
| 232 |
+
//** Border color for textual input addons
|
| 233 |
+
@input-group-addon-border-color: @input-border;
|
| 234 |
+
|
| 235 |
+
//** Disabled cursor for form controls and buttons.
|
| 236 |
+
@cursor-disabled: not-allowed;
|
| 237 |
+
|
| 238 |
+
|
| 239 |
+
//== Dropdowns
|
| 240 |
+
//
|
| 241 |
+
//## Dropdown menu container and contents.
|
| 242 |
+
|
| 243 |
+
//** Background for the dropdown menu.
|
| 244 |
+
@dropdown-bg: #fff;
|
| 245 |
+
//** Dropdown menu `border-color`.
|
| 246 |
+
@dropdown-border: rgba(0,0,0,.15);
|
| 247 |
+
//** Dropdown menu `border-color` **for IE8**.
|
| 248 |
+
@dropdown-fallback-border: #ccc;
|
| 249 |
+
//** Divider color for between dropdown items.
|
| 250 |
+
@dropdown-divider-bg: #e5e5e5;
|
| 251 |
+
|
| 252 |
+
//** Dropdown link text color.
|
| 253 |
+
@dropdown-link-color: @gray-dark;
|
| 254 |
+
//** Hover color for dropdown links.
|
| 255 |
+
@dropdown-link-hover-color: darken(@gray-dark, 5%);
|
| 256 |
+
//** Hover background for dropdown links.
|
| 257 |
+
@dropdown-link-hover-bg: #f5f5f5;
|
| 258 |
+
|
| 259 |
+
//** Active dropdown menu item text color.
|
| 260 |
+
@dropdown-link-active-color: @component-active-color;
|
| 261 |
+
//** Active dropdown menu item background color.
|
| 262 |
+
@dropdown-link-active-bg: @component-active-bg;
|
| 263 |
+
|
| 264 |
+
//** Disabled dropdown menu item background color.
|
| 265 |
+
@dropdown-link-disabled-color: @gray-light;
|
| 266 |
+
|
| 267 |
+
//** Text color for headers within dropdown menus.
|
| 268 |
+
@dropdown-header-color: @gray-light;
|
| 269 |
+
|
| 270 |
+
//** Deprecated `@dropdown-caret-color` as of v3.1.0
|
| 271 |
+
@dropdown-caret-color: #000;
|
| 272 |
+
|
| 273 |
+
|
| 274 |
+
//-- Z-index master list
|
| 275 |
+
//
|
| 276 |
+
// Warning: Avoid customizing these values. They're used for a bird's eye view
|
| 277 |
+
// of components dependent on the z-axis and are designed to all work together.
|
| 278 |
+
//
|
| 279 |
+
// Note: These variables are not generated into the Customizer.
|
| 280 |
+
|
| 281 |
+
@zindex-navbar: 1000;
|
| 282 |
+
@zindex-dropdown: 1000;
|
| 283 |
+
@zindex-popover: 1060;
|
| 284 |
+
@zindex-tooltip: 1070;
|
| 285 |
+
@zindex-navbar-fixed: 1030;
|
| 286 |
+
@zindex-modal-background: 1040;
|
| 287 |
+
@zindex-modal: 1050;
|
| 288 |
+
|
| 289 |
+
|
| 290 |
+
//== Media queries breakpoints
|
| 291 |
+
//
|
| 292 |
+
//## Define the breakpoints at which your layout will change, adapting to different screen sizes.
|
| 293 |
+
|
| 294 |
+
// Extra small screen / phone
|
| 295 |
+
//** Deprecated `@screen-xs` as of v3.0.1
|
| 296 |
+
@screen-xs: 480px;
|
| 297 |
+
//** Deprecated `@screen-xs-min` as of v3.2.0
|
| 298 |
+
@screen-xs-min: @screen-xs;
|
| 299 |
+
//** Deprecated `@screen-phone` as of v3.0.1
|
| 300 |
+
@screen-phone: @screen-xs-min;
|
| 301 |
+
|
| 302 |
+
// Small screen / tablet
|
| 303 |
+
//** Deprecated `@screen-sm` as of v3.0.1
|
| 304 |
+
@screen-sm: 768px;
|
| 305 |
+
@screen-sm-min: @screen-sm;
|
| 306 |
+
//** Deprecated `@screen-tablet` as of v3.0.1
|
| 307 |
+
@screen-tablet: @screen-sm-min;
|
| 308 |
+
|
| 309 |
+
// Medium screen / desktop
|
| 310 |
+
//** Deprecated `@screen-md` as of v3.0.1
|
| 311 |
+
@screen-md: 992px;
|
| 312 |
+
@screen-md-min: @screen-md;
|
| 313 |
+
//** Deprecated `@screen-desktop` as of v3.0.1
|
| 314 |
+
@screen-desktop: @screen-md-min;
|
| 315 |
+
|
| 316 |
+
// Large screen / wide desktop
|
| 317 |
+
//** Deprecated `@screen-lg` as of v3.0.1
|
| 318 |
+
@screen-lg: 1200px;
|
| 319 |
+
@screen-lg-min: @screen-lg;
|
| 320 |
+
//** Deprecated `@screen-lg-desktop` as of v3.0.1
|
| 321 |
+
@screen-lg-desktop: @screen-lg-min;
|
| 322 |
+
|
| 323 |
+
// So media queries don't overlap when required, provide a maximum
|
| 324 |
+
@screen-xs-max: (@screen-sm-min - 1);
|
| 325 |
+
@screen-sm-max: (@screen-md-min - 1);
|
| 326 |
+
@screen-md-max: (@screen-lg-min - 1);
|
| 327 |
+
|
| 328 |
+
|
| 329 |
+
//== Grid system
|
| 330 |
+
//
|
| 331 |
+
//## Define your custom responsive grid.
|
| 332 |
+
|
| 333 |
+
//** Number of columns in the grid.
|
| 334 |
+
@grid-columns: 12;
|
| 335 |
+
//** Padding between columns. Gets divided in half for the left and right.
|
| 336 |
+
@grid-gutter-width: 30px;
|
| 337 |
+
// Navbar collapse
|
| 338 |
+
//** Point at which the navbar becomes uncollapsed.
|
| 339 |
+
@grid-float-breakpoint: @screen-sm-min;
|
| 340 |
+
//** Point at which the navbar begins collapsing.
|
| 341 |
+
@grid-float-breakpoint-max: (@grid-float-breakpoint - 1);
|
| 342 |
+
|
| 343 |
+
|
| 344 |
+
//== Container sizes
|
| 345 |
+
//
|
| 346 |
+
//## Define the maximum width of `.container` for different screen sizes.
|
| 347 |
+
|
| 348 |
+
// Small screen / tablet
|
| 349 |
+
@container-tablet: (720px + @grid-gutter-width);
|
| 350 |
+
//** For `@screen-sm-min` and up.
|
| 351 |
+
@container-sm: @container-tablet;
|
| 352 |
+
|
| 353 |
+
// Medium screen / desktop
|
| 354 |
+
@container-desktop: (940px + @grid-gutter-width);
|
| 355 |
+
//** For `@screen-md-min` and up.
|
| 356 |
+
@container-md: @container-desktop;
|
| 357 |
+
|
| 358 |
+
// Large screen / wide desktop
|
| 359 |
+
@container-large-desktop: (1140px + @grid-gutter-width);
|
| 360 |
+
//** For `@screen-lg-min` and up.
|
| 361 |
+
@container-lg: @container-large-desktop;
|
| 362 |
+
|
| 363 |
+
|
| 364 |
+
//== Navbar
|
| 365 |
+
//
|
| 366 |
+
//##
|
| 367 |
+
|
| 368 |
+
// Basics of a navbar
|
| 369 |
+
@navbar-height: 40px;
|
| 370 |
+
@navbar-margin-bottom: @line-height-computed;
|
| 371 |
+
@navbar-border-radius: 0;
|
| 372 |
+
@navbar-padding-horizontal: floor((@grid-gutter-width / 2));
|
| 373 |
+
@navbar-padding-vertical: ((@navbar-height - @line-height-computed) / 2);
|
| 374 |
+
@navbar-collapse-max-height: 340px;
|
| 375 |
+
|
| 376 |
+
@navbar-default-color: @gray-light;
|
| 377 |
+
@navbar-default-bg: @gray-dark;
|
| 378 |
+
@navbar-default-border: transparent;
|
| 379 |
+
|
| 380 |
+
// Navbar links
|
| 381 |
+
@navbar-default-link-color: @gray-lighter;
|
| 382 |
+
@navbar-default-link-hover-color: @gray-lighter;
|
| 383 |
+
@navbar-default-link-hover-bg: @gray;
|
| 384 |
+
@navbar-default-link-active-color: @hpi-yellow;
|
| 385 |
+
@navbar-default-link-active-bg: transparent;
|
| 386 |
+
@navbar-default-link-disabled-color: #ccc;
|
| 387 |
+
@navbar-default-link-disabled-bg: transparent;
|
| 388 |
+
|
| 389 |
+
// Navbar brand label
|
| 390 |
+
@navbar-default-brand-color: @navbar-default-link-color;
|
| 391 |
+
@navbar-default-brand-hover-color: darken(@navbar-default-brand-color, 10%);
|
| 392 |
+
@navbar-default-brand-hover-bg: transparent;
|
| 393 |
+
|
| 394 |
+
// Navbar toggle
|
| 395 |
+
@navbar-default-toggle-hover-bg: #ddd;
|
| 396 |
+
@navbar-default-toggle-icon-bar-bg: #888;
|
| 397 |
+
@navbar-default-toggle-border-color: #ddd;
|
| 398 |
+
|
| 399 |
+
|
| 400 |
+
// Inverted navbar
|
| 401 |
+
// Reset inverted navbar basics
|
| 402 |
+
@navbar-inverse-color: @gray-light;
|
| 403 |
+
@navbar-inverse-bg: #222;
|
| 404 |
+
@navbar-inverse-border: darken(@navbar-inverse-bg, 10%);
|
| 405 |
+
|
| 406 |
+
// Inverted navbar links
|
| 407 |
+
@navbar-inverse-link-color: @gray-light;
|
| 408 |
+
@navbar-inverse-link-hover-color: #fff;
|
| 409 |
+
@navbar-inverse-link-hover-bg: transparent;
|
| 410 |
+
@navbar-inverse-link-active-color: @navbar-inverse-link-hover-color;
|
| 411 |
+
@navbar-inverse-link-active-bg: darken(@navbar-inverse-bg, 10%);
|
| 412 |
+
@navbar-inverse-link-disabled-color: #444;
|
| 413 |
+
@navbar-inverse-link-disabled-bg: transparent;
|
| 414 |
+
|
| 415 |
+
// Inverted navbar brand label
|
| 416 |
+
@navbar-inverse-brand-color: @navbar-inverse-link-color;
|
| 417 |
+
@navbar-inverse-brand-hover-color: #fff;
|
| 418 |
+
@navbar-inverse-brand-hover-bg: transparent;
|
| 419 |
+
|
| 420 |
+
// Inverted navbar toggle
|
| 421 |
+
@navbar-inverse-toggle-hover-bg: #333;
|
| 422 |
+
@navbar-inverse-toggle-icon-bar-bg: #fff;
|
| 423 |
+
@navbar-inverse-toggle-border-color: #333;
|
| 424 |
+
|
| 425 |
+
|
| 426 |
+
//== Navs
|
| 427 |
+
//
|
| 428 |
+
//##
|
| 429 |
+
|
| 430 |
+
//=== Shared nav styles
|
| 431 |
+
@nav-link-padding: 10px 15px;
|
| 432 |
+
@nav-link-hover-bg: @gray-lighter;
|
| 433 |
+
|
| 434 |
+
@nav-disabled-link-color: @gray-light;
|
| 435 |
+
@nav-disabled-link-hover-color: @gray-light;
|
| 436 |
+
|
| 437 |
+
//== Tabs
|
| 438 |
+
@nav-tabs-border-color: #ddd;
|
| 439 |
+
|
| 440 |
+
@nav-tabs-link-hover-border-color: @gray-lighter;
|
| 441 |
+
|
| 442 |
+
@nav-tabs-active-link-hover-bg: @body-bg;
|
| 443 |
+
@nav-tabs-active-link-hover-color: @gray;
|
| 444 |
+
@nav-tabs-active-link-hover-border-color: #ddd;
|
| 445 |
+
|
| 446 |
+
@nav-tabs-justified-link-border-color: #ddd;
|
| 447 |
+
@nav-tabs-justified-active-link-border-color: @body-bg;
|
| 448 |
+
|
| 449 |
+
//== Pills
|
| 450 |
+
@nav-pills-border-radius: @border-radius-base;
|
| 451 |
+
@nav-pills-active-link-hover-bg: @component-active-bg;
|
| 452 |
+
@nav-pills-active-link-hover-color: @component-active-color;
|
| 453 |
+
|
| 454 |
+
|
| 455 |
+
//== Pagination
|
| 456 |
+
//
|
| 457 |
+
//##
|
| 458 |
+
|
| 459 |
+
@pagination-color: @link-color;
|
| 460 |
+
@pagination-bg: #fff;
|
| 461 |
+
@pagination-border: #ddd;
|
| 462 |
+
|
| 463 |
+
@pagination-hover-color: @link-hover-color;
|
| 464 |
+
@pagination-hover-bg: @gray-lighter;
|
| 465 |
+
@pagination-hover-border: #ddd;
|
| 466 |
+
|
| 467 |
+
@pagination-active-color: #fff;
|
| 468 |
+
@pagination-active-bg: @brand-primary;
|
| 469 |
+
@pagination-active-border: @brand-primary;
|
| 470 |
+
|
| 471 |
+
@pagination-disabled-color: @gray-light;
|
| 472 |
+
@pagination-disabled-bg: #fff;
|
| 473 |
+
@pagination-disabled-border: #ddd;
|
| 474 |
+
|
| 475 |
+
|
| 476 |
+
//== Pager
|
| 477 |
+
//
|
| 478 |
+
//##
|
| 479 |
+
|
| 480 |
+
@pager-bg: @pagination-bg;
|
| 481 |
+
@pager-border: @pagination-border;
|
| 482 |
+
@pager-border-radius: 15px;
|
| 483 |
+
|
| 484 |
+
@pager-hover-bg: @pagination-hover-bg;
|
| 485 |
+
|
| 486 |
+
@pager-active-bg: @pagination-active-bg;
|
| 487 |
+
@pager-active-color: @pagination-active-color;
|
| 488 |
+
|
| 489 |
+
@pager-disabled-color: @pagination-disabled-color;
|
| 490 |
+
|
| 491 |
+
|
| 492 |
+
//== Jumbotron
|
| 493 |
+
//
|
| 494 |
+
//##
|
| 495 |
+
|
| 496 |
+
@jumbotron-padding: 30px;
|
| 497 |
+
@jumbotron-color: inherit;
|
| 498 |
+
@jumbotron-bg: @gray-lighter;
|
| 499 |
+
@jumbotron-heading-color: inherit;
|
| 500 |
+
@jumbotron-font-size: ceil((@font-size-base * 1.5));
|
| 501 |
+
|
| 502 |
+
|
| 503 |
+
//== Form states and alerts
|
| 504 |
+
//
|
| 505 |
+
//## Define colors for form feedback states and, by default, alerts.
|
| 506 |
+
|
| 507 |
+
@state-success-text: @brand-success;
|
| 508 |
+
@state-success-bg: @brand-success;
|
| 509 |
+
@state-success-border: darken(@brand-success, 10%);
|
| 510 |
+
|
| 511 |
+
@state-info-text: @brand-info;
|
| 512 |
+
@state-info-bg: @brand-info;
|
| 513 |
+
@state-info-border: darken(@brand-info, 10%);
|
| 514 |
+
|
| 515 |
+
@state-warning-text: @brand-warning;
|
| 516 |
+
@state-warning-bg: @brand-warning;
|
| 517 |
+
@state-warning-border: darken(@brand-warning, 10%);
|
| 518 |
+
|
| 519 |
+
@state-danger-text: @brand-danger;
|
| 520 |
+
@state-danger-bg: @brand-danger;
|
| 521 |
+
@state-danger-border: darken(@brand-danger, 10%);
|
| 522 |
+
|
| 523 |
+
|
| 524 |
+
//== Tooltips
|
| 525 |
+
//
|
| 526 |
+
//##
|
| 527 |
+
|
| 528 |
+
//** Tooltip max width
|
| 529 |
+
@tooltip-max-width: 200px;
|
| 530 |
+
//** Tooltip text color
|
| 531 |
+
@tooltip-color: @text-color;
|
| 532 |
+
//** Tooltip background color
|
| 533 |
+
@tooltip-bg: @gray-light;
|
| 534 |
+
@tooltip-opacity: .9;
|
| 535 |
+
|
| 536 |
+
//** Tooltip arrow width
|
| 537 |
+
@tooltip-arrow-width: 5px;
|
| 538 |
+
//** Tooltip arrow color
|
| 539 |
+
@tooltip-arrow-color: @tooltip-bg;
|
| 540 |
+
|
| 541 |
+
|
| 542 |
+
//== Popovers
|
| 543 |
+
//
|
| 544 |
+
//##
|
| 545 |
+
|
| 546 |
+
//** Popover body background color
|
| 547 |
+
@popover-bg: #fff;
|
| 548 |
+
//** Popover maximum width
|
| 549 |
+
@popover-max-width: 276px;
|
| 550 |
+
//** Popover border color
|
| 551 |
+
@popover-border-color: rgba(0,0,0,.2);
|
| 552 |
+
//** Popover fallback border color
|
| 553 |
+
@popover-fallback-border-color: #ccc;
|
| 554 |
+
|
| 555 |
+
//** Popover title background color
|
| 556 |
+
@popover-title-bg: darken(@popover-bg, 3%);
|
| 557 |
+
|
| 558 |
+
//** Popover arrow width
|
| 559 |
+
@popover-arrow-width: 10px;
|
| 560 |
+
//** Popover arrow color
|
| 561 |
+
@popover-arrow-color: #fff;
|
| 562 |
+
|
| 563 |
+
//** Popover outer arrow width
|
| 564 |
+
@popover-arrow-outer-width: (@popover-arrow-width + 1);
|
| 565 |
+
//** Popover outer arrow color
|
| 566 |
+
@popover-arrow-outer-color: fadein(@popover-border-color, 5%);
|
| 567 |
+
//** Popover outer arrow fallback color
|
| 568 |
+
@popover-arrow-outer-fallback-color: darken(@popover-fallback-border-color, 20%);
|
| 569 |
+
|
| 570 |
+
|
| 571 |
+
//== Labels
|
| 572 |
+
//
|
| 573 |
+
//##
|
| 574 |
+
|
| 575 |
+
//** Default label background color
|
| 576 |
+
@label-default-bg: darken(@brand-default, 10%);
|
| 577 |
+
//** Primary label background color
|
| 578 |
+
@label-primary-bg: @brand-primary;
|
| 579 |
+
//** Success label background color
|
| 580 |
+
@label-success-bg: @brand-success;
|
| 581 |
+
//** Info label background color
|
| 582 |
+
@label-info-bg: @brand-info;
|
| 583 |
+
//** Warning label background color
|
| 584 |
+
@label-warning-bg: @brand-warning;
|
| 585 |
+
//** Danger label background color
|
| 586 |
+
@label-danger-bg: @brand-danger;
|
| 587 |
+
|
| 588 |
+
//** Default label text color
|
| 589 |
+
@label-color: @gray-lighter;
|
| 590 |
+
//** Default text color of a linked label
|
| 591 |
+
@label-link-hover-color: @gray-light;
|
| 592 |
+
|
| 593 |
+
|
| 594 |
+
//== Modals
|
| 595 |
+
//
|
| 596 |
+
//##
|
| 597 |
+
|
| 598 |
+
//** Padding applied to the modal body
|
| 599 |
+
@modal-inner-padding: 15px;
|
| 600 |
+
|
| 601 |
+
//** Padding applied to the modal title
|
| 602 |
+
@modal-title-padding: 15px;
|
| 603 |
+
//** Modal title line-height
|
| 604 |
+
@modal-title-line-height: @line-height-base;
|
| 605 |
+
|
| 606 |
+
//** Background color of modal content area
|
| 607 |
+
@modal-content-bg: #fff;
|
| 608 |
+
//** Modal content border color
|
| 609 |
+
@modal-content-border-color: rgba(0,0,0,.2);
|
| 610 |
+
//** Modal content border color **for IE8**
|
| 611 |
+
@modal-content-fallback-border-color: #999;
|
| 612 |
+
|
| 613 |
+
//** Modal backdrop background color
|
| 614 |
+
@modal-backdrop-bg: #000;
|
| 615 |
+
//** Modal backdrop opacity
|
| 616 |
+
@modal-backdrop-opacity: .5;
|
| 617 |
+
//** Modal header border color
|
| 618 |
+
@modal-header-border-color: #e5e5e5;
|
| 619 |
+
//** Modal footer border color
|
| 620 |
+
@modal-footer-border-color: @modal-header-border-color;
|
| 621 |
+
|
| 622 |
+
@modal-lg: 900px;
|
| 623 |
+
@modal-md: 600px;
|
| 624 |
+
@modal-sm: 300px;
|
| 625 |
+
|
| 626 |
+
|
| 627 |
+
//== Alerts
|
| 628 |
+
//
|
| 629 |
+
//## Define alert colors, border radius, and padding.
|
| 630 |
+
|
| 631 |
+
@alert-padding: 8px;
|
| 632 |
+
@alert-border-radius: @border-radius-base;
|
| 633 |
+
@alert-link-font-weight: bold;
|
| 634 |
+
|
| 635 |
+
@alert-success-bg: @state-success-bg;
|
| 636 |
+
@alert-success-text: @gray-lighter;
|
| 637 |
+
@alert-success-border: @state-success-border;
|
| 638 |
+
|
| 639 |
+
@alert-info-bg: @state-info-bg;
|
| 640 |
+
@alert-info-text: @gray-lighter;
|
| 641 |
+
@alert-info-border: @state-info-border;
|
| 642 |
+
|
| 643 |
+
@alert-warning-bg: @state-warning-bg;
|
| 644 |
+
@alert-warning-text: @gray-lighter;
|
| 645 |
+
@alert-warning-border: @state-warning-border;
|
| 646 |
+
|
| 647 |
+
@alert-danger-bg: @state-danger-bg;
|
| 648 |
+
@alert-danger-text: @gray-lighter;
|
| 649 |
+
@alert-danger-border: @state-danger-border;
|
| 650 |
+
|
| 651 |
+
|
| 652 |
+
//== Progress bars
|
| 653 |
+
//
|
| 654 |
+
//##
|
| 655 |
+
|
| 656 |
+
//** Background color of the whole progress component
|
| 657 |
+
@progress-bg: @gray-lighter;
|
| 658 |
+
//** Progress bar text color
|
| 659 |
+
@progress-bar-color: @gray-lighter;
|
| 660 |
+
//** Variable for setting rounded corners on progress bar.
|
| 661 |
+
@progress-border-radius: @border-radius-base;
|
| 662 |
+
|
| 663 |
+
//** Default progress bar color
|
| 664 |
+
@progress-bar-bg: @brand-primary;
|
| 665 |
+
//** Success progress bar color
|
| 666 |
+
@progress-bar-success-bg: @brand-success;
|
| 667 |
+
//** Warning progress bar color
|
| 668 |
+
@progress-bar-warning-bg: @brand-warning;
|
| 669 |
+
//** Danger progress bar color
|
| 670 |
+
@progress-bar-danger-bg: @brand-danger;
|
| 671 |
+
//** Info progress bar color
|
| 672 |
+
@progress-bar-info-bg: @brand-info;
|
| 673 |
+
|
| 674 |
+
|
| 675 |
+
//== List group
|
| 676 |
+
//
|
| 677 |
+
//##
|
| 678 |
+
|
| 679 |
+
//** Background color on `.list-group-item`
|
| 680 |
+
@list-group-bg: #fff;
|
| 681 |
+
//** `.list-group-item` border color
|
| 682 |
+
@list-group-border: #ddd;
|
| 683 |
+
//** List group border radius
|
| 684 |
+
@list-group-border-radius: @border-radius-base;
|
| 685 |
+
|
| 686 |
+
//** Background color of single list items on hover
|
| 687 |
+
@list-group-hover-bg: #f5f5f5;
|
| 688 |
+
//** Text color of active list items
|
| 689 |
+
@list-group-active-color: @component-active-color;
|
| 690 |
+
//** Background color of active list items
|
| 691 |
+
@list-group-active-bg: @component-active-bg;
|
| 692 |
+
//** Border color of active list elements
|
| 693 |
+
@list-group-active-border: @list-group-active-bg;
|
| 694 |
+
//** Text color for content within active list items
|
| 695 |
+
@list-group-active-text-color: lighten(@list-group-active-bg, 40%);
|
| 696 |
+
|
| 697 |
+
//** Text color of disabled list items
|
| 698 |
+
@list-group-disabled-color: @gray-light;
|
| 699 |
+
//** Background color of disabled list items
|
| 700 |
+
@list-group-disabled-bg: @gray-lighter;
|
| 701 |
+
//** Text color for content within disabled list items
|
| 702 |
+
@list-group-disabled-text-color: @list-group-disabled-color;
|
| 703 |
+
|
| 704 |
+
@list-group-link-color: #555;
|
| 705 |
+
@list-group-link-hover-color: @list-group-link-color;
|
| 706 |
+
@list-group-link-heading-color: #333;
|
| 707 |
+
|
| 708 |
+
|
| 709 |
+
//== Panels
|
| 710 |
+
//
|
| 711 |
+
//##
|
| 712 |
+
|
| 713 |
+
@panel-bg: #fff;
|
| 714 |
+
@panel-body-padding: 15px;
|
| 715 |
+
@panel-heading-padding: 10px 15px;
|
| 716 |
+
@panel-footer-padding: @panel-heading-padding;
|
| 717 |
+
@panel-border-radius: @border-radius-base;
|
| 718 |
+
|
| 719 |
+
//** Border color for elements within panels
|
| 720 |
+
@panel-inner-border: @brand-primary;
|
| 721 |
+
@panel-footer-bg: @brand-default;
|
| 722 |
+
|
| 723 |
+
@panel-default-text: @gray-darker;
|
| 724 |
+
@panel-default-border: @brand-primary;
|
| 725 |
+
@panel-default-heading-bg: @brand-default;
|
| 726 |
+
|
| 727 |
+
@panel-primary-text: @gray-lighter;
|
| 728 |
+
@panel-primary-border: @gray-darker;
|
| 729 |
+
@panel-primary-heading-bg: @brand-primary;
|
| 730 |
+
|
| 731 |
+
@panel-success-text: @gray-darker;
|
| 732 |
+
@panel-success-border: @brand-success;
|
| 733 |
+
@panel-success-heading-bg: lighten(@brand-success, 55%);
|
| 734 |
+
|
| 735 |
+
@panel-info-text: @gray-darker;
|
| 736 |
+
@panel-info-border: @brand-info;
|
| 737 |
+
@panel-info-heading-bg: lighten(@brand-info, 55%);
|
| 738 |
+
|
| 739 |
+
@panel-warning-text: @gray-darker;
|
| 740 |
+
@panel-warning-border: @brand-warning;
|
| 741 |
+
@panel-warning-heading-bg: lighten(@brand-warning, 48%);
|
| 742 |
+
|
| 743 |
+
@panel-danger-text: @gray-darker;
|
| 744 |
+
@panel-danger-border: @brand-danger;
|
| 745 |
+
@panel-danger-heading-bg: lighten(@brand-danger, 55%);
|
| 746 |
+
|
| 747 |
+
|
| 748 |
+
//== Thumbnails
|
| 749 |
+
//
|
| 750 |
+
//##
|
| 751 |
+
|
| 752 |
+
//** Padding around the thumbnail image
|
| 753 |
+
@thumbnail-padding: 4px;
|
| 754 |
+
//** Thumbnail background color
|
| 755 |
+
@thumbnail-bg: @body-bg;
|
| 756 |
+
//** Thumbnail border color
|
| 757 |
+
@thumbnail-border: #ddd;
|
| 758 |
+
//** Thumbnail border radius
|
| 759 |
+
@thumbnail-border-radius: @border-radius-base;
|
| 760 |
+
|
| 761 |
+
//** Custom text color for thumbnail captions
|
| 762 |
+
@thumbnail-caption-color: @text-color;
|
| 763 |
+
//** Padding around the thumbnail caption
|
| 764 |
+
@thumbnail-caption-padding: 9px;
|
| 765 |
+
|
| 766 |
+
|
| 767 |
+
//== Wells
|
| 768 |
+
//
|
| 769 |
+
//##
|
| 770 |
+
|
| 771 |
+
@well-bg: @gray-lighter;
|
| 772 |
+
@well-border: darken(@well-bg, 7%);
|
| 773 |
+
|
| 774 |
+
|
| 775 |
+
//== Badges
|
| 776 |
+
//
|
| 777 |
+
//##
|
| 778 |
+
|
| 779 |
+
@badge-color: #fff;
|
| 780 |
+
//** Linked badge text color on hover
|
| 781 |
+
@badge-link-hover-color: #fff;
|
| 782 |
+
@badge-bg: @gray-light;
|
| 783 |
+
|
| 784 |
+
//** Badge text color in active nav link
|
| 785 |
+
@badge-active-color: @link-color;
|
| 786 |
+
//** Badge background color in active nav link
|
| 787 |
+
@badge-active-bg: #fff;
|
| 788 |
+
|
| 789 |
+
@badge-font-weight: bold;
|
| 790 |
+
@badge-line-height: 1;
|
| 791 |
+
@badge-border-radius: 10px;
|
| 792 |
+
|
| 793 |
+
|
| 794 |
+
//== Breadcrumbs
|
| 795 |
+
//
|
| 796 |
+
//##
|
| 797 |
+
|
| 798 |
+
@breadcrumb-padding-vertical: 8px;
|
| 799 |
+
@breadcrumb-padding-horizontal: 15px;
|
| 800 |
+
//** Breadcrumb background color
|
| 801 |
+
@breadcrumb-bg: #f5f5f5;
|
| 802 |
+
//** Breadcrumb text color
|
| 803 |
+
@breadcrumb-color: #ccc;
|
| 804 |
+
//** Text color of current page in the breadcrumb
|
| 805 |
+
@breadcrumb-active-color: @gray-light;
|
| 806 |
+
//** Textual separator for between breadcrumb elements
|
| 807 |
+
@breadcrumb-separator: "/";
|
| 808 |
+
|
| 809 |
+
|
| 810 |
+
//== Carousel
|
| 811 |
+
//
|
| 812 |
+
//##
|
| 813 |
+
|
| 814 |
+
@carousel-text-shadow: 0 1px 2px rgba(0,0,0,.6);
|
| 815 |
+
|
| 816 |
+
@carousel-control-color: #fff;
|
| 817 |
+
@carousel-control-width: 15%;
|
| 818 |
+
@carousel-control-opacity: .5;
|
| 819 |
+
@carousel-control-font-size: 20px;
|
| 820 |
+
|
| 821 |
+
@carousel-indicator-active-bg: #fff;
|
| 822 |
+
@carousel-indicator-border-color: #fff;
|
| 823 |
+
|
| 824 |
+
@carousel-caption-color: #fff;
|
| 825 |
+
|
| 826 |
+
|
| 827 |
+
//== Close
|
| 828 |
+
//
|
| 829 |
+
//##
|
| 830 |
+
|
| 831 |
+
@close-font-weight: bold;
|
| 832 |
+
@close-color: #000;
|
| 833 |
+
@close-text-shadow: 0 1px 0 #fff;
|
| 834 |
+
|
| 835 |
+
|
| 836 |
+
//== Code
|
| 837 |
+
//
|
| 838 |
+
//##
|
| 839 |
+
|
| 840 |
+
@code-color: #c7254e;
|
| 841 |
+
@code-bg: #f9f2f4;
|
| 842 |
+
|
| 843 |
+
@kbd-color: #fff;
|
| 844 |
+
@kbd-bg: #333;
|
| 845 |
+
|
| 846 |
+
@pre-bg: #f5f5f5;
|
| 847 |
+
@pre-color: @gray-dark;
|
| 848 |
+
@pre-border-color: #ccc;
|
| 849 |
+
@pre-scrollable-max-height: 340px;
|
| 850 |
+
|
| 851 |
+
|
| 852 |
+
//== Type
|
| 853 |
+
//
|
| 854 |
+
//##
|
| 855 |
+
|
| 856 |
+
//** Horizontal offset for forms and lists.
|
| 857 |
+
@component-offset-horizontal: 180px;
|
| 858 |
+
//** Text muted color
|
| 859 |
+
@text-muted: @gray-light;
|
| 860 |
+
//** Abbreviations and acronyms border color
|
| 861 |
+
@abbr-border-color: @gray-light;
|
| 862 |
+
//** Headings small color
|
| 863 |
+
@headings-small-color: @gray-light;
|
| 864 |
+
//** Blockquote small color
|
| 865 |
+
@blockquote-small-color: @gray-light;
|
| 866 |
+
//** Blockquote font size
|
| 867 |
+
@blockquote-font-size: (@font-size-base * 1.25);
|
| 868 |
+
//** Blockquote border color
|
| 869 |
+
@blockquote-border-color: @gray-lighter;
|
| 870 |
+
//** Page header border color
|
| 871 |
+
@page-header-border-color: @gray-lighter;
|
| 872 |
+
//** Width of horizontal description list titles
|
| 873 |
+
@dl-horizontal-offset: @component-offset-horizontal;
|
| 874 |
+
//** Horizontal line color.
|
| 875 |
+
@hr-border: @gray-lighter;
|
1327-master/_1327/templates/admin/app_index.html
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends "admin/index.html" %}
|
| 2 |
+
{% load i18n bootstrapped_goodies_tags %}
|
| 3 |
+
|
| 4 |
+
{% if not is_popup %}
|
| 5 |
+
{% block breadcrumbs %}
|
| 6 |
+
<ul class="breadcrumb">
|
| 7 |
+
<li><a href="{% url 'admin:index' %}">{% trans 'Home' %}</a></li>
|
| 8 |
+
{% for app in app_list %}
|
| 9 |
+
<li>{% render_app_name app %}</li>
|
| 10 |
+
{% endfor %}
|
| 11 |
+
</ul>
|
| 12 |
+
{% endblock %}
|
| 13 |
+
{% endif %}
|
| 14 |
+
|
| 15 |
+
{% block content_title %}
|
| 16 |
+
{% for app in app_list %}
|
| 17 |
+
{% render_app_name app %} {% trans "administration" %}
|
| 18 |
+
{% endfor %}
|
| 19 |
+
{% endblock %}
|
| 20 |
+
|
| 21 |
+
{% block sidebar %}{% endblock %}
|
1327-master/_1327/templates/admin/base.html
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends 'base.html' %}
|
| 2 |
+
|
| 3 |
+
{% block rawcontent %}
|
| 4 |
+
{{ block.super }}
|
| 5 |
+
|
| 6 |
+
{% load admin_static bootstrapped_goodies_tags %}
|
| 7 |
+
|
| 8 |
+
{% block extrastyle %}{% endblock %}
|
| 9 |
+
|
| 10 |
+
<script type="text/javascript">
|
| 11 |
+
//<![CDATA[
|
| 12 |
+
window.__admin_media_prefix__ = "{% filter escapejs %}{% static "admin/" %}{% endfilter %}";
|
| 13 |
+
window.__admin_utc_offset__ = "{% filter escapejs %}{% now "Z" %}{% endfilter %}";
|
| 14 |
+
//]]>
|
| 15 |
+
</script>
|
| 16 |
+
{% block extrahead %}{% endblock %}
|
| 17 |
+
|
| 18 |
+
<script type="text/javascript">
|
| 19 |
+
//<![CDATA[
|
| 20 |
+
(function($) {
|
| 21 |
+
$(document).ready(function() {
|
| 22 |
+
$('input[type="submit"]').addClass('btn');
|
| 23 |
+
$('[title]').tooltip();
|
| 24 |
+
});
|
| 25 |
+
}(jQuery));
|
| 26 |
+
//]]>
|
| 27 |
+
</script>
|
| 28 |
+
|
| 29 |
+
{% load i18n %}
|
| 30 |
+
|
| 31 |
+
<!-- Container -->
|
| 32 |
+
<div class="container content">
|
| 33 |
+
|
| 34 |
+
{% if not is_popup %}
|
| 35 |
+
<div class="row">
|
| 36 |
+
<div class="col-sm-12">
|
| 37 |
+
{% block breadcrumbs %}
|
| 38 |
+
{% endblock %}
|
| 39 |
+
</div>
|
| 40 |
+
</div>
|
| 41 |
+
{% endif %}
|
| 42 |
+
|
| 43 |
+
<!-- Content -->
|
| 44 |
+
<div id="content" class="{% block coltype %}colM{% endblock %}">
|
| 45 |
+
{% block messages %}
|
| 46 |
+
{% if messages %}
|
| 47 |
+
<div class="row">
|
| 48 |
+
<div class="col-sm-12">
|
| 49 |
+
{% for message in messages %}
|
| 50 |
+
<div class="alert {{ message.tags|default:"alert-info" }}">
|
| 51 |
+
{{ message }}
|
| 52 |
+
</div>
|
| 53 |
+
{% endfor %}
|
| 54 |
+
</div>
|
| 55 |
+
</div>
|
| 56 |
+
{% endif %}
|
| 57 |
+
{% endblock messages %}
|
| 58 |
+
|
| 59 |
+
{% block pretitle %}{% endblock %}
|
| 60 |
+
{# {x% block object-tools %}{% endblock %} #}
|
| 61 |
+
{% block content %}
|
| 62 |
+
{{ content }}
|
| 63 |
+
{% endblock %}
|
| 64 |
+
{% block sidebar %}{% endblock %}
|
| 65 |
+
</div>
|
| 66 |
+
<!-- END Content -->
|
| 67 |
+
</div>
|
| 68 |
+
<!-- END Container -->
|
| 69 |
+
|
| 70 |
+
{% endblock %}
|
1327-master/_1327/templates/admin/base_bootstrap-admin.html
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends 'base.html' %}
|
| 2 |
+
|
| 3 |
+
{% block rawcontent %}
|
| 4 |
+
{{ block.super }}
|
| 5 |
+
|
| 6 |
+
{% load admin_static bootstrap_admin_template_tags i18n %}
|
| 7 |
+
|
| 8 |
+
<link rel="stylesheet" type="text/css" href="{% block stylesheet %}{% static 'admin/css/base.css' %}{% endblock %}" />
|
| 9 |
+
{% block extrastyle %}{% endblock %}
|
| 10 |
+
|
| 11 |
+
<div class="container-fluid">
|
| 12 |
+
<div class="row">
|
| 13 |
+
{% block content_container %}
|
| 14 |
+
<div id="content" class="{% if is_displaying_menu %}col-xs-6 col-xs-offset-6 col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2{% else %}col-sm-12{% endif %} main {% block coltype %}colM{% endblock %}">
|
| 15 |
+
{% block breadcrumbs %}
|
| 16 |
+
<ol class="breadcrumb">
|
| 17 |
+
<li class="home">
|
| 18 |
+
<a href="{% url 'admin:index' %}" title="{% trans 'Home' %}"><span class="glyphicon glyphicon-home"></span></a>
|
| 19 |
+
</li>
|
| 20 |
+
<li class="active">{% if title %}{{ title }}{% endif %}</li>
|
| 21 |
+
</ol>
|
| 22 |
+
{% endblock %}
|
| 23 |
+
|
| 24 |
+
{% block messages %}
|
| 25 |
+
{% if messages %}
|
| 26 |
+
{% for message in messages %}
|
| 27 |
+
<div role="alert" class="messagelist alert alert-{% if message.tags == 'info' %}success{% else %}{{ message.tags }}{% endif %} fade in">
|
| 28 |
+
<button data-dismiss="alert" class="close" type="button"><span aria-hidden="true">×</span><span class="sr-only">{% trans "Close" %}</span></button>
|
| 29 |
+
{{ message|capfirst }}
|
| 30 |
+
</div>
|
| 31 |
+
{% endfor %}
|
| 32 |
+
{% endif %}
|
| 33 |
+
{% endblock messages %}
|
| 34 |
+
|
| 35 |
+
{% block content %}
|
| 36 |
+
{% block object-tools %}{% endblock %}
|
| 37 |
+
{{ content }}
|
| 38 |
+
{% endblock %}
|
| 39 |
+
</div>
|
| 40 |
+
{% endblock content_container %}
|
| 41 |
+
</div>
|
| 42 |
+
</div>
|
| 43 |
+
|
| 44 |
+
{% block bootstrap_admin_js %}
|
| 45 |
+
<script src="{% static 'bootstrap_admin/js/bootstrap.min.js' %}"></script>
|
| 46 |
+
<script src="{% static 'bootstrap_admin/js/base.js' %}"></script>
|
| 47 |
+
{% endblock bootstrap_admin_js %}
|
| 48 |
+
|
| 49 |
+
{% block js %}{% endblock js %}
|
| 50 |
+
|
| 51 |
+
{% endblock %}
|
1327-master/_1327/templates/admin/base_site_bootstrap-admin.html
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends "admin/base.html" %}
|
| 2 |
+
|
| 3 |
+
{% block title %}{{ title }}{% endblock %}
|
| 4 |
+
|
| 5 |
+
{% block nav-global %}{% endblock %}
|
1327-master/_1327/templates/admin/change_list.html
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends "admin/base_site.html" %}
|
| 2 |
+
{% load i18n admin_urls admin_static admin_list bootstrapped_goodies_tags %}
|
| 3 |
+
|
| 4 |
+
{% block extrastyle %}
|
| 5 |
+
{{ block.super }}
|
| 6 |
+
<link rel="stylesheet" type="text/css" href="{% static "admin/css/changelists.css" %}" />
|
| 7 |
+
{% if cl.formset %}
|
| 8 |
+
<link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}" />
|
| 9 |
+
{% endif %}
|
| 10 |
+
{% if cl.formset or action_form %}
|
| 11 |
+
{% url 'admin:jsi18n' as jsi18nurl %}
|
| 12 |
+
<script type="text/javascript" src="{{ jsi18nurl|default:'../../jsi18n/' }}"></script>
|
| 13 |
+
{% endif %}
|
| 14 |
+
{{ media.css }}
|
| 15 |
+
{% endblock %}
|
| 16 |
+
|
| 17 |
+
{% block extrahead %}
|
| 18 |
+
{{ block.super }}
|
| 19 |
+
{{ media.js }}
|
| 20 |
+
{% if action_form %}{% if actions_on_top or actions_on_bottom %}
|
| 21 |
+
<script type="text/javascript">
|
| 22 |
+
(function($) {
|
| 23 |
+
$(document).ready(function($) {
|
| 24 |
+
$("tr input.action-select").actions();
|
| 25 |
+
});
|
| 26 |
+
})(django.jQuery);
|
| 27 |
+
</script>
|
| 28 |
+
{% endif %}{% endif %}
|
| 29 |
+
{% endblock %}
|
| 30 |
+
|
| 31 |
+
{% block bodyclass %}_change-list{% endblock %}
|
| 32 |
+
|
| 33 |
+
{% if not is_popup %}
|
| 34 |
+
{% block breadcrumbs %}
|
| 35 |
+
<ul class="breadcrumb">
|
| 36 |
+
<li><a href="{% url 'admin:index' %}">{% trans 'Home' %}</a></li>
|
| 37 |
+
<li><a href="{% url 'admin:app_list' app_label=cl.opts.app_label %}">{% with app_label=cl.opts.app_config.verbose_name|default:cl.opts.app_label %}{% render_with_template_if_exist app_label|lower|add:"/admin_app_name.html" app_label %}{% endwith %}</a></li>
|
| 38 |
+
<li>{{ cl.opts.verbose_name_plural|capfirst }}</li>
|
| 39 |
+
</ul>
|
| 40 |
+
{% endblock %}
|
| 41 |
+
{% endif %}
|
| 42 |
+
|
| 43 |
+
{% block coltype %}flex{% endblock %}
|
| 44 |
+
|
| 45 |
+
{% block content %}
|
| 46 |
+
{% if cl.formset.errors %}
|
| 47 |
+
<div class="alert alert-danger">
|
| 48 |
+
<p class="errornote">
|
| 49 |
+
{% blocktrans count cl.formset.errors|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
|
| 50 |
+
</p>
|
| 51 |
+
{{ cl.formset.non_form_errors }}
|
| 52 |
+
</div>
|
| 53 |
+
{% endif %}
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
{% with app_name=cl.opts.model_name|lower|slugify %}
|
| 57 |
+
{% render_with_template_if_exist cl.opts.app_label|lower|add:"/admin_app_"|add:app_name|add:"_description.html" "" %}
|
| 58 |
+
{% endwith %}
|
| 59 |
+
|
| 60 |
+
<div id="content-main">
|
| 61 |
+
<div class="module{% if cl.has_filters %} filtered{% endif %}" id="_changelist">
|
| 62 |
+
{% block date_hierarchy %}
|
| 63 |
+
{% date_hierarchy cl %}
|
| 64 |
+
{% endblock %}
|
| 65 |
+
|
| 66 |
+
{% if cl.formset %}
|
| 67 |
+
<div>{{ cl.formset.management_form }}</div>
|
| 68 |
+
{% endif %}
|
| 69 |
+
<div class="panel panel-default">
|
| 70 |
+
<div class="panel-heading">
|
| 71 |
+
{% block object-tools %}
|
| 72 |
+
<div class="btn-group">
|
| 73 |
+
{% block object-tools-items %}
|
| 74 |
+
{% if has_add_permission %}
|
| 75 |
+
{% url cl.opts|admin_urlname:'add' as add_url %}
|
| 76 |
+
<a role="button" href="{% add_preserved_filters add_url is_popup %}" class="btn btn-primary">
|
| 77 |
+
<span class="glyphicon glyphicon-plus"></span> {% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}
|
| 78 |
+
</a>
|
| 79 |
+
{% endif %}
|
| 80 |
+
{% endblock %}
|
| 81 |
+
</div>
|
| 82 |
+
|
| 83 |
+
{% if cl.has_filters %}
|
| 84 |
+
<div class="btn-group pull-right">
|
| 85 |
+
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
|
| 86 |
+
{% trans 'Filter' %} <span class="caret"></span>
|
| 87 |
+
</button>
|
| 88 |
+
<ul class="dropdown-menu scrollable-dropdown-menu">
|
| 89 |
+
{% for spec in cl.filter_specs %}
|
| 90 |
+
{% admin_list_filter cl spec %}
|
| 91 |
+
{% endfor %}
|
| 92 |
+
</ul>
|
| 93 |
+
</div>
|
| 94 |
+
{% endif %}
|
| 95 |
+
{% block search %}{% search_form cl %}{% endblock %}
|
| 96 |
+
{% endblock %}
|
| 97 |
+
</div>
|
| 98 |
+
<form id="changelist-form" action="" method="post"{% if cl.formset.is_multipart %} enctype="multipart/form-data"{% endif %}>{% csrf_token %}
|
| 99 |
+
{% block result_list %}
|
| 100 |
+
{% result_list cl %}
|
| 101 |
+
{% endblock %}
|
| 102 |
+
<div class="panel-footer">
|
| 103 |
+
{% admin_actions %}
|
| 104 |
+
</div>
|
| 105 |
+
</form>
|
| 106 |
+
</div>
|
| 107 |
+
</div>
|
| 108 |
+
</div>
|
| 109 |
+
|
| 110 |
+
{% block pagination %}
|
| 111 |
+
{% pagination cl %}
|
| 112 |
+
{% endblock %}
|
| 113 |
+
{% endblock %}
|
| 114 |
+
|
| 115 |
+
|
1327-master/_1327/templates/admin/change_list_results.html
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% load i18n admin_static %}
|
| 2 |
+
{% if result_hidden_fields %}
|
| 3 |
+
|
| 4 |
+
<div class="hiddenfields">{# DIV for HTML validation #}
|
| 5 |
+
{% for item in result_hidden_fields %}{{ item }}{% endfor %}
|
| 6 |
+
</div>
|
| 7 |
+
{% endif %}
|
| 8 |
+
{% if results %}
|
| 9 |
+
<div class="table-responsive results">
|
| 10 |
+
<table id="result_list" class="table table-striped">
|
| 11 |
+
<thead>
|
| 12 |
+
<tr>
|
| 13 |
+
{% for header in result_headers %}
|
| 14 |
+
<th scope="col" {{ header.class_attrib }}>
|
| 15 |
+
{% if header.sortable %}
|
| 16 |
+
{% if header.sort_priority > 0 %}
|
| 17 |
+
<div class="sortoptions pull-right">
|
| 18 |
+
<a class="sortremove" href="{{ header.url_remove }}" title="{% trans "Remove from sorting" %}"><span class="glyphicon glyphicon-remove"></span></a>
|
| 19 |
+
{% if num_sorted_fields > 1 %}<span class="sortpriority" title="{% blocktrans with priority_number=header.sort_priority %}Sorting priority: {{ priority_number }}{% endblocktrans %}">{{ header.sort_priority }}</span>{% endif %}
|
| 20 |
+
<a href="{{ header.url_toggle }}" class="toggle {% if header.ascending %}ascending{% else %}descending{% endif %}" title="{% trans "Toggle sorting" %}"><span class="glyphicon glyphicon-arrow-{% if header.ascending %}up{% else %}down{% endif %}"></span></a>
|
| 21 |
+
</div>
|
| 22 |
+
{% endif %}
|
| 23 |
+
{% endif %}
|
| 24 |
+
{% if header.sortable %}<a href="{{ header.url_primary }}">{{ header.text|capfirst }}</a>{% else %}<span>{{ header.text|capfirst }}</span>{% endif %}
|
| 25 |
+
</th>{% endfor %}
|
| 26 |
+
</tr>
|
| 27 |
+
</thead>
|
| 28 |
+
<tbody>
|
| 29 |
+
{% for result in results %}
|
| 30 |
+
{% if result.form.non_field_errors %}
|
| 31 |
+
<tr><td colspan="{{ result|length }}">{{ result.form.non_field_errors }}</td></tr>
|
| 32 |
+
{% endif %}
|
| 33 |
+
<tr class="{% cycle 'row1' 'row2' %}">
|
| 34 |
+
{% for item in result %}
|
| 35 |
+
{{ item }}
|
| 36 |
+
{% endfor %}
|
| 37 |
+
</tr>
|
| 38 |
+
{% endfor %}
|
| 39 |
+
</tbody>
|
| 40 |
+
</table>
|
| 41 |
+
</div>
|
| 42 |
+
{% endif %}
|
1327-master/_1327/templates/admin/index.html
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends "admin/base_site.html" %}
|
| 2 |
+
{% load i18n admin_static bootstrapped_goodies_tags %}
|
| 3 |
+
|
| 4 |
+
{% block coltype %}colMS{% endblock %}
|
| 5 |
+
|
| 6 |
+
{% block breadcrumbs %}
|
| 7 |
+
<ul class="breadcrumb">
|
| 8 |
+
<li>{% trans 'Home' %}</li>
|
| 9 |
+
</ul>
|
| 10 |
+
{% endblock %}
|
| 11 |
+
|
| 12 |
+
{% block content %}
|
| 13 |
+
<div class="row">
|
| 14 |
+
<div id="content-main" class="col-sm-12">
|
| 15 |
+
|
| 16 |
+
<div class="tabbable">
|
| 17 |
+
{% for app in app_list %}
|
| 18 |
+
{% include "admin/bootstrapped_extra/app_name.html" %}
|
| 19 |
+
{% render_app_description app %}
|
| 20 |
+
<table summary="{% blocktrans with name=app.name %}Models available in the {{ name }} application.{% endblocktrans %}" class="table table-striped table-bordered">
|
| 21 |
+
{% for model in app.models %}
|
| 22 |
+
<tr>
|
| 23 |
+
<th scope="row">
|
| 24 |
+
{% if model.admin_url %}
|
| 25 |
+
<a href="{{ model.admin_url }}">{{ model.name }}</a>
|
| 26 |
+
{% else %}
|
| 27 |
+
{{ model.name }}
|
| 28 |
+
{% endif %}
|
| 29 |
+
|
| 30 |
+
{% if model.add_url or model.admin_url%}
|
| 31 |
+
<div class="pull-right">
|
| 32 |
+
{% if model.add_url %}
|
| 33 |
+
<a href="{{ model.add_url }}" class="btn btn-xs addlink"><span class="glyphicon glyphicon-plus"></span>
|
| 34 |
+
{% trans 'Add' %}</a>
|
| 35 |
+
{% endif %}
|
| 36 |
+
{% if model.admin_url %}
|
| 37 |
+
<a href="{{ model.admin_url }}" class="btn btn-xs changelink"><span class="glyphicon glyphicon-edit"></span>
|
| 38 |
+
{% trans 'Change' %}</a>
|
| 39 |
+
{% endif %}
|
| 40 |
+
</div>
|
| 41 |
+
{% endif %}
|
| 42 |
+
</th>
|
| 43 |
+
</tr>
|
| 44 |
+
{% endfor %}
|
| 45 |
+
</table>
|
| 46 |
+
{% empty %}
|
| 47 |
+
<p>{% trans "You don't have permission to edit anything." %}</p>
|
| 48 |
+
{% endfor %}
|
| 49 |
+
</div>
|
| 50 |
+
</div>
|
| 51 |
+
</div>
|
| 52 |
+
{% endblock %}
|
| 53 |
+
|
| 54 |
+
{% block sidebar %}
|
| 55 |
+
{% endblock %}
|
1327-master/_1327/templates/admin/search_form.html
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% load i18n admin_static %}
|
| 2 |
+
{% if cl.search_fields %}
|
| 3 |
+
{% if show_result_count %}
|
| 4 |
+
<div class="pull-right">
|
| 5 |
+
<span class="small quiet">{% blocktrans count counter=cl.result_count %}{{ counter }} result{% plural %}{{ counter }} results{% endblocktrans %} (<a href="?{% if cl.is_popup %}_popup=1{% endif %}">{% blocktrans with full_result_count=cl.full_result_count %}{{ full_result_count }} total{% endblocktrans %}</a>)</span>
|
| 6 |
+
</div>
|
| 7 |
+
{% endif %}
|
| 8 |
+
<div class="pull-right">
|
| 9 |
+
<form id="changelist-search" action="" method="get">
|
| 10 |
+
<div class="input-group" style="width:300px">
|
| 11 |
+
<input type="text" class="form-control" name="{{ search_var }}" value="{{ cl.query }}" id="searchbar" />
|
| 12 |
+
<span class="input-group-btn">
|
| 13 |
+
<button title="{% trans 'Search' %}" type="submit" class="btn btn-default">
|
| 14 |
+
<i class="glyphicon glyphicon-search"></i>
|
| 15 |
+
</button>
|
| 16 |
+
</span>
|
| 17 |
+
</div>
|
| 18 |
+
{% for pair in cl.params.items %}
|
| 19 |
+
{% ifnotequal pair.0 search_var %}<input type="hidden" name="{{ pair.0 }}" value="{{ pair.1 }}"/>{% endifnotequal %}
|
| 20 |
+
{% endfor %}
|
| 21 |
+
</form>
|
| 22 |
+
</div>
|
| 23 |
+
<script type="text/javascript">document.getElementById("searchbar").focus();</script>
|
| 24 |
+
{% endif %}
|