start redesigning user pages

for #442
pull/671/head
Ryan Barrett 2023-10-10 13:54:14 -07:00
rodzic 1b78e86e6c
commit afa16d3864
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
9 zmienionych plików z 94 dodań i 52 usunięć

Wyświetl plik

@ -472,7 +472,7 @@ class User(StringIdModel, metaclass=ProtocolUserMeta):
return f"""\
<a class="h-card u-author" href="{self.web_url()}">
<img src="{img}" class="profile">
<span class="logo">{self.LOGO_HTML}</span>
<span class="logo" title="{self.__class__.__name__}">{self.LOGO_HTML}</span>
{self.name()}
</a>
"""

Wyświetl plik

@ -116,7 +116,7 @@ def user(protocol, id):
following = f'{following}{"+" if following == FOLLOWERS_UI_LIMIT else ""}'
return render_template(
'user.html',
'profile.html',
follow_url=request.values.get('url'),
logs=logs,
util=util,

Wyświetl plik

@ -327,6 +327,26 @@ button[disabled]:hover {
margin-top: -.5em;
}
.tabs a {
border-bottom: 1px solid;
background: linear-gradient(white, #e8e8e8);
padding-left: .5em;
padding-right: .5em;
padding-top: .2em;
padding-bottom: .2em;
}
.tabs a:hover {
text-decoration: none;
}
.tabs a.active-tab {
border-bottom: none;
border-left: 1px solid;
border-right: 1px solid;
background: inherit;
}
.disable-button, #bad-button {
border-color: red;
color: red;

Wyświetl plik

@ -8,6 +8,20 @@
<div class="row big">Followers</div>
<div class="row">
<form method="post" action="/remote-follow">
<nobr>
<label for="follow-address">Follow @{{ id }} with your fediverse address:</label>
<input id="follow-address" name="address" type="text" required
placeholder="@user@domain.social" alt="fediverse address"
value="{{ follow_url or '' }}"></input>
<input name="domain" type="hidden" value="{{ id }}"></input>
<input name="protocol" type="hidden" value="{{ g.user.LABEL }}"></input>
<button type="submit" class="btn btn-default">Follow</button>
</nobr>
</form>
</div>
{% with page_name="followers" %}
{% include "_followers.html" %}
{% endwith %}

Wyświetl plik

@ -0,0 +1,31 @@
{% extends "user_base.html" %}
{% set tab = "profile" %}
{% block subtabs %}
<div class="row">
<a href="{{ g.user.user_page_path('followers') }}">{{ followers }} follower{% if followers != '1' %}s{% endif %}</a>
&middot;
<a href="{{ g.user.user_page_path('following') }}">following {{ following }}</a>
&middot;
{% if g.user.LABEL != 'activitypub' %}
Bridged to
<nobr title="Fediverse address">
<img class="logo" src="/static/fediverse_logo.svg">
{{ g.user.ap_address() }}
</nobr>
<form method="post" action="/webmention-interactive">
<input name="source" type="hidden" value="{{ g.user.web_url() }}" />
&nbsp;
<button id="update-profile-button" type="submit"
title="Update profile from web site"
class="btn btn-default glyphicon glyphicon-refresh"></button>
</form>
{% endif %}
</div>
{% endblock subtabs %}
{#
{% block feed %}
{% endblock feed %}
#}

Wyświetl plik

@ -1,26 +0,0 @@
<div class="row">
<div class="big" style="display: inline">
{{ g.user.user_link()|safe }}
&middot;
<span title="Fediverse address">
<nobr>
<img class="logo" src="/static/fediverse_logo.svg">
{{ g.user.ap_address() }}
</nobr>
</span>
&middot;
<nobr>
{{ util.pretty_link(g.user.web_url(), text_prefix='🌐', attrs={'title': 'Web site'})|safe }}
{% if g.user.LABEL != 'activitypub' %}
<form method="post" action="/webmention-interactive">
<input name="source" type="hidden" value="{{ g.user.web_url() }}" />
<button id="update-profile-button" type="submit"
title="Update profile from web site"
class="btn btn-default glyphicon glyphicon-refresh"></button>
</form>
{% endif %}
</nobr>
</div>
</div>

Wyświetl plik

@ -1,6 +1,6 @@
{% extends "base.html" %}
{% block title %}{{ id }} - Bridgy Fed{% endblock %}
{% block title %}{{ id }} {{ tab }} - Bridgy Fed{% endblock %}
{% block content %}
@ -35,34 +35,37 @@
{% endif %}
{% endif %}
{% include "user_addresses.html" %}
<div class="row big">
{{ g.user.user_link()|safe }}
</div>
<!-- tabs -->
<div class="row tabs">
<a>
<a href="{{ g.user.user_page_path() }}"
{% if tab == 'profile' %}class="active-tab"{% endif %}
>👤 Profile</a><a
href="{{ g.user.user_page_path('home') }}"
{% if tab == 'home' %}class="active-tab"{% endif %}
>🏠 Feed</a><a
href="{{ g.user.user_page_path('notifications') }}"
{% if tab == 'notifications' %}class="active-tab"{% endif %}
>🔔 Notifications</a>
<a>
</div>
{% block subtabs %}
<div class="row">
<a href="{{ g.user.user_page_path('followers') }}">{{ followers }} follower{% if followers != '1' %}s{% endif %}</a>
&middot; <a href="{{ g.user.user_page_path('following') }}">following {{ following }}</a>
&middot; <a href="{{ g.user.user_page_path('feed') }}">HTML</a>
&middot; <a href="{{ g.user.user_page_path('feed?format=atom') }}">Atom</a>
&middot; <a href="{{ g.user.user_page_path('feed?format=rss') }}">RSS</a>
&middot; <a href="/.well-known/webfinger?resource=acct:{{ g.user.ap_address() }}">Webfinger</a>
&middot; <a href="{{ g.user.ap_actor() }}">ActivityPub</a>
</div>
{% endblock subtabs %}
{% if g.user.LABEL != 'activitypub' %}
<div class="row">
<form method="post" action="/remote-follow">
<p>
<label for="follow-address">Follow @{{ id }} with your fediverse address:</label>
<input id="follow-address" name="address" type="text" required
placeholder="@user@domain.social" alt="fediverse address"
value="{{ follow_url or '' }}"></input>
<input name="domain" type="hidden" value="{{ id }}"></input>
<input name="protocol" type="hidden" value="{{ g.user.LABEL }}"></input>
<button type="submit" class="btn btn-default">Follow</button>
</p>
</form>
</div>
{% endif %}
{% block feed %}
{% include "activities.html" %}
{% endblock feed %}
{% endblock %}
{% endblock content %}

Wyświetl plik

@ -34,7 +34,7 @@ class CommonTest(TestCase):
self.assert_multiline_equals("""\
<a class="h-card u-author" href="https://user.com/">
<img src="" class="profile">
<span class="logo">🕸</span>
<span class="logo" title="{self.__class__.__name__}">🕸</span>
user.com
</a>""", common.pretty_link('https://user.com/'))

Wyświetl plik

@ -139,7 +139,7 @@ class UserTest(TestCase):
self.assert_multiline_equals("""\
<a class="h-card u-author" href="https://y.z/">
<img src="" class="profile">
<span class="logo">🕸</span>
<span class="logo" title="Web">🕸</span>
y.z
</a>""", g.user.user_link())
@ -147,7 +147,7 @@ class UserTest(TestCase):
self.assert_multiline_equals("""\
<a class="h-card u-author" href="https://y.z/">
<img src="https://user.com/me.jpg" class="profile">
<span class="logo">🕸</span>
<span class="logo" title="Web">🕸</span>
Mrs. Foo
</a>""", g.user.user_link())