From 1c442f0dfed7793cb210498942da498f048ebb24 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 5 Nov 2020 08:21:00 -0800 Subject: [PATCH 1/3] More legible statuses on mobile --- bookwyrm/static/css/format.css | 19 ++++++++++++++++--- bookwyrm/templates/snippets/book_preview.html | 6 +++--- bookwyrm/templates/snippets/status.html | 2 +- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/bookwyrm/static/css/format.css b/bookwyrm/static/css/format.css index bd13143b3..51c931e61 100644 --- a/bookwyrm/static/css/format.css +++ b/bookwyrm/static/css/format.css @@ -62,13 +62,26 @@ input.toggle-control:checked ~ .toggle-content { .cover-container.is-medium { height: 150px; } +.cover-container.is-small { + height: 100px; +} +@media only screen and (max-width: 768px) { + .cover-container { + height: 200px; + width: max-content; + } + .cover-container.is-medium { + height: 100px; + } + .cover-container.is-small { + height: 70px; + } +} + .cover-container.is-medium .no-cover div { font-size: 0.9em; padding: 0.3em; } -.cover-container.is-small { - height: 100px; -} .cover-container.is-small .no-cover div { font-size: 0.7em; padding: 0.1em; diff --git a/bookwyrm/templates/snippets/book_preview.html b/bookwyrm/templates/snippets/book_preview.html index 65a9ae4b8..ab41d41ea 100644 --- a/bookwyrm/templates/snippets/book_preview.html +++ b/bookwyrm/templates/snippets/book_preview.html @@ -1,11 +1,11 @@ -
-
+
+
{% include 'snippets/book_cover.html' with book=book %} {% include 'snippets/shelve_button.html' with book=book %}
-
+

{% include 'snippets/book_titleby.html' with book=book %}

{% include 'snippets/book_description.html' with book=book %}
diff --git a/bookwyrm/templates/snippets/status.html b/bookwyrm/templates/snippets/status.html index 23b45e904..4c3284c6d 100644 --- a/bookwyrm/templates/snippets/status.html +++ b/bookwyrm/templates/snippets/status.html @@ -17,7 +17,7 @@ {% include 'snippets/status_header.html' with status=status %} {% endif %}

-
+
From 7f11afa0818f07793ef1e26dbc289c3472e4e902 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 5 Nov 2020 10:48:28 -0800 Subject: [PATCH 2/3] Revamps reply form --- bookwyrm/static/css/fonts/icomoon.eot | Bin 7288 -> 7408 bytes bookwyrm/static/css/fonts/icomoon.svg | 1 + bookwyrm/static/css/fonts/icomoon.ttf | Bin 7124 -> 7244 bytes bookwyrm/static/css/fonts/icomoon.woff | Bin 7200 -> 7320 bytes bookwyrm/static/css/icons.css | 13 +- bookwyrm/templates/snippets/interaction.html | 69 ----------- bookwyrm/templates/snippets/status.html | 124 ++++++++++++++----- bookwyrm/templatetags/fr_display.py | 3 +- 8 files changed, 102 insertions(+), 108 deletions(-) delete mode 100644 bookwyrm/templates/snippets/interaction.html diff --git a/bookwyrm/static/css/fonts/icomoon.eot b/bookwyrm/static/css/fonts/icomoon.eot index 99a90268aada65ae1e38bb4281deb044275a8478..e031e7d2809291c6b0ef32a7cb71e378b36a853e 100644 GIT binary patch delta 413 zcmexi@xhYqgA474i~uQ)hZ{{s!`w0PSci$S*EoU}C|3{DD!Pd8(M}W+5hX(RyYEO~x4J>rA!`JPZ;HK=&{zv5AU^ z85^0Iny4u&B5{z}Obq%?PWmAHZx)Eub8=#u2PE`>941>Z1rh^sk!X-}m>3xT-(Y^h ze1JiN!G(cgbA-4DlT4Sl*VlM{o39MqEFd)uw@*I30i!4Hku+yinEXXDn^ALejFh+R mF>V9y1nwU0Row4@Y8Zi7fk}#i1EijTX>y{B@aD@>OBn%A>SS{O delta 261 zcmexh`NM*(LWY6iiu6P_GZx8`@~DXp<${+O7#Q{daYAx#VgbXNJzpoDkf~2D>pIQA zz}UgSAfA(vnwTQ>%zPFDgTxo0Isky}!c*UtJM$PWPWYjX0F z6NC3e9{}>t0QnBNi4_G58caZorFejRg}lVv)R|tKzkz(9e#W+f{NfS@W}pm%^cIjj z12Z$@xydPv-Hf7>KQPKOPZ4w3EW~6kx_PH~IFn3Nd5L5^zs*+$ZWfRhhTHoqC&TE; mI#TA0@{?1fvL|1b^5Fl$t-&3_UBtbOff1-eezTtRAw~csVMWvc diff --git a/bookwyrm/static/css/fonts/icomoon.svg b/bookwyrm/static/css/fonts/icomoon.svg index 28612eee4..0323df053 100644 --- a/bookwyrm/static/css/fonts/icomoon.svg +++ b/bookwyrm/static/css/fonts/icomoon.svg @@ -29,6 +29,7 @@ + diff --git a/bookwyrm/static/css/fonts/icomoon.ttf b/bookwyrm/static/css/fonts/icomoon.ttf index 0f78404f5b872fd47f68872cc2b0d43391c48485..d112fb65cef4b0db4ca7b386f19122adb5c42b98 100644 GIT binary patch delta 433 zcmca&e#WAnfsuiMft#U$ftkU;KUm+0Ux@7rP-G7fCnV=47BH;c^PPc#Q3l9QNlz>; z0MY_Leglx^NYANE+nsup4ao0cU=Y8Pk(!ty^;- zzXWJWTS0zt3DBWHAfp44XJBT&F!4Y)qu690MtSC`Vy>I>7|liNnHe-0W0Gh2Dk5fVWM*ojrmTp>L1r^C=sP*-gYdsuAX3lCiD@2?&;xRqY{3*r48%pE zL5^W!VEBK7`33U<1`P%m28PXB#5|Z}y1c!<#`D{JW#DE3sbRQ%^63p2Jy}B1oKazN xfMhnK=Hwlc-m=HI4Y(7yd$?C|zXPfPMTr8F6axoHJptQ3l9QNlz>; z0MY_Leglx^NYANEOD^j=4diz)Fo@@5q$Z|FJu{!hz##DjC~uYl6yV@y(PUtd)B*BU zGIC2Q^4eMd1Ni|!eoan(vSVWKp6CNWfipk>hup-90tO8xpk-1#K)ym=Vs7e8FV5dU zKF|Qhwu1cP5}-qYKza*Eo`IS9+{6RjjG~i$80DF#h`DUeV>B1tEGiz(BokF$A{ozb z^Ob>{1*C!D_WsJrFnV%_q&cJfbHPO22cxqZ)CC}40gN@7WbzVoQ-NY1 zfR?v`@Juhx-v#-_B|x754TY*>2C|r$FHGiP>}C|3JcCi5d8(M}=3R{DqV>!Snv5~b z*O_b?co-x=Zemno6BQ9NHZn6cQBzh#;vln`81$W-^g;OFED)*ZHpL}`)Mo&(W pG-p(pJV!E{QFAhjl(+CPZUgQF?jG({-0y&D7=c(}bDY#6MgaKyWIzA_ delta 341 zcmbPXxxhlC+~3WOfsp|SWE2>5SAwpdLvFpc*p}mU?DBD+4G96srL8RX~`7 zn?*Atw*<(SoCD<7fN)+r>;IhmWS}}fDG8u}0|*E2i9V24l;Qr TDR3AtFfajwOnCEWsilknO@2#p diff --git a/bookwyrm/static/css/icons.css b/bookwyrm/static/css/icons.css index bf68b7d6a..1f34f78c8 100644 --- a/bookwyrm/static/css/icons.css +++ b/bookwyrm/static/css/icons.css @@ -1,10 +1,10 @@ @font-face { font-family: 'icomoon'; - src: url('fonts/icomoon.eot?7ifunb'); - src: url('fonts/icomoon.eot?7ifunb#iefix') format('embedded-opentype'), - url('fonts/icomoon.ttf?7ifunb') format('truetype'), - url('fonts/icomoon.woff?7ifunb') format('woff'), - url('fonts/icomoon.svg?7ifunb#icomoon') format('svg'); + src: url('fonts/icomoon.eot?ouoizu'); + src: url('fonts/icomoon.eot?ouoizu#iefix') format('embedded-opentype'), + url('fonts/icomoon.ttf?ouoizu') format('truetype'), + url('fonts/icomoon.woff?ouoizu') format('woff'), + url('fonts/icomoon.svg?ouoizu#icomoon') format('svg'); font-weight: normal; font-style: normal; font-display: block; @@ -25,6 +25,9 @@ -moz-osx-font-smoothing: grayscale; } +.icon-dots-three:before { + content: "\e916"; +} .icon-envelope:before { content: "\e900"; } diff --git a/bookwyrm/templates/snippets/interaction.html b/bookwyrm/templates/snippets/interaction.html deleted file mode 100644 index 97e7d0684..000000000 --- a/bookwyrm/templates/snippets/interaction.html +++ /dev/null @@ -1,69 +0,0 @@ -{% load fr_display %} -{% with activity.id|uuid as uuid %} - -{% endwith %} diff --git a/bookwyrm/templates/snippets/status.html b/bookwyrm/templates/snippets/status.html index 4c3284c6d..6e2495209 100644 --- a/bookwyrm/templates/snippets/status.html +++ b/bookwyrm/templates/snippets/status.html @@ -28,43 +28,101 @@ {% endif %}
-
- {% if status.status_type == 'Boost' %} - {% include 'snippets/interaction.html' with activity=status|boosted_status %} - {% else %} - {% include 'snippets/interaction.html' with activity=status %} +
+ {% if request.user.is_authenticated %} + + {% endif %} +
diff --git a/bookwyrm/templatetags/fr_display.py b/bookwyrm/templatetags/fr_display.py index 053058eb4..2af66a544 100644 --- a/bookwyrm/templatetags/fr_display.py +++ b/bookwyrm/templatetags/fr_display.py @@ -117,7 +117,7 @@ def text_overflow(text): ''' dont' let book descriptions run for ages ''' if not text: return '' - char_max = 500 + char_max = 400 if text and len(text) < char_max: return text @@ -129,6 +129,7 @@ def text_overflow(text): @register.filter(name='uuid') def get_uuid(identifier): + ''' for avoiding clashing ids when there are many forms ''' return '%s%s' % (identifier, uuid4()) From a3bf31796aa36756471e2e31212714359dad7fcd Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 5 Nov 2020 11:40:03 -0800 Subject: [PATCH 3/3] Make status footer more mobile friendly --- bookwyrm/templates/snippets/boost_button.html | 19 +++++++ bookwyrm/templates/snippets/fav_button.html | 19 +++++++ bookwyrm/templates/snippets/reply_form.html | 33 +++++++++++++ bookwyrm/templates/snippets/status.html | 49 ++++++++++--------- bookwyrm/templatetags/fr_display.py | 24 +++++++++ 5 files changed, 120 insertions(+), 24 deletions(-) create mode 100644 bookwyrm/templates/snippets/boost_button.html create mode 100644 bookwyrm/templates/snippets/fav_button.html create mode 100644 bookwyrm/templates/snippets/reply_form.html diff --git a/bookwyrm/templates/snippets/boost_button.html b/bookwyrm/templates/snippets/boost_button.html new file mode 100644 index 000000000..7133e818d --- /dev/null +++ b/bookwyrm/templates/snippets/boost_button.html @@ -0,0 +1,19 @@ +{% load fr_display %} +{% with activity.id|uuid as uuid %} +
+ {% csrf_token %} + +
+
+ {% csrf_token %} + +
+{% endwith %} diff --git a/bookwyrm/templates/snippets/fav_button.html b/bookwyrm/templates/snippets/fav_button.html new file mode 100644 index 000000000..de41064a6 --- /dev/null +++ b/bookwyrm/templates/snippets/fav_button.html @@ -0,0 +1,19 @@ +{% load fr_display %} +{% with activity.id|uuid as uuid %} +
+ {% csrf_token %} + +
+
+ {% csrf_token %} + +
+{% endwith %} diff --git a/bookwyrm/templates/snippets/reply_form.html b/bookwyrm/templates/snippets/reply_form.html new file mode 100644 index 000000000..48371f634 --- /dev/null +++ b/bookwyrm/templates/snippets/reply_form.html @@ -0,0 +1,33 @@ +{% load fr_display %} +{% with activity.id|uuid as uuid %} +
+
+ {% csrf_token %} + + +
+
+ +
+
+ +
+
+
+ +
+
+
+ +
+
+
+
+{% endwith %} diff --git a/bookwyrm/templates/snippets/status.html b/bookwyrm/templates/snippets/status.html index 6e2495209..9390d39c5 100644 --- a/bookwyrm/templates/snippets/status.html +++ b/bookwyrm/templates/snippets/status.html @@ -47,10 +47,8 @@ - {{ status.published_date | naturaltime }} - - {% if status.user == request.user %} + + {% if status.user == request.user %} + -
- - - + +
+ + +
{% else %} diff --git a/bookwyrm/templatetags/fr_display.py b/bookwyrm/templatetags/fr_display.py index 2af66a544..73df1db86 100644 --- a/bookwyrm/templatetags/fr_display.py +++ b/bookwyrm/templatetags/fr_display.py @@ -1,6 +1,10 @@ ''' template filters ''' from uuid import uuid4 +from datetime import datetime + +from dateutil.relativedelta import relativedelta from django import template +from django.utils import timezone from bookwyrm import models @@ -133,6 +137,26 @@ def get_uuid(identifier): return '%s%s' % (identifier, uuid4()) +@register.filter(name="post_date") +def time_since(date): + ''' concise time ago function ''' + if not isinstance(date, datetime): + return '' + now = timezone.now() + delta = now - date + + if date < (now - relativedelta(weeks=1)): + return date.strftime('%b %-d') + delta = relativedelta(now, date) + if delta.days: + return '%dd' % delta.days + if delta.hours: + return '%dh' % delta.hours + if delta.minutes: + return '%dm' % delta.minutes + return '%ds' % delta.seconds + + @register.simple_tag(takes_context=True) def shelve_button_identifier(context, book): ''' check what shelf a user has a book on, if any '''