forked from GNUsocial/gnu-social
[Directory] Moved /actors stream to directory plugin
This commit is contained in:
parent
6c1b1323a0
commit
019e3d91e4
@ -26,9 +26,9 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class Directory
|
||||
{
|
||||
public function people(Request $request)
|
||||
public function actors(Request $request)
|
||||
{
|
||||
return ['_template' => 'directory/people.html.twig', 'people' => DB::dql('select g from App\Entity\GSActor g order by g.nickname ASC')];
|
||||
return ['_template' => 'directory/actors.html.twig', 'actors' => DB::dql('select g from App\Entity\GSActor g order by g.nickname ASC')];
|
||||
}
|
||||
|
||||
public function groups(Request $request)
|
||||
|
@ -28,8 +28,27 @@ class Directory extends Module
|
||||
{
|
||||
public function onAddRoute($r)
|
||||
{
|
||||
$r->connect('people', '/people', [Controller\Directory::class, 'people']);
|
||||
$r->connect('actors', '/actors', [Controller\Directory::class, 'actors']);
|
||||
$r->connect('groups', '/groups', [Controller\Directory::class, 'groups']);
|
||||
return Event::next;
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate twig vars
|
||||
*
|
||||
* @param array $vars
|
||||
*
|
||||
* @return bool hook value; true means continue processing, false means stop.
|
||||
*/
|
||||
public function onStartTwigPopulateVars(array &$vars): bool
|
||||
{
|
||||
if (array_key_exists('main_nav_tabs',$vars)) {
|
||||
$vars['main_nav_tabs'] = [];
|
||||
}
|
||||
$vars['main_nav_tabs'][] = ['title' => 'Actors',
|
||||
'route' => 'actors',
|
||||
];
|
||||
|
||||
return Event::next;
|
||||
}
|
||||
}
|
||||
|
50
public/assets/css/directory/actors.css
Normal file
50
public/assets/css/directory/actors.css
Normal file
@ -0,0 +1,50 @@
|
||||
/*actors stream*/
|
||||
.actors{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.notes-wrap .timeline .actors > div {
|
||||
margin: var(--unit-size) var(--unit-size) 0 var(--unit-size);
|
||||
border-radius: var(--unit-size);
|
||||
width: 100%;
|
||||
}
|
||||
.notes-wrap .timeline .actors > div:last-child {
|
||||
margin: var(--unit-size) var(--unit-size) var(--unit-size) var(--unit-size);
|
||||
}
|
||||
|
||||
.actor{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
border: solid 2px var(--accent-low);
|
||||
border-radius: var(--unit-size);
|
||||
box-shadow: var(--shadow);
|
||||
margin-bottom: var(--unit-size);
|
||||
}
|
||||
|
||||
.actor-content {
|
||||
order: 3;
|
||||
word-break: break-word;
|
||||
padding: var(--small-size);
|
||||
border-radius: 0 0 var(--unit-size) var(--unit-size);
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.actor-info{
|
||||
order: 3;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.actor-bio{
|
||||
order: 3;
|
||||
word-break: break-word;
|
||||
padding: var(--small-size);
|
||||
border-radius: 0 0 var(--unit-size) var(--unit-size);
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: right;
|
||||
}
|
31
templates/directory/actor.html.twig
Normal file
31
templates/directory/actor.html.twig
Normal file
@ -0,0 +1,31 @@
|
||||
<div class="actor">
|
||||
<div class="actor-content">
|
||||
<div class="actor-info">
|
||||
{% set nickname = actor.getNickname() %}
|
||||
<div class="actor-avatar">
|
||||
<img class="icon icon-avatar" src="{{ actor.getAvatarUrl() }}" alt="{{ nickname }}'s avatar">
|
||||
</div>
|
||||
<div class="actor-nickname-and-tags">
|
||||
<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>
|
||||
</div>
|
||||
{% set actor_bio = actor.getBio() %}
|
||||
<div class="actor-bio">
|
||||
{% if actor_bio %}
|
||||
<p>{{ actor_bio }}</p>
|
||||
{% else %}
|
||||
<p>{{ '(No bio)' | trans }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
115
templates/directory/actors.html.twig
Normal file
115
templates/directory/actors.html.twig
Normal file
@ -0,0 +1,115 @@
|
||||
{% extends 'left/left.html.twig' %}
|
||||
|
||||
{% block meta %}
|
||||
{{ parent() }}
|
||||
{% endblock %}
|
||||
|
||||
{% block title %}Actors{% 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/directory/actors.css') }}"">
|
||||
{% endblock %}
|
||||
|
||||
{% block header %}
|
||||
{{ parent() }}
|
||||
{% endblock %}
|
||||
|
||||
{% block left %}
|
||||
{{ parent() }}
|
||||
{% 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="actors">
|
||||
{% if actors is defined and actors is not empty %}
|
||||
{% for actor in actors %}
|
||||
{% include '/directory/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,11 @@
|
||||
<li>
|
||||
<a href="{{ path('main_all') }}" class='hover-effect {{ active('main_all') }}'>Network</a>
|
||||
</li>
|
||||
{% for tab in main_nav_tabs %}
|
||||
<li>
|
||||
<a href="{{ path(tab['route']) }}" class='hover-effect {{ active(tab['route']) }}' >{{ tab['title'] }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</nav>
|
||||
<div class="timeline">
|
||||
|
Loading…
Reference in New Issue
Block a user