[UI][PLUGIN][Directory] Add sort options to UI
This commit is contained in:
		| @@ -129,11 +129,26 @@ class Directory extends FeedController | ||||
|         }; | ||||
|         // -------- *** -------- | ||||
|  | ||||
|         $sort_options = []; | ||||
|         foreach (self::ALLOWED_FIELDS as $al) { | ||||
|             $sort_options[] = [ | ||||
|                 'active' => false, | ||||
|                 'url'    => '?order_by=' . $al . '^', | ||||
|                 'label'  => _m('{order_by} ascending', ['{order_by}' => ucfirst($al)]), | ||||
|             ]; | ||||
|             $sort_options[] = [ | ||||
|                 'active' => false, | ||||
|                 'url'    => '?order_by=' . $al . 'v', | ||||
|                 'label'  => _m('{order_by} descending', ['{order_by}' => ucfirst($al)]), | ||||
|             ]; | ||||
|         } | ||||
|  | ||||
|         return [ | ||||
|             '_template'     => 'directory/actors.html.twig', | ||||
|             'actors'        => $query_fn($actor_type), | ||||
|             'title'         => $title, | ||||
|             'empty_message' => $empty_message, | ||||
|             'sort_options'  => $sort_options, | ||||
|             'page'          => $page, | ||||
|         ]; | ||||
|     } | ||||
|   | ||||
| @@ -6,6 +6,13 @@ | ||||
| <section class="section-widget section-padding"> | ||||
|     <h2 class="section-title">{{ title }}</h2> | ||||
|  | ||||
|     <div> | ||||
|         <p>{% trans %}Sort by:{% endtrans %}</p> | ||||
|         {% for option in sort_options %} | ||||
|             <a {{ option.active ? 'class="active"' : '' }} href="{{ option.url }}">{{ option.label }}</a> | ||||
|         {% endfor %} | ||||
|     </div> | ||||
|  | ||||
|     <div class="section-padding"> | ||||
|         {% if actors is defined and actors is not empty %} | ||||
|             {% for actor in actors %} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user