From 6f2f28a3a752cc47d9dc96bda862ed67cd75c9af Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Thu, 1 Dec 2022 18:46:49 -0700 Subject: Image attachment uploads --- templates/activities/_image_upload.html | 15 +++++++++++++++ templates/activities/_image_uploaded.html | 19 +++++++++++++++++++ templates/activities/_post.html | 2 +- templates/activities/compose.html | 18 +++++++++++++++++- 4 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 templates/activities/_image_upload.html create mode 100644 templates/activities/_image_uploaded.html (limited to 'templates/activities') diff --git a/templates/activities/_image_upload.html b/templates/activities/_image_upload.html new file mode 100644 index 0000000..974884a --- /dev/null +++ b/templates/activities/_image_upload.html @@ -0,0 +1,15 @@ +
+ {% csrf_token %} + {% include "forms/_field.html" with field=form.image %} + {% include "forms/_field.html" with field=form.description %} +
+ + +
+
diff --git a/templates/activities/_image_uploaded.html b/templates/activities/_image_uploaded.html new file mode 100644 index 0000000..ad03120 --- /dev/null +++ b/templates/activities/_image_uploaded.html @@ -0,0 +1,19 @@ +
+ + +

+ {{ attachment.name|default:"(no description)" }} +

+
+ Remove +
+
+{% if request.htmx %} + + Add Image + +{% endif %} diff --git a/templates/activities/_post.html b/templates/activities/_post.html index 1c3008b..2c84a02 100644 --- a/templates/activities/_post.html +++ b/templates/activities/_post.html @@ -73,7 +73,7 @@
{% for attachment in post.attachments.all %} {% if attachment.is_image %} - + {% endif %} {% endfor %}
diff --git a/templates/activities/compose.html b/templates/activities/compose.html index 4809177..7065863 100644 --- a/templates/activities/compose.html +++ b/templates/activities/compose.html @@ -17,8 +17,24 @@ {% include "forms/_field.html" with field=form.content_warning %} {% include "forms/_field.html" with field=form.visibility %} +
+ Images + {% if post %} + {% for attachment in post.attachments.all %} + {% include "activities/_image_uploaded.html" %} + {% endfor %} + {% endif %} + {% if not post or post.attachments.count < 4 %} + + Add Image + + {% endif %} +
- +
{% endblock %} -- cgit v1.2.3