Initial commit

This commit is contained in:
2024-08-27 20:33:44 +02:00
commit 1f1832267d
14794 changed files with 1599592 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
{% extends 'wagtailadmin/bulk_actions/confirmation/base.html' %}
{% load i18n %}
{% load wagtailimages_tags wagtailadmin_tags %}
{% block titletag %}{% blocktrans trimmed count counter=items|length %}Add tags to 1 document {% plural %}Add tags to {{ counter }} documents{% endblocktrans %}{% endblock %}
{% block header %}
{% trans "Add tags to documents" as add_str %}
{% include "wagtailadmin/shared/header.html" with title=add_str icon="doc-full-inverse" %}
{% endblock header %}
{% block items_with_access %}
{% if items %}
<p>
{% blocktrans trimmed count counter=items|length %}
Are you sure you want to tag the following document?
{% plural %}
Are you sure you want to tag the following documents?
{% endblocktrans %}
</p>
<ul>
{% for document in items %}
<li>
<a href="{% url 'wagtaildocs:edit' document.item.id %}" target="_blank" rel="noreferrer">{{document.item.title}}</a>
</li>
{% endfor %}
</ul>
{% endif %}
{% endblock items_with_access %}
{% block items_with_no_access %}
{% blocktrans trimmed asvar no_access_msg count counter=items_with_no_access|length %}You don't have permission to add tags to this document{% plural %}You don't have permission to add tags to these documents{% endblocktrans %}
{% include 'wagtaildocs/bulk_actions/list_items_with_no_access.html' with items=items_with_no_access no_access_msg=no_access_msg %}
{% endblock items_with_no_access %}
{% block form_section %}
{% if items %}
{% trans 'Yes, add' as action_button_text %}
{% trans "No, don't add" as no_action_button_text %}
{% include 'wagtailadmin/bulk_actions/confirmation/form_with_fields.html' %}
{% else %}
{% include 'wagtailadmin/bulk_actions/confirmation/go_back.html' %}
{% endif %}
{% endblock form_section %}

View File

@@ -0,0 +1,45 @@
{% extends 'wagtailadmin/bulk_actions/confirmation/base.html' %}
{% load i18n %}
{% load wagtailimages_tags wagtailadmin_tags %}
{% block titletag %}{% blocktrans trimmed count counter=items|length %}Add 1 document to new collection {% plural %}Add {{ counter }} documents to new collection{% endblocktrans %}{% endblock %}
{% block header %}
{% trans "Add documents to collection" as add_str %}
{% include "wagtailadmin/shared/header.html" with title=add_str icon="doc-full-inverse" %}
{% endblock header %}
{% block items_with_access %}
{% if items %}
<p>
{% blocktrans trimmed count counter=items|length %}
Are you sure you want to add the following document to the selected collection?
{% plural %}
Are you sure you want to add the following documents to the selected collection?
{% endblocktrans %}
</p>
<ul>
{% for document in items %}
<li>
<a href="{% url 'wagtaildocs:edit' document.item.id %}" target="_blank" rel="noreferrer">{{document.item.title}}</a>
</li>
{% endfor %}
</ul>
{% endif %}
{% endblock items_with_access %}
{% block items_with_no_access %}
{% blocktrans trimmed asvar no_access_msg count counter=items_with_no_access|length %}You don't have permission to add this document to a collection{% plural %}You don't have permission to add these documents to a collection{% endblocktrans %}
{% include 'wagtaildocs/bulk_actions/list_items_with_no_access.html' with items=items_with_no_access no_access_msg=no_access_msg %}
{% endblock items_with_no_access %}
{% block form_section %}
{% if items %}
{% trans 'Yes, add' as action_button_text %}
{% trans "No, don't add" as no_action_button_text %}
{% include 'wagtailadmin/bulk_actions/confirmation/form_with_fields.html' %}
{% else %}
{% include 'wagtailadmin/bulk_actions/confirmation/go_back.html' %}
{% endif %}
{% endblock form_section %}

View File

@@ -0,0 +1,45 @@
{% extends 'wagtailadmin/bulk_actions/confirmation/base.html' %}
{% load wagtailadmin_tags i18n %}
{% block titletag %}{% blocktrans trimmed count counter=items|length %}Delete 1 document {% plural %}Delete {{ counter }} documents{% endblocktrans %}{% endblock %}
{% block header %}
{% trans "Delete documents" as del_str %}
{% include "wagtailadmin/shared/header.html" with title=del_str icon="doc-full-inverse" %}
{% endblock header %}
{% block items_with_access %}
{% if items %}
<p>
{% blocktrans trimmed count counter=items|length %}
Are you sure you want to delete this document?
{% plural %}
Are you sure you want to delete these documents?
{% endblocktrans %}
</p>
<ul>
{% for document in items %}
<li>
<a href="{% url 'wagtaildocs:edit' document.item.id %}" target="_blank" rel="noreferrer">{{document.item.title}}</a>
(<a href="{{ document.item.usage_url }}">{% blocktrans trimmed count usage_count=document.item.get_usage.count %}Used {{ usage_count }} time{% plural %}Used {{ usage_count }} times{% endblocktrans %}</a>)
</li>
{% endfor %}
</ul>
{% endif %}
{% endblock items_with_access %}
{% block items_with_no_access %}
{% blocktrans trimmed asvar no_access_msg count counter=items_with_no_access|length %}You don't have permission to delete this document{% plural %}You don't have permission to delete these documents{% endblocktrans %}
{% include 'wagtaildocs/bulk_actions/list_items_with_no_access.html' with items=items_with_no_access no_access_msg=no_access_msg %}
{% endblock items_with_no_access %}
{% block form_section %}
{% if items %}
{% trans 'Yes, delete' as action_button_text %}
{% trans "No, don't delete" as no_action_button_text %}
{% include 'wagtailadmin/bulk_actions/confirmation/form.html' with action_button_class="serious" %}
{% else %}
{% include 'wagtailadmin/bulk_actions/confirmation/go_back.html' %}
{% endif %}
{% endblock form_section %}

View File

@@ -0,0 +1,10 @@
{% extends 'wagtailadmin/bulk_actions/confirmation/list_items_with_no_access.html' %}
{% load i18n %}
{% block per_item %}
{% if item.can_edit %}
<a href="{% url 'wagtaildocs:edit' item.item.id %}" target="_blank" rel="noreferrer">{{ item.item.title }}</a>
{% else %}
{{ item.item.title }}
{% endif %}
{% endblock per_item %}

View File

@@ -0,0 +1,23 @@
{% extends "wagtailadmin/generic/chooser/results.html" %}
{% load i18n wagtailadmin_tags %}
{% block listing_title %}<h2>{% trans "Latest documents" %}</h2>{% endblock %}
{% block no_search_results_message %}
<p role="alert">{% blocktrans trimmed %}Sorry, no documents match "<em>{{ search_query }}</em>"{% endblocktrans %}</p>
{% endblock %}
{% block no_items_message %}
<p>
{% if is_filtering_by_collection %}
{% trans "You haven't uploaded any documents in this collection." %}
{% else %}
{% trans "You haven't uploaded any documents." %}
{% endif %}
{% if can_create %}
{% blocktrans trimmed %}
Why not <a class="upload-one-now" href="#tab-upload" data-tab-trigger>upload one now</a>?
{% endblocktrans %}
{% endif %}
</p>
{% endblock %}

View File

@@ -0,0 +1,10 @@
{% if value is None %}
{{ value }}
{% else %}
<a href="{{ value.url }}">
{{ value.title }}
<span class="meta">
({{ value.file_extension|upper }}, {{ value.file.size|filesizeformat }})
</span>
</a>
{% endif %}

View File

@@ -0,0 +1,6 @@
{% load i18n wagtailadmin_tags %}
{% rawformattedfield field=field %}
<a href="{{ document.url }}">{% icon name="doc-full-inverse" classname="default" %}{{ document.filename }}</a><br /><br />
{% trans "Change document:" %}
{{ field }}
{% endrawformattedfield %}

View File

@@ -0,0 +1,78 @@
{% extends "wagtailadmin/base.html" %}
{% load i18n %}
{% load wagtailimages_tags wagtailadmin_tags %}
{% block titletag %}{% trans "Add a document" %}{% endblock %}
{% block extra_js %}
{{ block.super }}
{{ form.media.js }}
<script>
$(function() {
$('#id_file').on(
'change',
function() {
var $titleField = $('#id_title');
// do not override a title that already exists (from manual editing or previous upload)
if ($titleField.val()) return;
// file widget value example: `C:\fakepath\image.jpg` - convert to just the filename part
var filename = $(this).val().split('\\').slice(-1)[0];
var data = { title: filename.replace(/\.[^.]+$/, '') };
var maxTitleLength = parseInt($titleField.attr('maxLength') || '0', 10) || null;
// allow an event handler to customise data or call event.preventDefault to stop any title pre-filling
var form = $(this).closest('form').get(0);
var event = form.dispatchEvent(new CustomEvent(
'wagtail:documents-upload',
{ bubbles: true, cancelable: true, detail: { data: data, filename: filename, maxTitleLength: maxTitleLength } }
));
if (!event) return; // do not set a title if event.preventDefault(); is called by handler
$titleField.val(data.title);
}
);
});
</script>
{% endblock %}
{% block extra_css %}
{{ block.super }}
{{ form.media.css }}
{% endblock %}
{% block content %}
{% trans "Add document" as add_str %}
{% include "wagtailadmin/shared/header.html" with title=add_str icon="doc-full-inverse" %}
<div class="nice-padding">
{% include "wagtailadmin/shared/non_field_errors.html" %}
<form action="{% url 'wagtaildocs:add' %}" method="POST" enctype="multipart/form-data" novalidate>
{% csrf_token %}
<ul class="fields">
{% for field in form %}
{% if field.is_hidden %}
{{ field }}
{% else %}
<li>{% formattedfield field %}</li>
{% endif %}
{% endfor %}
<li>
<button
type="submit"
class="button button-longrunning"
data-controller="w-progress"
data-action="w-progress#activate"
data-w-progress-active-value="{% trans 'Uploading…' %}"
>
{% icon name="spinner" %}
<em data-w-progress-target="label">{% trans 'Upload' %}</em>
</button>
</li>
</ul>
</form>
</div>
{% endblock %}

View File

@@ -0,0 +1,61 @@
{% extends "wagtailadmin/base.html" %}
{% load i18n %}
{% load wagtailimages_tags wagtailadmin_tags %}
{% block titletag %}{% blocktrans trimmed with title=document.title %}Editing {{ title }}{% endblocktrans %}{% endblock %}
{% block extra_js %}
{{ block.super }}
{{ form.media.js }}
{% endblock %}
{% block extra_css %}
{{ block.super }}
{{ form.media.css }}
{% endblock %}
{% block content %}
{% trans "Editing" as editing_str %}
{% include "wagtailadmin/shared/header.html" with title=editing_str subtitle=document.title icon="doc-full-inverse" %}
{% include "wagtailadmin/shared/non_field_errors.html" %}
<div class="row row-flush nice-padding">
<div class="col10">
<form action="{% url 'wagtaildocs:edit' document.id %}" method="POST" enctype="multipart/form-data" novalidate>
{% csrf_token %}
<input type="hidden" value="{{ next }}" name="next">
<ul class="fields">
{% for field in form %}
{% if field.name == 'file' %}
<li>{% include "wagtaildocs/documents/_file_field.html" %}</li>
{% elif field.is_hidden %}
{{ field }}
{% else %}
<li>{% formattedfield field %}</li>
{% endif %}
{% endfor %}
<li>
<input type="submit" value="{% trans 'Save' %}" class="button" />
{% if user_can_delete %}
<a href="{% url 'wagtaildocs:delete' document.id %}{% if next %}?next={{ next|urlencode }}{% endif %}" class="button no">{% trans "Delete document" %}</a>
{% endif %}
</li>
</ul>
</form>
</div>
<div class="col2">
<dl>
{% if document.file %}
<dt>{% trans "Filesize" %}</dt>
<dd>{% if filesize %}{{ filesize|filesizeformat }}{% else %}{% trans "File not found" %}{% endif %}</dd>
{% endif %}
<dt>{% trans "Usage" %}</dt>
<dd>
<a href="{{ document.usage_url }}">{% blocktrans trimmed count usage_count=document.get_usage.count %}Used {{ usage_count }} time{% plural %}Used {{ usage_count }} times{% endblocktrans %}</a>
</dd>
</dl>
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,15 @@
{% extends "wagtailadmin/generic/index.html" %}
{% load wagtailadmin_tags i18n %}
{% block extra_js %}
{{ block.super }}
<script>
window.wagtailConfig.BULK_ACTION_ITEM_TYPE = 'DOCUMENT';
</script>
<script defer src="{% versioned_static 'wagtailadmin/js/bulk-actions.js' %}"></script>
{% endblock %}
{% block bulk_actions %}
{% trans "Select all documents in listing" as select_all_text %}
{% include 'wagtailadmin/bulk_actions/footer.html' with select_all_obj_text=select_all_text app_label=model_opts.app_label model_name=model_opts.model_name objects=page_obj parent=current_collection.id %}
{% endblock %}

View File

@@ -0,0 +1,16 @@
{% extends "wagtailadmin/generic/index_results.html" %}
{% load i18n wagtailadmin_tags %}
{% block no_results_message %}
{% if is_searching %}
<h2 role="alert">{% blocktrans trimmed %}Sorry, no documents match "<em>{{ query_string }}</em>"{% endblocktrans %}</h2>
{% else %}
{% with wagtaildocs_add_document_url=add_url %}
{% if current_collection %}
<p>{% blocktrans trimmed %}You haven't uploaded any documents in this collection. Why not <a href="{{ wagtaildocs_add_document_url }}">upload one now</a>?{% endblocktrans %}</p>
{% else %}
<p>{% blocktrans trimmed %}You haven't uploaded any documents. Why not <a href="{{ wagtaildocs_add_document_url }}">upload one now</a>?{% endblocktrans %}</p>
{% endif %}
{% endwith %}
{% endif %}
{% endblock %}

View File

@@ -0,0 +1,12 @@
{% load i18n wagtailadmin_tags %}
<li>
{% icon name="doc-full" %}
<a href="{% url 'wagtaildocs:index' %}">
{% blocktrans trimmed count counter=total_docs with total_docs|intcomma as total %}
<span>{{ total }}</span> Document <span class="w-sr-only">created in {{ site_name }}</span>
{% plural %}
<span>{{ total }}</span> Documents <span class="w-sr-only">created in {{ site_name }}</span>
{% endblocktrans %}
</a>
</li>

View File

@@ -0,0 +1,88 @@
{% extends "wagtailadmin/base.html" %}
{% load i18n %}
{% load l10n %}
{% load wagtailadmin_tags %}
{% block titletag %}{% trans "Add multiple documents" %}{% endblock %}
{% block extra_css %}
{{ block.super }}
{{ form_media.css }}
{% endblock %}
{% block content %}
{% trans "Add documents" as add_str %}
{% include "wagtailadmin/shared/header.html" with title=add_str icon="doc-full-inverse" %}
<div class="nice-padding">
<div class="drop-zone">
<p>{% trans "Drag and drop documents into this area to upload immediately." %}</p>
<p>{{ help_text }}</p>
<form action="{% url 'wagtaildocs:add_multiple' %}" method="POST" enctype="multipart/form-data">
<div class="replace-file-input">
<button class="button bicolor button--icon">{% icon name="plus" wrapped=1 %}{% trans "Or choose from your computer" %}</button>
<input id="fileupload" type="file" name="files[]" data-url="{% url 'wagtaildocs:add_multiple' %}" multiple>
</div>
{% csrf_token %}
{% if collections %}
{% trans "Add to collection:" as label_text %}
{% rawformattedfield label_text=label_text id_for_label="id_adddocument_collection" classname="w-mx-auto w-mt-4 w-grid w-justify-center" %}
<select id="id_adddocument_collection" name="collection">
{% for pk, display_name in collections.get_indented_choices %}
<option value="{{ pk|unlocalize }}"{% if pk|unlocalize == selected_collection_id %} selected{% endif %}>
{{ display_name }}
</option>
{% endfor %}
</select>
{% endrawformattedfield %}
{% endif %}
</form>
</div>
<div id="overall-progress" class="progress progress-secondary">
<div class="bar" style="width: 0%;">0%</div>
</div>
<ul id="upload-list" class="upload-list multiple"></ul>
</div>
<template id="upload-list-item">
<li class="row">
<div class="left col3">
<div class="preview">
<div class="progress">
<div class="bar" style="width: 0%;"></div>
</div>
</div>
</div>
<div class="right col9">
<p class="status-msg success">{% trans "Upload successful. Please update this document with a more appropriate title, if necessary. You may also delete the document completely if the upload wasn't required." %}</p>
<p class="status-msg failure">{% trans "Sorry, upload failed." %}</p>
<p class="status-msg update-success">{% trans "Document updated." %}</p>
<p class="status-msg failure error_messages"></p>
</div>
</li>
</template>
{% endblock %}
{% block extra_js %}
{{ block.super }}
{{ form_media.js }}
<!-- this exact order of plugins is vital -->
<script src="{% versioned_static 'wagtailadmin/js/vendor/jquery.iframe-transport.js' %}"></script>
<script src="{% versioned_static 'wagtailadmin/js/vendor/jquery.fileupload.js' %}"></script>
<script src="{% versioned_static 'wagtailadmin/js/vendor/jquery.fileupload-process.js' %}"></script>
<script src="{% versioned_static 'wagtailadmin/js/vendor/tag-it.js' %}"></script>
<!-- Main script -->
<script src="{% versioned_static 'wagtaildocs/js/add-multiple.js' %}"></script>
<script>
window.fileupload_opts = {
max_title_length: {{ max_title_length|stringformat:"s"|default:"null" }}, //numeric format
simple_upload_url: "{% url 'wagtaildocs:add' %}"
}
</script>
{% endblock %}

View File

@@ -0,0 +1,6 @@
{% extends "wagtailcore/password_required.html" %}
{% load i18n %}
{% block password_required_message %}
<p>{% trans "You need a password to access this document." %}</p>
{% endblock %}

View File

@@ -0,0 +1,6 @@
{% extends "wagtailadmin/permissions/includes/collection_member_permissions_formset.html" %}
{% load i18n %}
{% block icon %}doc-full-inverse{% endblock %}
{% block title %}{% trans "Document permissions" %}{% endblock %}
{% block add_button_label %}{% trans "Add a document permission" %}{% endblock %}