diff --git a/faction/views.py b/faction/views.py index 98c600f8..5a64ce0b 100644 --- a/faction/views.py +++ b/faction/views.py @@ -17,6 +17,7 @@ import csv import datetime +import glob import html import json import math @@ -311,7 +312,7 @@ def configurations(request): context["validMessageSub"] = "Poster header uploaded" else: context["errorMessageSub"] = "Error uploading the image (size should be < 500kb)" - if request.POST.get("upload_tail"): + elif request.POST.get("upload_tail"): form = PosterTailForm(request.POST, request.FILES, instance=faction) valid_form = form.is_valid() if valid_form: @@ -319,6 +320,21 @@ def configurations(request): context["validMessageSub"] = "Poster footer uploaded" else: context["errorMessageSub"] = "Error uploading the image (size should be < 500kb)" + elif request.GET.get("delete_header"): + files = glob.glob(os.path.join(settings.MEDIA_ROOT, "posters") + f"/{faction.tId}-head.*") + for file in files: + os.remove(file) + faction.posterHeadImg.delete() + faction.save() + context["validMessageSub"] = "Poster header deleted" + + elif request.GET.get("delete_footer"): + files = glob.glob(os.path.join(settings.MEDIA_ROOT, "posters") + f"/{faction.tId}-tail.*") + for file in files: + os.remove(file) + faction.posterTailImg.delete() + faction.save() + context["validMessageSub"] = "Poster footer deleted" # add poster if faction.poster: diff --git a/templates/faction/aa/poster.html b/templates/faction/aa/poster.html index 333b81c0..9059079f 100644 --- a/templates/faction/aa/poster.html +++ b/templates/faction/aa/poster.html @@ -19,22 +19,21 @@ {% load humanize %} {% load mathfilters %} {% load app_filters %} - {# load popovers #} -

Content

- {% if posterDeleted %} -

Your poster has been deleted

+

+ Your poster has been deleted +

{% endif %} - {% if faction.poster %}
@@ -43,7 +42,8 @@

Content

@@ -51,8 +51,11 @@

Content

-
@@ -62,7 +65,8 @@

Content

@@ -71,7 +75,8 @@

Content

@@ -81,7 +86,8 @@

Content

@@ -90,7 +96,8 @@

Content

@@ -100,7 +107,8 @@

Content

@@ -109,7 +117,8 @@

Content

@@ -121,189 +130,335 @@

Content

{% endif %} - {% if faction.poster %} - -

Links

-
-
-
- Poster - - - -
-
-
-
- Gym - - - -
-
-
-
- Userscript - - - +

Links

+
+
+
+ Poster + + + +
-
-
- -

Font color

-
-
-
- - - - +
+
+ Gym + + + +
-
-
-
- - - - +
+
+ Userscript + + + +
-
-
- - - - +

Font color

+
+
+
+ + + + +
-
-
-
- - - - +
+
+ + + + +
-
-
-
- - +
+
+ + + + +
-
-
- -

Background color

-
-
-
- - - - +
+
+ + + + +
-
-
-
- - - - +
+
+ + +
-
-
- - - - +

Background color

+
+
+
+ + + + +
-
-
-
- - - - +
+
+ + + + +
-
-
-
- - +
+
+ + + + +
-
-
- -

Icons and font

-
-
-
- - +
+
+ + + + +
-
-
-
- - +
+
+ + +
-
- -

Header and footer

-
-
-
{% csrf_token %} - - +

+ Icons and font +

+
+
- - - + +
- -
-
-
{% csrf_token %} - - +
+
- - - + +
- +
-
- -
-
- - - +

+ Header and footer +

+
+
+
+ {% csrf_token %} + + +
+
+ {% csrf_token %} + + +
+
-
- - - +
+
+
+ {% csrf_token %} + + +
+ + + +
+
+
+
+
+ {% csrf_token %} + + +
+ + + +
+
+
-
- -{%endif%} +
+
+ + + +
+
+ + + +
+
+{% endif %}