[REVERSEFAV] Added reverse favorourites stream/template

This commit is contained in:
Daniel 2020-12-07 16:23:56 +00:00 committed by Hugo Sales
parent 5516a77b33
commit f04923405f
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
5 changed files with 86 additions and 1 deletions

View File

@ -0,0 +1,4 @@
.simple-stream .notes-wrap{
border: none;
box-shadow: none;
}

View File

@ -139,4 +139,28 @@ END;
'order by f.created DESC', ['id' => $actor_id]),
];
}
/**
* Reverse favourites stream
*
* @param Request $request
*
* @throws \App\Util\Exception\NoLoggedInUser user not logged in
*
* @return array template
*/
public function reversefavs(Request $request)
{
$actor_id = Common::ensureLoggedIn()->getId();
return [
'_template' => 'network/reversefavs.html.twig',
'notes' => DB::dql('select n from App\Entity\Note n, App\Entity\Favourite f ' .
'where n.id = f.note_id ' .
'and f.gsactor_id != :id ' .
'and n.gsactor_id = :id ' .
'order by f.created DESC' ,
['id' => $actor_id]),
];
}
}

View File

@ -52,6 +52,7 @@ abstract class Main
$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('reversefavs', '/{nickname<' . Nickname::DISPLAY_FMT . '>}/reversefavs', [C\Network::class, 'reversefavs']);
$r->connect('panel', '/panel', [C\AdminPanel::class, 'site']);
$r->connect('panel_site', '/panel/site', [C\AdminPanel::class, 'site']);

View File

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

View File

@ -0,0 +1,56 @@
{% extends 'left/left.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">
<nav class='main-nav'>
<ul>
<li>
<a href="{{ path('main_public') }}" class='hover-effect {{ active('main_public', 'main_all', "home_all") }}'>Reverse Favourites</a>
</li>
</ul>
</nav>
<div class="simple-stream">
<div class="notes-wrap">
<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 notices yet.</h1>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{% endblock body %}
{% block javascripts %}{% endblock %}