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 image {% plural %}Add tags to {{ counter }} images{% endblocktrans %}{% endblock %}
{% block header %}
{% trans "Add tags to images" 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 image?
{% plural %}
Are you sure you want to tag the following images?
{% endblocktrans %}
</p>
<ul>
{% for image in items %}
<li>
<a href="{% url 'wagtailimages:edit' image.item.id %}" target="_blank" rel="noreferrer">{{image.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 image{% plural %}You don't have permission to add tags to these images{% endblocktrans %}
{% include 'wagtailimages/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 image to new collection {% plural %}Add {{ counter }} images to new collection{% endblocktrans %}{% endblock %}
{% block header %}
{% trans "Add images 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 image to the selected collection?
{% plural %}
Are you sure you want to add the following images to the selected collection?
{% endblocktrans %}
</p>
<ul>
{% for image in items %}
<li>
<a href="{% url 'wagtailimages:edit' image.item.id %}" target="_blank" rel="noreferrer">{{image.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 image to a collection{% plural %}You don't have permission to add these images to a collection{% endblocktrans %}
{% include 'wagtailimages/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 image{% plural %}Delete {{ counter }} images{% endblocktrans %}{% endblock %}
{% block header %}
{% trans "Delete images" 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 image?
{% plural %}
Are you sure you want to delete these images?
{% endblocktrans %}
</p>
<ul>
{% for image in items %}
<li>
<a href="{% url 'wagtailimages:edit' image.item.id %}" target="_blank" rel="noreferrer">{{image.item.title}}</a>
(<a href="{{ image.item.usage_url }}">{% blocktrans trimmed count usage_count=image.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 image{% plural %}You don't have permission to delete these images{% endblocktrans %}
{% include 'wagtailimages/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 'wagtailimages: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,20 @@
{% extends "wagtailadmin/generic/chooser/chooser.html" %}
{% load i18n wagtailadmin_tags %}
{% block filter_form %}
<form data-chooser-modal-search action="{{ results_url }}" method="GET" autocomplete="off" novalidate>
<ul class="fields">
{% for field in filter_form %}
<li>{% formattedfield field %}</li>
{% endfor %}
{% if popular_tags %}
<li class="taglist w-label-3">
<h3>{% trans 'Popular tags' %}</h3>
{% for tag in popular_tags %}
<a class="suggested-tag tag" href="{% url 'wagtailimages:index' %}?tag={{ tag.name|urlencode }}">{{ tag.name }}</a>
{% endfor %}
</li>
{% endif %}
</ul>
</form>
{% endblock %}

View File

@@ -0,0 +1,36 @@
{% load i18n wagtailadmin_tags wagtailimages_tags %}
<section id="tab-upload" class="duplicate-upload w-tabs__panel" role="tabpanel" aria-labelledby="tab-label-upload">
<p class="help-block help-warning">
{% icon name='warning' %}
{% trans "Upload successful. However, your new image seems to be a duplicate of an existing image. You may delete it if it wasn't required." %}
</p>
<figure class="duplicate-upload__figure col6">
<figcaption>{% trans "Existing" %}</figcaption>
{% image existing_image max-800x600 class="show-transparency" %}
<a href="{% url 'wagtailimages:edit' existing_image.id %}">{{ existing_image.title }}</a>
</figure>
<figure class="duplicate-upload__figure col6">
<figcaption>{% trans "New" %}</figcaption>
{% image new_image max-800x600 class="show-transparency" %}
<a href="{% url 'wagtailimages:edit' new_image.id %}">{{ new_image.title }}</a>
</figure>
<div class="duplicate-upload__actions col12">
<a href="{{ confirm_duplicate_upload_action }}" class="use-new-image button button-secondary">
{% trans 'Use new image' %}
</a>
<form method="POST">
{% csrf_token %}
<a
href="{{ cancel_duplicate_upload_action }}"
class="use-existing-image button button-longrunning"
data-controller="w-progress"
data-action="w-progress#activate"
>
{% trans "Use existing and delete new" %}
</a>
</form>
</div>
</section>

View File

@@ -0,0 +1,42 @@
{% extends "wagtailadmin/generic/chooser/results.html" %}
{% load i18n wagtailimages_tags wagtailadmin_tags %}
{% block listing_title %}<h2>{% trans "Latest images" %}</h2>{% endblock %}
{% block results_listing %}
<ul class="listing horiz images chooser">
{% for image in results %}
<li>
{% if is_multiple_choice %}
<label title="Select {% if collections %}{{ image.collection.name }} » {% endif %}{{ image.title }}">
<div class="image">{% image image max-165x165 class="show-transparency" %}</div>
<h3>
<input type="checkbox" data-multiple-choice-select name="id" value="{{ image.id }}" title="{% blocktrans trimmed with title=image.title %}Select {{ title }}{% endblocktrans %}">
{{ image.title|ellipsistrim:60 }}
</h3>
</label>
{% else %}
<a data-chooser-modal-choice class="image-choice" title="{% if collections %}{{ image.collection.name }} » {% endif %}{{ image.title }}" href="{{ image.chosen_url }}">
<div class="image">{% image image max-165x165 class="show-transparency" %}</div>
<h3>{{ image.title|ellipsistrim:60 }}</h3>
</a>
{% endif %}
</li>
{% endfor %}
</ul>
{% endblock %}
{% block no_items_message %}
<p>
{% if is_filtering_by_collection %}
{% trans "You haven't uploaded any images in this collection." %}
{% else %}
{% trans "You haven't uploaded any images." %}
{% 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,19 @@
{% load wagtailimages_tags wagtailadmin_tags %}
{% load i18n %}
{% trans "Choose a format" as choose_str %}
{% include "wagtailadmin/shared/header.html" with title=choose_str %}
<div class="row row-flush nice-padding">
<div class="col6">
{% image image max-800x600 class="show-transparency" %}
</div>
<div class="col6">
<form action="{{ select_format_action_url }}" method="POST" novalidate>
{% csrf_token %}
{% for field in form %}
{% formattedfield field %}
{% endfor %}
<input type="submit" value="{% trans 'Insert image' %}" class="button" />
</form>
</div>
</div>

View File

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

View File

@@ -0,0 +1,9 @@
{% load i18n wagtailadmin_tags wagtailimages_tags %}
{% rawformattedfield field=field %}
{% image image original as original_image %}
<a href="{{ original_image.url }}">{% icon name="image" classname="default" %}{{ image.filename }}</a> ({{ original_image.width }}x{{ original_image.height}})<br /><br />
{% trans "Change image file:" %}
{{ field }}
{% endrawformattedfield %}

View File

@@ -0,0 +1,68 @@
{% extends "wagtailadmin/base.html" %}
{% load wagtailimages_tags wagtailadmin_tags %}
{% load i18n %}
{% block titletag %}{% trans "Add an image" %}{% 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:images-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 image" as add_str %}
{% include "wagtailadmin/shared/header.html" with title=add_str icon="image" %}
<div class="nice-padding">
{% include "wagtailadmin/shared/non_field_errors.html" %}
<form action="{% url 'wagtailimages: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><input type="submit" value="{% trans 'Save' %}" class="button" /></li>
</ul>
</form>
</div>
{% endblock %}

View File

@@ -0,0 +1,22 @@
{% extends "wagtailadmin/generic/base.html" %}
{% load wagtailimages_tags i18n wagtailadmin_tags %}
{% block main_content %}
<div class="row row-flush">
<div class="col6">
{% image image max-800x600 %}
</div>
<div class="col6">
{% include "wagtailadmin/shared/usage_summary.html" %}
{% if not is_protected %}
<p>{{ view.confirmation_message }}</p>
<form action="{{ view.get_delete_url }}" method="POST">
{% csrf_token %}
<input type="hidden" value="{{ view.get_success_url }}" name="next">
<input type="submit" value="{% trans 'Yes, delete' %}" class="button serious" />
<a href="{{ view.get_success_url }}" class="button button-secondary">{% trans "No, don't delete" %}</a>
</form>
{% endif %}
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,21 @@
{% load wagtailadmin_tags wagtailimages_tags i18n %}
<div class="confirm-duplicate-upload">
<figure>
{% image existing_image max-150x150 %}
<figcaption>{{ existing_image.title }}</figcaption>
</figure>
<div>
<button
class="button button-longrunning confirm-upload"
data-controller="w-progress"
data-action="w-progress#activate"
>
{% icon name="spinner" %}{% trans 'Keep new image' %}
</button>
<form method="POST">
{% csrf_token %}
<a href="{{ delete_action }}" class="delete button no">{% trans "Delete new image" %}</a>
</form>
</div>
</div>

View File

@@ -0,0 +1,104 @@
{% extends "wagtailadmin/base.html" %}
{% load wagtailimages_tags wagtailadmin_tags i18n l10n %}
{% block titletag %}{% blocktrans trimmed with title=image.title %}Editing image {{ title }}{% endblocktrans %}{% endblock %}
{% block extra_css %}
{{ block.super }}
{{ form.media.css }}
{% endblock %}
{% block extra_js %}
{{ block.super }}
{{ form.media.js }}
<!-- Focal point chooser -->
<script src="{% versioned_static 'wagtailadmin/js/vendor/jquery.ba-throttle-debounce.min.js' %}"></script>
<script src="{% versioned_static 'wagtailimages/js/vendor/jquery.Jcrop.min.js' %}"></script>
<script src="{% versioned_static 'wagtailimages/js/focal-point-chooser.js' %}"></script>
{% endblock %}
{% block content %}
{% trans "Editing" as editing_str %}
{% include "wagtailadmin/shared/header.html" with title=editing_str subtitle=image.title icon="image" %}
{% include "wagtailadmin/shared/non_field_errors.html" %}
<form action="{% url 'wagtailimages:edit' image.id %}" method="POST" enctype="multipart/form-data" novalidate>
{% csrf_token %}
<input type="hidden" value="{{ next }}" name="next">
<div class="row row-flush nice-padding">
<div class="col6">
{% for field in form %}
{% if field.name == 'file' %}
{% include "wagtailimages/images/_file_field.html" %}
{% elif field.is_hidden %}
{{ field }}
{% else %}
{% formattedfield field %}
{% endif %}
{% endfor %}
<div class="w-hidden sm:w-block">
<input type="submit" value="{% trans 'Save' %}" class="button" />
{% if user_can_delete %}
<a href="{% url 'wagtailimages:delete' image.id %}{% if next %}?next={{ next|urlencode }}{% endif %}" class="button no">{% trans "Delete image" %}</a>
{% endif %}
</div>
</div>
<div class="col6">
{% image image max-800x600 as rendition %}
<div
class="focal-point-chooser"
style="max-width: {{ rendition.width }}px; max-height: {{ rendition.height }}px;"
data-focal-point-x="{{ image.focal_point_x|default_if_none:''|unlocalize }}"
data-focal-point-y="{{ image.focal_point_y|default_if_none:''|unlocalize }}"
data-focal-point-width="{{ image.focal_point_width|default_if_none:''|unlocalize }}"
data-focal-point-height="{{ image.focal_point_height|default_if_none:''|unlocalize }}"
data-focal-input-label="{% trans 'Image focal point' %}"
>
<img {{ rendition.attrs }} decoding="async" data-original-width="{{ image.width|unlocalize }}" data-original-height="{{ image.height|unlocalize }}" class="show-transparency">
<div class="current-focal-point-indicator{% if not image.has_focal_point %} hidden{% endif %}"></div>
</div>
{% if url_generator_enabled %}
<a href="{% url 'wagtailimages:url_generator' image.id %}" class="button bicolor button--icon">{% icon name="link" wrapped=1 %}{% trans "URL Generator" %}</a>
<hr />
{% endif %}
<div class="row">
<div class="col8">
<h2 class="w-label-3">{% trans "Focal point" %} <span class="w-font-normal">{% trans "(optional)" %}</span></h2>
<p>{% trans "To define this image's most important region, drag a box over the image above." %} {% if image.has_focal_point %}({% trans "Current focal point shown" %}){% endif %}</p>
<button class="button button-secondary no remove-focal-point" type="button">{% trans "Remove focal area" %}</button>
</div>
<div class="col4">
{% image image original as original_image %}
<dl>
<dt>{% trans "Max dimensions" %}</dt>
<dd>{{ original_image.width }}x{{ original_image.height }}</dd>
<dt>{% trans "Filesize" %}</dt>
<dd>{% if filesize %}{{ filesize|filesizeformat }}{% else %}{% trans "File not found" %}{% endif %}</dd>
<dt>{% trans "Usage" %}</dt>
<dd>
<a href="{{ image.usage_url }}">{% blocktrans trimmed count usage_count=image.get_usage.count %}Used {{ usage_count }} time{% plural %}Used {{ usage_count }} times{% endblocktrans %}</a>
</dd>
</dl>
</div>
</div>
</div>
</div>
<div class="row row-flush nice-padding sm:!w-hidden">
<div class="col5">
<input type="submit" value="{% trans 'Save' %}" class="button" />
{% if user_can_delete %}
<a href="{% url 'wagtailimages:delete' image.id %}{% if next %}?next={{ next }}{% endif %}" class="button no">{% trans "Delete image" %}</a>
{% endif %}
</div>
</div>
</form>
{% endblock %}

View File

@@ -0,0 +1,6 @@
{% extends "wagtailadmin/shared/headers/slim_header.html" %}
{% load wagtailadmin_tags %}
{% block extra_form_fields %}
{{ extra_form_fields }}
{% endblock %}

View File

@@ -0,0 +1,28 @@
{% extends "wagtailadmin/generic/index.html" %}
{% load wagtailadmin_tags wagtailimages_tags i18n %}
{% block extra_js %}
{{ block.super }}
<script>
window.wagtailConfig.BULK_ACTION_ITEM_TYPE = 'IMAGE';
</script>
<script defer src="{% versioned_static 'wagtailadmin/js/bulk-actions.js' %}"></script>
{% endblock %}
{% block slim_header %}
{% fragment as extra_form_fields %}
{% rawformattedfield label_text=_("Sort by") id_for_label="order_images_by" sr_only_label=True %}
<select id="order_images_by" name="ordering">
{% for ordering, ordering_text in ORDERING_OPTIONS.items %}
<option value="{{ ordering }}" {% if current_ordering == ordering %}selected="selected"{% endif %}>{{ ordering_text }}</option>
{% endfor %}
</select>
{% endrawformattedfield %}
{% endfragment %}
{% include "wagtailimages/images/image_listing_header.html" with breadcrumbs_items=breadcrumbs_items side_panels=side_panels history_url=history_url title=header_title search_url=index_results_url search_form=search_form filters=filters buttons=header_buttons icon_name=header_icon extra_form_fields=extra_form_fields only %}
{% endblock %}
{% block bulk_actions %}
{% trans "Select all images 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,38 @@
{% extends "wagtailadmin/generic/index_results.html" %}
{% load wagtailimages_tags wagtailadmin_tags %}
{% load i18n l10n %}
{% block results %}
<div class="nice-padding">
<ul class="listing horiz images">
{% for image in object_list %}
<li>
{% fragment as title_id %}image_{{ image.pk|unlocalize|admin_urlquote }}_title{% endfragment %}
{% include "wagtailadmin/bulk_actions/listing_checkbox_cell.html" with obj_type="image" instance=image aria_describedby=title_id only %}
<a class="image-choice" title="{% if collections %}{{ image.collection.name }} » {% endif %}{{ image.title }}" href="{% url view.edit_url_name image.id %}{% if next %}?next={{ next|urlencode }}{% endif %}">
<figure>
{% include "wagtailimages/images/results_image.html" %}
<figcaption id="{{ title_id }}">
{{ image.title|ellipsistrim:60 }}
</figcaption>
</figure>
</a>
</li>
{% endfor %}
</ul>
</div>
{% endblock %}
{% block no_results_message %}
{% if is_searching %}
<h2 role="alert">{% blocktrans trimmed %}Sorry, no images match "<em>{{ query_string }}</em>"{% endblocktrans %}</h2>
{% else %}
{% with wagtailimages_add_image_url=add_url %}
{% if current_collection %}
<p>{% blocktrans trimmed %}You haven't uploaded any images in this collection. Why not <a href="{{ wagtailimages_add_image_url }}">upload one now</a>?{% endblocktrans %}</p>
{% else %}
<p>{% blocktrans trimmed %}You haven't uploaded any images. Why not <a href="{{ wagtailimages_add_image_url }}">upload one now</a>?{% endblocktrans %}</p>
{% endif %}
{% endwith %}
{% endif %}
{% endblock %}

View File

@@ -0,0 +1,18 @@
{% comment %}
Separated out of results.html to prevent invalid images from crashing the entire
images listing. (issue #1805)
If an error is raised inside a template include, the error is caught by the
calling {% include %} tag and the contents blanked out.
This behaviour caused a confusing error on the images listing view where it
would go blank if one of the images was invalid.
Separating the image rendering code into this file allows us to limit Django's
crash/blanking behaviour to a single image so the listing can still be used when
the issue occurs.
{% endcomment %}
{% load wagtailimages_tags %}
<div class="image">{% image image max-165x165 class="show-transparency" alt="" %}</div>

View File

@@ -0,0 +1,58 @@
{% extends "wagtailadmin/generic/base.html" %}
{% load wagtailimages_tags wagtailadmin_tags i18n %}
{% block extra_css %}
<style>
.loading-mask {
max-height: clamp(25rem, 50vh, 50rem);
}
</style>
{% endblock %}
{% block main_content %}
<div class="w-image-url-generator nice-padding" data-generator-url="{% url 'wagtailimages:generate_url' object.id '__filterspec__' %}">
<form class="w-image-url-generator__form w-mb-5">
{% include "wagtailadmin/shared/field.html" with field=form.filter_method %}
{% field_row max_content=True %}
{% include "wagtailadmin/shared/field.html" with field=form.width %}
{% include "wagtailadmin/shared/field.html" with field=form.height %}
{% include "wagtailadmin/shared/field.html" with field=form.closeness %}
{% endfield_row %}
</form>
{% trans "Preview" as heading %}
{% panel id="preview" icon="view" heading=heading %}
<div class="w-image-url-generator__preview">
<div class="loading-mask w-block w-border-2 w-border-border-furniture w-overflow-scroll w-p-4 w-rounded-sm">
<img class="preview w-max-w-none" src="" alt="{% trans 'Preview' %}" />
</div>
</div>
{% endpanel %}
{% trans "URL" as heading %}
{% panel id="url" heading=heading %}
<div class="w-relative" data-controller="w-clipboard w-clone" data-w-clone-auto-clear-value="5_000" data-action="w-clipboard:copy->w-clone#clear w-clipboard:copied->w-clone#add w-clipboard:error->w-clone#add">
<label class="w-sr-only" for="result-url">{% trans "Image URL" %}</label>
<textarea class="w-image-url-generator__url" id="result-url" rows="1" name="result-url" data-controller="w-action" data-action="focus->w-action#select" data-w-clipboard-target="value">
</textarea>
<button type="button" class="button button-secondary w-absolute w-top-3.5 w-right-3 w-bottom-auto w-left-auto" data-action="w-clipboard#copy" aria-describedby="clipboard-tooltip">
{% trans "Copy URL" %}
</button>
<div class="clipboard-tooltip" data-w-clone-target="container" id="clipboard-tooltip" aria-atomic="true" aria-live="polite"></div>
<template data-w-clone-target="template" data-type="success">
<span class="w-text-grey-50 w-absolute w-right-2 w-bg-positive-100 w-p-2 w-rounded-sm">{% trans 'Copied to clipboard' %}</span>
</template>
<template data-w-clone-target="template" data-type="error">
<span class="w-text-grey-50 w-absolute w-right-2 w-bg-critical-100 w-p-2 w-rounded-sm">{% trans 'Copying to clipboard failed' %}</span>
</template>
</div>
{% endpanel %}
</div>
{% endblock %}
{% block extra_js %}
{{ block.super }}
<script src="{% versioned_static 'wagtailadmin/js/vendor/jquery.ba-throttle-debounce.min.js' %}"></script>
<script src="{% versioned_static 'wagtailimages/js/image-url-generator.js' %}"></script>
{% endblock %}

View File

@@ -0,0 +1,109 @@
{% extends "wagtailadmin/base.html" %}
{% load i18n %}
{% load l10n %}
{% load wagtailadmin_tags wagtailimages_tags %}
{% block titletag %}{% trans "Add multiple images" %}{% endblock %}
{% block extra_css %}
{{ block.super }}
{{ form_media.css }}
{% endblock %}
{% block content %}
{% trans "Add images" as add_str %}
{% include "wagtailadmin/shared/header.html" with title=add_str icon="image" %}
<div class="nice-padding">
<div class="drop-zone">
<p>{% trans "Drag and drop images into this area to upload immediately." %}</p>
<p>{{ help_text }}</p>
<form action="{% url 'wagtailimages: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 'wagtailimages:add_multiple' %}" multiple>
</div>
{% csrf_token %}
{% if collections %}
{% trans "Add to collection:" as label_text %}
{% rawformattedfield label_text=label_text id_for_label="id_addimage_collection" classname="w-mx-auto w-mt-4 w-grid w-justify-center" %}
<select id="id_addimage_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="thumb">
{% icon name="image" %}
</div>
<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 image with a more appropriate title, if necessary. You may also delete the image completely if the upload wasn't required." %}</p>
<p class="status-msg warning">
{% trans "Upload successful. However, your new image seems to be a duplicate of this existing image. You may delete it if it wasn't required." %}
</p>
<p class="status-msg failure">{% trans "Sorry, upload failed." %}</p>
<p class="status-msg server-error">
<strong>{% trans "Server Error" %}</strong>
{% trans "Report this error to your website administrator with the following information:"%}
<br /><span class="error-text"></span> - <span class="error-code"></span>
</p>
<p class="status-msg update-success">{% trans "Image 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 'wagtailimages/js/vendor/load-image.min.js' %}"></script>
<script src="{% versioned_static 'wagtailimages/js/vendor/canvas-to-blob.min.js' %}"></script>
<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 'wagtailimages/js/vendor/jquery.fileupload-image.js' %}"></script>
<script src="{% versioned_static 'wagtailimages/js/vendor/jquery.fileupload-validate.js' %}"></script>
<script src="{% versioned_static 'wagtailadmin/js/vendor/tag-it.js' %}"></script>
<!-- Main script -->
<script src="{% versioned_static 'wagtailimages/js/add-multiple.js' %}"></script>
<script>
window.fileupload_opts = {
simple_upload_url: "{% url 'wagtailimages:add' %}",
accepted_file_types: /\.({{ allowed_extensions|join:"|" }})$/i, //must be regex
max_file_size: {{ max_filesize|stringformat:"s"|default:"null" }}, //numeric format
max_title_length: {{ max_title_length|stringformat:"s"|default:"null" }}, //numeric format
errormessages: {
max_file_size: "{{ error_max_file_size|escapejs }}",
accepted_file_types: "{{ error_accepted_file_types|escapejs }}"
}
}
</script>
{% endblock %}

View File

@@ -0,0 +1,6 @@
{% extends "wagtailadmin/permissions/includes/collection_member_permissions_formset.html" %}
{% load i18n %}
{% block icon %}image{% endblock %}
{% block title %}{% trans "Image permissions" %}{% endblock %}
{% block add_button_label %}{% trans "Add an image permission" %}{% endblock %}

View File

@@ -0,0 +1,38 @@
{% load wagtailimages_tags %}
{% if image_a != image_b %}
{% if image_a and image_b %}
{# Image has changed #}
<div class="preview-image deletion">
{% image image_a max-165x165 class="show-transparency" %}
</div>
<div class="preview-image addition">
{% image image_b max-165x165 class="show-transparency" %}
</div>
{% elif image_b %}
{# Image has been added #}
<div class="preview-image addition">
{% image image_b max-165x165 class="show-transparency" %}
</div>
{% elif image_a %}
{# Image has been removed #}
<div class="preview-image deletion">
{% image image_a max-165x165 class="show-transparency" %}
</div>
{% endif %}
{% else %}
<div class="preview-image">
{% if image_a %}
{% image image_a max-165x165 class="show-transparency" %}
{% else %}
<img alt="">
{% endif %}
</div>
{% endif %}

View File

@@ -0,0 +1,6 @@
{% extends "wagtailadmin/widgets/chooser.html" %}
{% block chosen_icon %}
{# Empty alt because the chosen items title is already displayed next to the image. #}
<img class="chooser__image" data-chooser-image alt="" class="show-transparency" decoding="async" height="{{ preview.height }}" src="{{ preview.url }}" width="{{ preview.width }}">
{% endblock chosen_icon %}