[Directory] Almost finishied creating the /actors stream - problems with the css files

This commit is contained in:
Angelo D. Moura 2020-11-29 04:55:23 +00:00 committed by Hugo Sales
parent 517cba3510
commit 0c5941f515
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
5 changed files with 140 additions and 6 deletions

View File

@ -141,8 +141,21 @@ END;
public function actors(Request $request)
{
return [
'_template' => 'network/public.html.twig',
];
if (Common::isLoggedIn()) {
$user_id = Common::ensureLoggedIn()->getId();
return [
'_template' => 'network/actors.html.twig',
'actors' => DB::dql('select a from App\Entity\GSActor a ' .
'where a.id != :id ' .
'order by a.created DESC', ['id' => $user_id]),
];
} else {
return [
'_template' => 'network/actors.html.twig',
'actors' => DB::dql('select a from App\Entity\GSActor a ' .
'order by a.created DESC'),
];
}
}
}

View File

@ -24,6 +24,7 @@ namespace App\Entity;
use App\Core\Cache;
use App\Core\DB\DB;
use App\Core\Entity;
use App\Core\Event;
use App\Core\UserRoles;
use DateTimeInterface;
use Functional as F;
@ -204,6 +205,13 @@ class GSActor extends Entity
// }}} Autocode
public function getAvatarUrl()
{
$url = null;
Event::handle('get_avatar_url', [$this->getNickname(), &$url]);
return $url;
}
public static function getFromId(int $id): ?self
{
return Cache::get('gsactor-id-' . $id, function () use ($id) {

View File

@ -25,9 +25,90 @@
{% endblock %}
{% block body %}
<div class="content">
{% if post_form is defined %}
{{ form_start(post_form) }}
<div class="create-notice">
<div class="target">
<div class="target-top">
{{ form_label(post_form.to) }}
</div>
<div class="target-bot">
{{ form_widget(post_form.to) }}
</div>
</div>
<div class="create-right">
<div class="create-top-right">
<div class="scope">
{{ form_row(post_form.visibility) }}
</div>
<div class="tabs">
{% for tab in tabs %}
<a href={{ path(tab['href']) }}>{{ tab['title'] }}</a>
{% endfor %}
</div>
</div>
<div class="input-wrapper">
<div class="content-input">
{{ form_row(post_form.content) }}
</div>
</div>
<div class="notice-options">
<div class="attachments">
{{ form_widget(post_form.attachments) }}
<label for="{{ post_form.attachments.vars.id }}">
{{ icon('attach', 'icon icon-attach') | raw }}
</label>
</div>
<div class="post">
{{ form_row(post_form.post) }}
</div>
</div>
</div>
</div>
{{ form_end(post_form) }}
{% endif %}
<div class="main">
<nav class='main-nav'>
<ul>
<li>
<a href="{{ path('main_public') }}" class='hover-effect {{ active('main_public', 'main_all', "home_all") }}'>Timeline</a>
</li>
</ul>
</nav>
<div class="notes-wrap">
<nav class='main-nav'>
<ul>
<li>
<a href="{{ path('main_public') }}" class='hover-effect {{ active('main_public') }}'>Public</a>
</li>
{% if user_nickname is defined %}
<li>
<a href="{{ path("home_all", {'nickname' : user_nickname}) }}" class='hover-effect {{ active("home_all") }}'>Home</a>
</li>
{% endif %}
<li>
<a href="{{ path('main_all') }}" class='hover-effect {{ active('main_all') }}'>Network</a>
</li>
<li>
<a href="{{ path('actors') }}" class='hover-effect {{ active('actors') }}'>Actors</a>
</li>
</ul>
</nav>
<div class="timeline">
<div class="notes actors">
{% if actors is defined and actors is not empty %}
{% for actor in actors %}
{% include '/note/actor.html.twig' with {'actor': actor, 'have_user': have_user} only %}
{% endfor %}
{% else %}
<h1>{% trans %}No actors here.{% endtrans %}</h1>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{% endblock body %}
{% block javascripts %}{% endblock %}

View File

@ -90,6 +90,9 @@
<li>
<a href="{{ path('main_all') }}" class='hover-effect {{ active('main_all') }}'>Network</a>
</li>
<li>
<a href="{{ path('actors') }}" class='hover-effect {{ active('actors') }}'>Actors</a>
</li>
{% for tab in main_nav_tabs %}
<li>
<a href="{{ path(tab['route']) }}" class='hover-effect {{ active(tab['route']) }}' >{{ tab['title'] }}</a>

View File

@ -0,0 +1,29 @@
<div class="note actor">
<div class="note-content">
{% set nickname = actor.getNickname() %}
<div class="actor-avatar">
<img class="icon icon-avatar" src="{{ actor.getAvatarUrl() }}" alt="{{ nickname }}'s avatar">
</div>
<div class="actor-info">
<b id="nick">{{ nickname }}</b>
{% set actor_tags = actor.getSelfTags() %}
<div class="tags">
{% if actor_tags %}
{% for tag in actor_tags %}
<a href='#'><i> #{{ tag }} </i></a>
{% endfor %}
{% else %}
<i> {{ '(No tags)' | trans }} </i>
{% endif %}
</div>
</div>
{% set actor_bio = actor.getBio() %}
<div class="actor-bio note-content">
{% if actor_bio %}
<p>{{ actor_bio }}</p>
{% else %}
<p>{{ '(No bio)' | trans }}</p>
{% endif %}
</div>
</div>
</div>