forked from GNUsocial/gnu-social
[PLUGIN][Directory] Make it list groups
This commit is contained in:
parent
de148c1f78
commit
d03572e366
@ -24,6 +24,7 @@ declare(strict_types = 1);
|
||||
namespace Plugin\Directory\Controller;
|
||||
|
||||
use App\Core\DB\DB;
|
||||
use App\Entity\Actor;
|
||||
use Component\Feed\Util\FeedController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
@ -38,7 +39,7 @@ class Directory extends FeedController
|
||||
{
|
||||
return [
|
||||
'_template' => 'directory/actors.html.twig',
|
||||
'actors' => DB::dql('select a from actor a order by a.nickname ASC'),
|
||||
'actors' => DB::findBy(Actor::class, ['type' => Actor::PERSON], order_by: ['created' => 'DESC', 'nickname' => 'ASC']),
|
||||
];
|
||||
}
|
||||
|
||||
@ -51,7 +52,7 @@ class Directory extends FeedController
|
||||
{
|
||||
return [
|
||||
'_template' => 'directory/groups.html.twig',
|
||||
'groups' => DB::dql('select g from group g order by g.nickname ASC'),
|
||||
'groups' => DB::findBy(Actor::class, ['type' => Actor::GROUP], order_by: ['created' => 'DESC', 'nickname' => 'ASC']),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -35,8 +35,8 @@ class Directory extends Plugin
|
||||
*/
|
||||
public function onAddRoute(RouteLoader $r)
|
||||
{
|
||||
$r->connect('directory_actors', '/actors', [Controller\Directory::class, 'actors']);
|
||||
$r->connect('directory_groups', '/groups', [Controller\Directory::class, 'groups']);
|
||||
$r->connect('directory_actors', '/directory/actors', [Controller\Directory::class, 'actors']);
|
||||
$r->connect('directory_groups', '/directory/groups', [Controller\Directory::class, 'groups']);
|
||||
|
||||
return Event::next;
|
||||
}
|
||||
|
@ -1,31 +0,0 @@
|
||||
{% extends 'stdgrid.html.twig' %}
|
||||
|
||||
{% set nickname = group.getNickname() %}
|
||||
|
||||
{% block title %}{{ nickname }}'s page{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="group">
|
||||
<div class="group-content">
|
||||
<a href="{{ group.getHomepage() }}">
|
||||
<div class="group-info">
|
||||
|
||||
<div class="group-img">
|
||||
<img class="icon icon-group" src="{{ group.getStreamLogo() }}" alt="{{ nickname }}'s logo">
|
||||
</div>
|
||||
<div class="group-nickname">
|
||||
<b id="nick">{{ nickname }}</b>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
{% set group_description = group.getDescription() %}
|
||||
<div class="group-description">
|
||||
{% if group_description %}
|
||||
<p>{{ group_description }}</p>
|
||||
{% else %}
|
||||
<p>{{ '(No description)' | trans }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock body %}
|
@ -3,15 +3,18 @@
|
||||
{% block title %}Groups{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="feed">
|
||||
<div class="groups">
|
||||
{% if groups is defined and groups is not empty %}
|
||||
{% for group in groups %}
|
||||
{% include 'directory/group.html.twig' with {'group': group, 'have_user': have_user} only %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<h1>{% trans %}No groups here.{% endtrans %}</h1>
|
||||
{% endif %}
|
||||
</div>
|
||||
<section class="section-widget section-padding">
|
||||
<h2 class="section-title">{{ "Groups" | trans }}</h2>
|
||||
|
||||
<div class="section-padding">
|
||||
{% if groups is defined and groups is not empty %}
|
||||
{% for actor in groups %}
|
||||
{% block profile_view %}{% include 'cards/profile/view.html.twig' %}{% endblock profile_view %}
|
||||
<hr>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<h1>{% trans %}No groups here.{% endtrans %}</h1>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock body %}
|
||||
</section>
|
||||
{% endblock body %}
|
Loading…
Reference in New Issue
Block a user