From f1a87fb77b054c097664d723b8a14cfda5cb89aa Mon Sep 17 00:00:00 2001 From: Julien Palard Date: Sat, 19 May 2018 20:19:58 +0200 Subject: [PATCH] Place controls in a sigle line instead of having them eat almost a screen. --- paste/templates/paste/index.html | 94 ++++++++++++++++++++------------ paste/templatetags/filters.py | 8 ++- 2 files changed, 67 insertions(+), 35 deletions(-) diff --git a/paste/templates/paste/index.html b/paste/templates/paste/index.html index c21fdea..678c091 100644 --- a/paste/templates/paste/index.html +++ b/paste/templates/paste/index.html @@ -15,48 +15,74 @@ {{ form.content.errors }} - {% if PASTE.has_title %} -
- - {{ form.title|add_class:"form-control" }} - {{ form.title.errors }} -
- {% endif %} +
+ {% if PASTE.has_title %} +
+ + {{ form.title|add_class:"form-control" }} + {{ form.title.errors }} +
+ {% endif %} -
- - {{ form.language|add_class:"form-control" }} - {{ form.language.errors }} -
+
+ +
+
+
+
+ {{ form.language|add_class:"form-control" }} +
+ {{ form.language.errors }} +
-
- - {{ form.lifetime|add_class:"form-control" }} - {{ form.lifetime.errors }} -
+
+ +
+
+
+
+ {{ form.lifetime|add_class:"form-control" }} +
+ {{ form.lifetime.errors }} +
- {% if PASTE.has_expire_by_views %} -
- - {{ form.lifecount|add_class:"form-control" }} - {{ form.lifecount.errors }} -
- {% endif %} + {% if PASTE.has_expire_by_views %} +
+ +
+
+
+
+ {{ form.lifecount|add_class:"form-control" }} +
+ {{ form.lifecount.errors }} +
+ {% endif %} -
- - {{ form.password|add_class:"form-control" }} - {{ form.password.errors }} -
+
+ +
+
+
+
+ {{ form.password|add_class:"form-control"|placeholder:'Password protected'}} +
+ {{ form.password.errors }} +
+ +
+ {{ form.private|add_class:"form-check-input" }} + + {{ form.private.errors }} +
+ +
+ +
-
- {{ form.private|add_class:"form-check-input" }} - - {{ form.private.errors }}
{% csrf_token %} -
diff --git a/paste/templatetags/filters.py b/paste/templatetags/filters.py index ffba3d4..e6c3877 100644 --- a/paste/templatetags/filters.py +++ b/paste/templatetags/filters.py @@ -4,4 +4,10 @@ register = template.Library() @register.filter(name='add_class') def add_class(value, arg): - return value.as_widget(attrs={'class': arg}) + value.field.widget.attrs.update({"class": arg}) + return value + +@register.filter(name='placeholder') +def placeholder(value, arg): + value.field.widget.attrs.update({"placeholder": arg}) + return value