From 69a678a5ce0d6c6c647d0e07d35227740c6b0527 Mon Sep 17 00:00:00 2001 From: Jason McBrayer Date: Wed, 23 May 2018 08:27:45 -0400 Subject: [PATCH] Fix a bunch of mobile formatting issues --- brutaldon/static/css/brutaldon.css | 12 ++ brutaldon/templates/main/notifications.html | 146 +++++++++----------- brutaldon/templates/main/timeline.html | 52 ++++--- brutaldon/templates/main/toot_partial.html | 142 +++++++++---------- brutaldon/templates/main/user.html | 4 +- brutaldon/templatetags/taglinks.py | 12 ++ 6 files changed, 182 insertions(+), 186 deletions(-) diff --git a/brutaldon/static/css/brutaldon.css b/brutaldon/static/css/brutaldon.css index dcb7dc2..3084b0e 100644 --- a/brutaldon/static/css/brutaldon.css +++ b/brutaldon/static/css/brutaldon.css @@ -20,3 +20,15 @@ div.card-header-title, div.card-header-icon { -moz-text-stroke: 2px white; text-stroke: 2px white; } + +.media { + background-color: white; + border-radius: 5px; + -webkit-box-shadow: 0 2px 3px rgba(10, 10, 10, 0.1), 0 0 0 1px rgba(10, 10, 10, 0.1); + box-shadow: 0 2px 3px rgba(10, 10, 10, 0.1), 0 0 0 1px rgba(10, 10, 10, 0.1); + color: #4a4a4a; + display: block; + padding: 1.25rem; + margin-bottom: 0.75rem; + margin-top: 0.75rem; +} diff --git a/brutaldon/templates/main/notifications.html b/brutaldon/templates/main/notifications.html index 51a5a63..568acbd 100644 --- a/brutaldon/templates/main/notifications.html +++ b/brutaldon/templates/main/notifications.html @@ -1,93 +1,79 @@ {% extends "base.html" %} {% load humanize %} +{% load taglinks %} {% block title %} - Brutaldon - {{ timeline }} timelime +Brutaldon - {{ timeline }} timelime {% endblock %} {% comment %} - mastodon.notifications()[0] - # Returns the following dictionary: - { - 'id': # id of the notification - 'type': # "mention", "reblog", "favourite" or "follow" - 'created_at': # The time the notification was created - 'account': # User dict of the user from whom the notification originates - 'status': # In case of "mention", the mentioning status - # In case of reblog / favourite, the reblogged / favourited status - } +mastodon.notifications()[0] +# Returns the following dictionary: +{ +'id': # id of the notification +'type': # "mention", "reblog", "favourite" or "follow" +'created_at': # The time the notification was created +'account': # User dict of the user from whom the notification originates +'status': # In case of "mention", the mentioning status +# In case of reblog / favourite, the reblogged / favourited status +} {% endcomment %} {% block content %} -

Your {{ timeline }} timeline

- {% for note in notes %} - {% if note.type == 'mention' %} -
-

- {{ note.account.display_name }} - ({{ note.account.acct }}) - mentioned you. -

-
- {% include "main/toot_partial.html" with toot=note.status reblog=False %} -
- - {% elif note.type == 'reblog' %} -
-

- {{ note.account.display_name }} - ({{ note.account.acct }}) - boosted your toot. - ( - {{ note.created_at |naturaltime }} - ) -

- {% include "main/toot_partial.html" with toot=note.status reblog=True reblog_by=note.account.acct reblog_icon=note.account.avatar %} -
- - {% elif note.type == 'favourite' %} -
-
-
-
- -
-
- {{ note.account.display_name }} - ({{ note.account.acct }}) - favorited your toot. - ( - {{ note.created_at |naturaltime }} - ) -
-
-
- {% include "main/toot_partial.html" with toot=note.status reblog=False %} -
- - {% elif note.type == 'follow' %} -
- -
- - {% endif %} - {% endfor %} +

Your {{ timeline }} timeline

+{% for note in notes %} +{% if note.type == 'mention' %} +

+ {{ note.account.display_name }} + ({{ note.account.acct }}) + mentioned you. +

+
+{% include "main/toot_partial.html" with toot=note.status reblog=False %} + +{% elif note.type == 'reblog' %} +

+ {{ note.account.display_name }} + ({{ note.account.acct }}) + boosted your toot. + ( + {{ note.created_at |naturaltime }} + ) +

+{% include "main/toot_partial.html" with toot=note.status reblog=True reblog_by=note.account.acct reblog_icon=note.account.avatar %} + +{% elif note.type == 'favourite' %} +

+ {{ note.account.display_name }} + ({{ note.account.acct }}) + favorited your toot. + ( + {{ note.created_at |naturaltime }} + ) +

+{% include "main/toot_partial.html" with toot=note.status reblog=True reblog_by=note.account.acct reblog_icon=note.account.avatar %} + +{% elif note.type == 'follow' %} +
+
+

+ +

+
+
+
+ {{ note.account.display_name }} + ({{ note.account.acct }}) + followed you. + ( + {{ note.created_at |naturaltime }} + ) +
+
+
+ +{% endif %} +{% endfor %} {% endblock %} diff --git a/brutaldon/templates/main/timeline.html b/brutaldon/templates/main/timeline.html index 0479bfc..498d533 100644 --- a/brutaldon/templates/main/timeline.html +++ b/brutaldon/templates/main/timeline.html @@ -2,37 +2,35 @@ {% load humanize %} {% block title %} - Brutaldon - {{ timeline_name }} timelime +Brutaldon - {{ timeline_name }} timelime {% endblock %} {% block content %} {% if form %} -

Post

-
- {% include "main/post_minimal_partial.html" %} -
- +

Post

+
+ {% include "main/post_minimal_partial.html" %} +
+ {% endif %} -

Your {{ timeline_name }} timeline

- {% for toot in toots %} -
- {% if toot.reblog %} - {% include "main/toot_partial.html" with toot=toot.reblog reblog=True reblog_by=toot.account.acct reblog_icon=toot.account.avatar %} - {% else %} - {% include "main/toot_partial.html" with toot=toot reblog=False %} - {% endif %} -
- - {% endfor %} +

Your {{ timeline_name }} timeline

+{% for toot in toots %} +{% if toot.reblog %} +{% include "main/toot_partial.html" with toot=toot.reblog reblog=True reblog_by=toot.account.acct reblog_icon=toot.account.avatar %} +{% else %} +{% include "main/toot_partial.html" with toot=toot reblog=False %} +{% endif %} + +{% endfor %} - {% block pagination %} - - {% endblock %} +{% block pagination %} + +{% endblock %} {% endblock %} diff --git a/brutaldon/templates/main/toot_partial.html b/brutaldon/templates/main/toot_partial.html index 427e7a9..ac4bc51 100644 --- a/brutaldon/templates/main/toot_partial.html +++ b/brutaldon/templates/main/toot_partial.html @@ -20,42 +20,41 @@ {% endif %}
-
-

- {{ toot.account.display_name }} - @{{ toot.account.acct }} - - {{ toot.created_at |naturaltime }} - - {% if reblog %} -
- Boosted by @{{ reblog_by }} - {% endif %} -

- {% if toot.spoiler_text %} -
- {{ toot.spoiler_text }} -
- {{ toot.content | relink_toot | strip_html | safe }} -
-
- {% else %} +

+ {{ toot.account.display_name }} + @{{ toot.account.acct }} + + {{ toot.created_at |naturaltime }} + + {% if reblog %} +
+ Boosted by @{{ reblog_by }} + {% endif %} +

+ {% if toot.spoiler_text %} +
+ {{ toot.spoiler_text }} +
+ {{ toot.content | relink_toot | strip_html | safe }} +
+
+ {% else %}
{{ toot.content | relink_toot | strip_html | safe }}
- {% endif %} + {% endif %} - {% if toot.media_attachments %} -
-
-
- {% for media in toot.media_attachments %} - - {% if toot.sensitive %} - + - {% endif %} -
-
+
+ {% endif %} +
{% if not confirm_page %} - +
+ {% endif %}
-
-
diff --git a/brutaldon/templates/main/user.html b/brutaldon/templates/main/user.html index 2699275..51de3af 100644 --- a/brutaldon/templates/main/user.html +++ b/brutaldon/templates/main/user.html @@ -16,10 +16,8 @@
{% endif %}
diff --git a/brutaldon/templatetags/taglinks.py b/brutaldon/templatetags/taglinks.py index 216ad87..b495868 100644 --- a/brutaldon/templatetags/taglinks.py +++ b/brutaldon/templatetags/taglinks.py @@ -44,3 +44,15 @@ def relink_mentions(value): @register.filter def relink_toot(value): return relink_tags(relink_mentions(value)) + +@register.filter +def localuser(value): + '''Convert a remote user link to local''' + try: + parsed = parse.urlparse(value) + instance = parsed[1] + user = parsed[2][2:] + local = reverse('user', args=[user+'@'+instance]) + except: + local = value + return local