[Directory] Almost finishied creating the /actors stream - problems with the css files
This commit is contained in:
parent
517cba3510
commit
0c5941f515
@ -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'),
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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 %}
|
@ -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>
|
||||
|
29
templates/note/actor.html.twig
Normal file
29
templates/note/actor.html.twig
Normal 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>
|
Loading…
Reference in New Issue
Block a user