[CONTROLLER][ROUTE] Favourites page initial query implementation and routing

This commit is contained in:
rainydaysavings 2020-09-05 05:10:33 +01:00 committed by Hugo Sales
parent 651ec890d6
commit 492360ceeb
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
3 changed files with 15 additions and 1 deletions

View File

@ -120,4 +120,17 @@ END;
),
];
}
public function favourites(Request $request)
{
$actor_id = Common::ensureLoggedIn()->getActor()->getId();
return [
'_template' => 'network/public.html.twig',
'notes' => DB::dql('select f from App\Entity\Favourite f ' .
'where f.gsactor_id = ' . $actor_id .
'order by f.created DESC'
),
];
}
}

View File

@ -51,6 +51,7 @@ abstract class Main
$r->connect('main_all', '/main/all', [C\Network::class, 'network']);
$r->connect('home_all', '/{nickname<' . Nickname::DISPLAY_FMT . '>}/all', [C\Network::class, 'home']);
$r->connect('replies', '/{nickname<' . Nickname::DISPLAY_FMT . '>}/replies', [C\Network::class, 'replies']);
$r->connect('favourites', '/{nickname<' . Nickname::DISPLAY_FMT . '>}/favourites', [C\Network::class, 'favourites']);
$r->connect('panel', '/panel', [C\AdminPanel::class, 'site']);
$r->connect('panel_site', '/panel/site', [C\AdminPanel::class, 'site']);

View File

@ -41,7 +41,7 @@
</div>
<a href='#'>Messages</a>
<a href="{{ path("replies", {'nickname' : user_nickname}) }}" class='hover-effect {{ active("replies") }}'>Replies</a>
<a href='#'>Favourites</a>
<a href="{{ path("favourites", {'nickname' : user_nickname}) }}" class='hover-effect {{ active("favourites") }}'>Favourites</a>
<a href='#'>Reverse Favs</a>
<a href="{{ path('settings_personal_info') }}" class='hover-effect {{ active('settings_') }}'>Settings</a>
<a href='#'>Logout</a>