diff --git a/plugins/Directory/Controller/Directory.php b/plugins/Directory/Controller/Directory.php index 6ed92445be..065fc10ceb 100644 --- a/plugins/Directory/Controller/Directory.php +++ b/plugins/Directory/Controller/Directory.php @@ -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']), ]; } } diff --git a/plugins/Directory/Directory.php b/plugins/Directory/Directory.php index 3e944f9e51..fbd38da55e 100644 --- a/plugins/Directory/Directory.php +++ b/plugins/Directory/Directory.php @@ -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; } diff --git a/plugins/Directory/templates/directory/group.html.twig b/plugins/Directory/templates/directory/group.html.twig deleted file mode 100644 index d84b0537ae..0000000000 --- a/plugins/Directory/templates/directory/group.html.twig +++ /dev/null @@ -1,31 +0,0 @@ -{% extends 'stdgrid.html.twig' %} - -{% set nickname = group.getNickname() %} - -{% block title %}{{ nickname }}'s page{% endblock %} - -{% block body %} -
-
- -
- -
- {{ nickname }}'s logo -
-
- {{ nickname }} -
-
-
- {% set group_description = group.getDescription() %} -
- {% if group_description %} -

{{ group_description }}

- {% else %} -

{{ '(No description)' | trans }}

- {% endif %} -
-
-
-{% endblock body %} diff --git a/plugins/Directory/templates/directory/groups.html.twig b/plugins/Directory/templates/directory/groups.html.twig index 646d092b6f..81876c9437 100644 --- a/plugins/Directory/templates/directory/groups.html.twig +++ b/plugins/Directory/templates/directory/groups.html.twig @@ -3,15 +3,18 @@ {% block title %}Groups{% endblock %} {% block body %} -
-
- {% 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 %} -

{% trans %}No groups here.{% endtrans %}

- {% endif %} -
+
+

{{ "Groups" | trans }}

+ +
+ {% 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 %} +
+ {% endfor %} + {% else %} +

{% trans %}No groups here.{% endtrans %}

+ {% endif %}
-{% endblock body %} +
+{% endblock body %} \ No newline at end of file