[Timelines][Plugins][Left] Plugins now provide their path ID. Feed redone as it's own independant template.

This commit is contained in:
Eliseu Amaro 2021-09-22 16:46:58 +01:00
parent 05f16a3084
commit a557ba0224
9 changed files with 30 additions and 91 deletions

View File

@ -48,8 +48,8 @@ class Directory extends Plugin
*/ */
public function onAddMainNavigationItem(array $vars, array &$res): bool public function onAddMainNavigationItem(array $vars, array &$res): bool
{ {
$res[] = ['title' => 'Actors', 'path' => Router::url('directory_actors', [])]; $res[] = ['title' => 'Actors', 'path' => Router::url('directory_actors', []), 'path_id' => 'directory_actors'];
$res[] = ['title' => 'Groups', 'path' => Router::url('directory_groups', [])]; $res[] = ['title' => 'Groups', 'path' => Router::url('directory_groups', []), 'path_id' => 'directory_groups'];
return Event::next; return Event::next;
} }
} }

View File

@ -41,8 +41,9 @@ class Favourite
Event::handle('FormatNoteList', [$notes, &$notes_out]); Event::handle('FormatNoteList', [$notes, &$notes_out]);
return [ return [
'_template' => 'network/public.html.twig', '_template' => 'network/feed.html.twig',
'notes' => $notes_out, 'notes' => $notes_out,
'page_title' => 'Favourites timeline.',
]; ];
} }
public function favouritesByActorNickname(Request $request, string $nickname) public function favouritesByActorNickname(Request $request, string $nickname)
@ -74,8 +75,9 @@ class Favourite
Event::handle('FormatNoteList', [$notes, &$notes_out]); Event::handle('FormatNoteList', [$notes, &$notes_out]);
return [ return [
'_template' => 'network/reversefavs.html.twig', '_template' => 'network/feed.html.twig',
'notes' => $notes, 'notes' => $notes,
'page_title' => 'Reverse favourites timeline.',
]; ];
} }
public function reverseFavouritesByActorNickname(Request $request, string $nickname) public function reverseFavouritesByActorNickname(Request $request, string $nickname)

View File

@ -116,8 +116,8 @@ class Favourite extends NoteHandlerPlugin
public function onAddProfileNavigationItem(array $vars, array &$res): bool public function onAddProfileNavigationItem(array $vars, array &$res): bool
{ {
$res[] = ['title' => 'Favourites', 'path' => Router::url('actor_favourites_nickname', ['nickname' => $vars['nickname']])]; $res[] = ['title' => 'Favourites', 'path' => Router::url('actor_favourites_nickname', ['nickname' => $vars['nickname']]), 'path_id' => 'actor_favourites_nickname'];
$res[] = ['title' => 'Reverse Favourites', 'path' => Router::url('actor_reverse_favourites_nickname', ['nickname' => $vars['nickname']])]; $res[] = ['title' => 'Reverse Favourites', 'path' => Router::url('actor_reverse_favourites_nickname', ['nickname' => $vars['nickname']]), 'path_id' => 'actor_reverse_favourites_nickname'];
return Event::next; return Event::next;
} }

View File

@ -349,6 +349,10 @@ hr {
vertical-align: middle; vertical-align: middle;
} }
.note-actions .form-group {
all: unset;
}
.button-container { .button-container {
all: unset; all: unset;
border: none !important; border: none !important;
@ -446,6 +450,10 @@ hr {
color: var(--white); color: var(--white);
} }
.section-widget hr {
margin-bottom: var(--unit-size);
}
.section-widget-padded { .section-widget-padded {
padding: var(--unit-size); padding: var(--unit-size);
} }

View File

@ -60,8 +60,9 @@ class Network extends Controller
Event::handle('FormatNoteList', [$notes, &$notes_out]); Event::handle('FormatNoteList', [$notes, &$notes_out]);
return [ return [
'_template' => 'network/public.html.twig', '_template' => 'network/feed.html.twig',
'notes' => $notes_out, 'notes' => $notes_out,
'page_title' => 'Public timeline.',
]; ];
} }
@ -103,8 +104,9 @@ END;
Event::handle('FormatNoteList', [$notes, &$notes_out]); Event::handle('FormatNoteList', [$notes, &$notes_out]);
return [ return [
'_template' => 'network/public.html.twig', '_template' => 'network/feed.html.twig',
'notes' => $notes_out, 'notes' => $notes_out,
'page_title' => 'Home timeline.',
]; ];
} }
@ -116,8 +118,9 @@ END;
Event::handle('FormatNoteList', [$notes, &$notes_out]); Event::handle('FormatNoteList', [$notes, &$notes_out]);
return [ return [
'_template' => 'network/public.html.twig', '_template' => 'network/feed.html.twig',
'notes' => $notes_out, 'notes' => $notes_out,
'page_title' => 'Network timeline.',
]; ];
} }
@ -132,8 +135,9 @@ END;
Event::handle('FormatNoteList', [$notes, &$notes_out]); Event::handle('FormatNoteList', [$notes, &$notes_out]);
return [ return [
'_template' => 'network/public.html.twig', '_template' => 'network/feed.html.twig',
'notes' => $notes_out, 'notes' => $notes_out,
'page_title' => 'Replies timeline.',
]; ];
} }
} }

View File

@ -1,6 +1,6 @@
{% extends 'stdgrid.html.twig' %} {% extends 'stdgrid.html.twig' %}
{% block title %}{{ 'Welcome! - Public Timeline' | trans }}{% endblock %} {% block title %}{% if page_title is defined %}{{ page_title | trans }}{% endif %}{% endblock %}
{% block body %} {% block body %}
{# Backwards compatibility with hAtom 0.1 #} {# Backwards compatibility with hAtom 0.1 #}
@ -17,6 +17,4 @@
</div> </div>
</main> </main>
{% endblock body %} {% endblock body %}
{% block javascripts %}{% endblock %}

View File

@ -1,59 +0,0 @@
{% extends 'stdgrid.html.twig' %}
{% block meta %}
{{ parent() }}
{% endblock %}
{% block title %}Welcome!{% endblock %}
{% block stylesheets %}
{{ parent() }}
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/network/public.css') }}"
media="screen and (min-width: 1300px)">
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/network/public_mid.css') }}"
media="screen and (max-width: 1300px)">
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/network/public_small.css') }}"
media="screen and (max-width: 750px)">
<link rel='stylesheet' type='text/css' href="{{ asset('assets/css/network/simple_stream.css') }}">
{% endblock %}
{% block header %}
{{ parent() }}
{% endblock %}
{% block left %}
{{ parent() }}
{% endblock %}
{% block body %}
<div class="content">
<div class="main">
<div class="simple-stream">
<nav class='main-nav'>
<ul>
<li>
<a href="{{ path('main_public') }}"
class='hover-effect {{ active('main_public', 'main_all', "home_all") }}'><p>Reverse
Favourites</p></a>
</li>
</ul>
</nav>
<div class="nav-content">
<div class="timeline">
{% if notes is defined and notes is not empty %}
{% for note in notes %}
{% set id = note.getId() - 1 %}
{% include '/note/view.html.twig' with {'note': note, 'have_user': have_user} only %}
{% endfor %}
{% else %}
<h1>This is {{ user_nickname }}'s reverse favorites stream, but nobody
favored {{ user_nickname }}'s notes yet.</h1>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{% endblock body %}
{% block javascripts %}{% endblock %}

View File

@ -17,17 +17,7 @@
{% if app.user %} {% if app.user %}
<div class="note-actions"> <div class="note-actions">
{% for current_action in get_note_actions(note) %} {% for current_action in get_note_actions(note) %}
{{ form_start(current_action) }} {{ form(current_action) }}
{% if current_action.submit_favourite is defined %}
{{ form_widget(current_action.submit_favourite) }}
{% endif %}
{% if current_action.submit_repeat is defined %}
{{ form_widget(current_action.submit_repeat) }}
{% endif %}
{% if current_action.reply is defined %}
{{ form_widget(current_action.reply) }}
{% endif %}
{{ form_end(current_action) }}
{% endfor %} {% endfor %}
</div> </div>
{% endif %} {% endif %}

View File

@ -10,17 +10,13 @@
{% block profile_view %}{% include 'cards/profile/view.html.twig' with { actor: current_actor } %}{% endblock profile_view %} {% block profile_view %}{% include 'cards/profile/view.html.twig' with { actor: current_actor } %}{% endblock profile_view %}
<nav tabindex="0" class="profile-navigation" title="{{ 'Navigate through account related pages.' | trans }}"> <nav tabindex="0" class="profile-navigation" title="{{ 'Navigate through account related pages.' | trans }}">
<a title='{{ 'Your messages.' | trans }}' href='{{ path('settings') }}' class='{{ active("replies") }}'>
Messages
</a>
<a title='{{ 'Replies to your notes.' | trans }}' href="{{ path('replies', {'nickname' : current_actor.getNickname()}) }}" class='{{ active("replies") }}'> <a title='{{ 'Replies to your notes.' | trans }}' href="{{ path('replies', {'nickname' : current_actor.getNickname()}) }}" class='{{ active("replies") }}'>
Replies Replies
</a> </a>
{% for tab in handle_event('AddProfileNavigationItem', {'nickname': current_actor.getNickname()}) %} {% for tab in handle_event('AddProfileNavigationItem', {'nickname': current_actor.getNickname()}) %}
<a href="{{ tab['path'] }}"> <a href="{{ tab['path'] }}" class='{{ active(tab['path_id']) }}'>
{{ tab['title'] }} {{ tab['title'] }}
</a> </a>
{% endfor %} {% endfor %}
@ -79,7 +75,7 @@
{% if app.user %} {% if app.user %}
{% for link in handle_event('AddMainNavigationItem', {'nickname': current_actor.getNickname()}) %} {% for link in handle_event('AddMainNavigationItem', {'nickname': current_actor.getNickname()}) %}
<li> <li>
<a href="{{ link['path'] }}"> <a href="{{ link['path'] }}" class='{{ active(link['path_id']) }}'>
{{ link['title'] }} {{ link['title'] }}
</a> </a>
</li> </li>