From 00eb6af1bd21df42fc41195ceed0fad73bbb5f27 Mon Sep 17 00:00:00 2001 From: Derf Null Date: Sun, 4 Jun 2023 18:21:36 +0200 Subject: expose follows / social interaction in frontend --- templates/_checked_in.html.ep | 9 +- templates/_format_train.html.ep | 9 ++ templates/_public_status_card.html.ep | 39 +++--- templates/account.html.ep | 95 +++++++++++++- templates/edit_visibility.html.ep | 15 +-- templates/layouts/default.html.ep | 12 +- templates/privacy.html.ep | 22 ++-- templates/profile.html.ep | 73 ++++++++++- templates/social.html.ep | 66 ++++++++++ templates/social_list.html.ep | 230 ++++++++++++++++++++++++++++++++++ 10 files changed, 521 insertions(+), 49 deletions(-) create mode 100644 templates/_format_train.html.ep create mode 100644 templates/social.html.ep create mode 100644 templates/social_list.html.ep (limited to 'templates') diff --git a/templates/_checked_in.html.ep b/templates/_checked_in.html.ep index 2d39842..1002654 100644 --- a/templates/_checked_in.html.ep +++ b/templates/_checked_in.html.ep @@ -3,8 +3,13 @@
- - Eingecheckt in <%= $journey->{train_type} %> <%= $journey->{train_no} %> + + % if ($journey->{train_line}) { + <%= $journey->{train_type} %> <%= $journey->{train_line} %> <%= $journey->{train_no} %> + % } + % else { + <%= $journey->{train_type} %> <%= $journey->{train_no} %> + % } % if ($journey->{comment}) {

<%= $journey->{comment} %>

diff --git a/templates/_format_train.html.ep b/templates/_format_train.html.ep new file mode 100644 index 0000000..5b61682 --- /dev/null +++ b/templates/_format_train.html.ep @@ -0,0 +1,9 @@ +% if ($journey->{extra_data}{wagonorder_pride}) { + 🏳️‍🌈 +% } +% if ($journey->{train_line}) { + <%= $journey->{train_type} %> <%= $journey->{train_line} %> <%= $journey->{train_no} %> +% } +% else { + <%= $journey->{train_type} %> <%= $journey->{train_no} %> +% } diff --git a/templates/_public_status_card.html.ep b/templates/_public_status_card.html.ep index 94ebf44..8e3eec7 100644 --- a/templates/_public_status_card.html.ep +++ b/templates/_public_status_card.html.ep @@ -1,28 +1,28 @@ -
+
% if ($journey->{checked_in}) {
- <%= $name %> ist unterwegs - % if ($journey_visibility) { - <%= visibility_icon($journey_visibility) %> - % } + + % if (stash('from_profile')) { + Unterwegs mit <%= include '_format_train', journey => $journey %> + % } + % else { + <%= $name %> ist unterwegs + % } + % if ($journey_visibility) { + <%= visibility_icon($journey_visibility) %> + % } % if ($public_level & 0x04 and $journey->{comment}) {

„<%= $journey->{comment} %>“

% }

-

- % if ($journey->{train_line}) { - <%= $journey->{train_type} %> <%= $journey->{train_line} %> <%= $journey->{train_no} %> - % } - % else { - <%= $journey->{train_type} %> <%= $journey->{train_no} %> - % } - % if ($journey->{extra_data}{wagonorder_pride}) { - 🏳️‍🌈 - % } -
+ % if (not stash('from_profile')) { +
+ %= include '_format_train', journey => $journey +
+ % }
- <%= $name %> ist gerade nicht eingecheckt + % if (stash('from_profile')) { + Aktuell nicht eingecheckt + % } + % else { + <%= $name %> ist gerade nicht eingecheckt + % }

% if ($journey->{arr_name}) { Zuletzt gesehen diff --git a/templates/account.html.ep b/templates/account.html.ep index ef6b847..bb03c7b 100644 --- a/templates/account.html.ep +++ b/templates/account.html.ep @@ -1,4 +1,4 @@ -% if (my $invalid = stash('invalid')) { +% if (my $invalid = flash('invalid')) { %= include '_invalid_input', invalid => $invalid % } @@ -19,6 +19,9 @@ % elsif ($success eq 'privacy') { Einstellungen zu öffentlichen Account-Daten geändert % } + % elsif ($success eq 'social') { + Einstellungen zur Interaktionen mit anderen Accounts geändert + % } % elsif ($success eq 'traewelling') { Träwelling-Verknüpfung aktualisiert % } @@ -31,6 +34,9 @@ % elsif ($success eq 'webhook') { Web Hook aktualisiert % } + % elsif ($success eq 'clear_notifications') { + Benachrichtigungen gelesen + % }

@@ -77,6 +83,27 @@ • Öffentliches Profil + + Interaktion + + edit + % if ($acc->{accept_follows}) { + Accounts können dir direkt folgen + % } + % elsif ($acc->{accept_follow_requests}) { + Accounts können dir auf Anfrage folgen + % if ($num_follow_requests == 1) { + – eine offene Anfrage + % } elsif ($num_follow_requests) { + – <%= $num_follow_requests %> offene Anfragen + % } + + % } + % else { + Accounts können dir nicht folgen + % } + + Web Hook @@ -152,6 +179,72 @@
+% if ($num_follow_requests or $num_followers or $num_following or $num_blocked) { +
+
+

Interaktion

+ + + + + + + + + + + + + + + + + +
Anfragen + % if ($num_follow_requests == 0) { + keine offen + % } + % elsif ($num_follow_requests == 1) { + ein Account + % } + % else { + <%= $num_follow_requests %> Accounts + % } +
Dir folg<%= $num_followers == 1 ? 't' : 'en' %> + % if ($num_followers == 0) { + keine Accounts + % } + % elsif ($num_followers == 1) { + ein Account + % } + % else { + <%= $num_followers %> Accounts + % } +
Du folgst + % if ($num_following == 0) { + keinen Accounts + % } + % elsif ($num_following == 1) { + einem Account + % } + % else { + <%= $num_following %> Accounts + % } +
Blockiert + % if ($num_blocked == 0) { + keine Accounts + % } + % elsif ($num_blocked == 1) { + ein Account + % } + % else { + <%= $num_blocked %> Accounts + % } +
+
+
+% } + % my $token = stash('api_token') // {};
diff --git a/templates/edit_visibility.html.ep b/templates/edit_visibility.html.ep index 28b1426..9bf8d56 100644 --- a/templates/edit_visibility.html.ep +++ b/templates/edit_visibility.html.ep @@ -40,7 +40,10 @@ Die Fahrt ist öffentlich sichtbar. % } % elsif ($user_level eq 'travelynx') { - Die Fahrt ist nur für auf dieser Seite angemeldete Personen oder mit Link sichtbar. + Die Fahrt ist nur für auf dieser Seite angemeldete Accounts oder mit Link sichtbar. + % } + % elsif ($user_level eq 'followers') { + Die Fahrt ist nur für dir folgende Accounts oder mit Link sichtbar. % } % elsif ($user_level eq 'unlisted') { Die Fahrt ist nur mit Link sichtbar. @@ -68,29 +71,27 @@
-
diff --git a/templates/layouts/default.html.ep b/templates/layouts/default.html.ep index bae0fcc..51608d5 100644 --- a/templates/layouts/default.html.ep +++ b/templates/layouts/default.html.ep @@ -70,6 +70,7 @@ %= javascript "/static/${av}/leaflet/leaflet.js" % } +% my $acc = is_user_authenticated() && current_user(); -

Profil

+

Vergangene Fahrten

@@ -111,10 +109,10 @@ Fahrten, die über die Standardeinstellung (siehe oben) oder per individueller Einstellung für die aufrufende Person sichtbar sind, werden hier verlinkt. Derzeit werden nur die letzten zehn Fahrten - angezeigt; dies kann sich in Zukunft ändern. + angezeigt; in Zukunft wird dies ggf. auf sämtliche Fahrten im + gewählten Zeitraum erweitert.
-

Vergangenheit

@@ -133,7 +131,7 @@
Hier kannst du auswählen, ob alle deiner vergangenen Fahrten für - Profil und Detailseiten in Frage kommen, oder nur die letzten vier + Profil und Detailseiten in Frage kommen oder nur die letzten vier Wochen zugänglich sein sollen. Sofern du sie auf die letzten vier Wochen beschränkst, sind ältere Fahrten nur über einen mit Hilfe des „Teilen“-Knopfs erstellten Links zugänglich. diff --git a/templates/profile.html.ep b/templates/profile.html.ep index 63bc3ff..06f8cfe 100644 --- a/templates/profile.html.ep +++ b/templates/profile.html.ep @@ -11,14 +11,81 @@
% }
-
- %= include '_public_status_card', name => $name, public_level => $public_level, journey => $journey, journey_visibility => $journey_visibility +
+
+
+ <%= $name %> + % if ($following and $follows_me) { + group + % } + % elsif ($follow_reqs_me) { + + notifications + + % } + % elsif ($is_self) { + edit + % } + + % if ($bio) { + %== $bio + % } + % if (@{$metadata // []}) { + + % for my $entry (@{$metadata}) { + + + + + % } +
<%= $entry->{key} %><%== $entry->{value}{html} %>
+ % } +
+ % if ($following or $follow_requested or $can_follow or $can_request_follow) { +
+ %= form_for "/social-action" => (method => 'POST') => begin + %= csrf_field + %= hidden_field target => $uid + %= hidden_field redirect_to => 'profile' + % if ($following) { + + % } + % elsif ($follow_requested) { + + % } + % elsif ($can_follow or $can_request_follow) { + + % } + %= end +
+ % } +
+
+
+
+
+ %= include '_public_status_card', name => $name, public_level => $public_level, journey => $journey, journey_visibility => $journey_visibility, from_profile => 1
% if ($journeys and @{$journeys}) {
-

Letzte Fahrten von <%= $name %>

+

Vergangene Fahrten

%= include '_history_trains', date_format => '%d.%m.%Y', link_prefix => "/p/${name}/j/", journeys => $journeys; diff --git a/templates/social.html.ep b/templates/social.html.ep new file mode 100644 index 0000000..2743abf --- /dev/null +++ b/templates/social.html.ep @@ -0,0 +1,66 @@ +

Interaktion

+
+
+ Hier kannst du einstellen, ob und wie dir Accounts folgen können. + Ebenfalls kannst du bestehende Verbindungen und Folge-Anfragen + bearbeiten. Die hier vorgenommenen Einstellungen haben keinen Einfluss + darauf, ob/wie du anderen Accounts folgen kannst. +
+
+%= form_for '/account/social' => (method => 'POST') => begin +%= csrf_field +

Folgen

+
+
+

+ Accounts die dir folgen können alle Checkins sehen, die nicht als privat oder nur mit Link zugänglich vermerkt sind. + Später werden sie zusätzlich die Möglichkeit haben, deinen aktuellen Checkin (sofern sichtbar) als Teil einer Übersicht über die Checkins aller gefolgten Accounts direkt anzusehen (analog zur Timeline im Fediverse). +

+

+ Du hast jederzeit die Möglichkeit, Accounts aus deiner Followerliste zu entfernen, Folge-Anfragen abzulehnen oder Accounts zu blockieren, so dass sie dir weder folgen noch neue Folge-Anfragen stellen können. +

+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+
+
+ +
+
+
+
+%= end diff --git a/templates/social_list.html.ep b/templates/social_list.html.ep new file mode 100644 index 0000000..ed8e92a --- /dev/null +++ b/templates/social_list.html.ep @@ -0,0 +1,230 @@ +%= form_for "/social-action" => (method => 'POST') => begin +%= csrf_field +%= hidden_field redirect_to => '/account' +% my $count = scalar @{$entries}; +% if ($type eq 'follow-requests') { +
+
+

Folge-Anfragen

+
+
+
+
+ block
Blockieren +
+
+ cancel
Ablehnen +
+
+ check
Annehmen +
+
+ % if ($notifications) { +
+
+ +
+
+ % } + +% } +% elsif ($type eq 'followers') { +
+
+ % if ($count == 1) { +

Dir folgt ein Account

+ % } + % else { +

Dir folgen <%= $count %> Accounts

+ % } +
+
+
+
+ block
Blockieren +
+
+ remove
Entfernen +
+
+ person_add
Zurückfolgen +
+
+
+
+
+
+ access_time
Folgen angefragt +
+
+ group
Du folgst diesem Account +
+
+ +% } +% elsif ($type eq 'follows') { +
+
+ % if ($count == 1) { +

Du folgst einem Account

+ % } + % else { +

Du folgst <%= $count %> Accounts

+ % } +
+
+
+
+ remove
Nicht mehr folgen +
+
+ +% } +% elsif ($type eq 'blocks') { +
+
+

Blockierte Accounts

+

+ Blockierte Accounts können dir nicht folgen und keine Folge-Anfragen stellen. + Sie haben weiterhin Zugriff auf deine als öffentlich oder travelynx-intern markierten Checkins. +

+
+
+
+
+ remove
Entblockieren +
+
+ +% } +%= end + +
+
+ %= form_for "/social-action" => (method => 'POST') => begin + %= csrf_field + %= hidden_field redirect_to => "/account/social/$type" + + % for my $entry (@{$entries}) { + + + % if ($type eq 'follow-requests') { + + + + % } + % elsif ($type eq 'followers') { + + + + % } + % elsif ($type eq 'follows') { + + % } + % elsif ($type eq 'blocks') { + + % } + + % } +
<%= $entry->{name} %> + + + + + + + + + + + % if ($entry->{following_back}) { + group + % } + % elsif ($entry->{followback_requested}) { + access_time + % } + % elsif ($entry->{can_follow_back} or $entry->{can_request_follow_back}) { + + % } + + + + +
+ %= end +
+
-- cgit v1.2.3