Browse Source

update room list menu

main
ghost 12 months ago
parent
commit
ed126c5fb0
  1. 10
      public/css/default.css
  2. 7
      src/Controller/ModuleController.php
  3. 16
      templates/default/module/room.html.twig

10
public/css/default.css

@ -64,13 +64,11 @@ main
display: block; display: block;
} }
main > h1 main > h2
{ {
font-size: 14px; display: inline-block;
font-weight: normal; font-size: 12px;
margin: 16px 0; margin: 16px 4px;
padding: 0 4px;
text-align: right;
} }
main > form > input[type="text"] main > form > input[type="text"]

7
src/Controller/ModuleController.php

@ -60,15 +60,22 @@ class ModuleController extends AbstractController
$list = []; $list = [];
$rooms = explode('|', $this->getParameter('app.kevacoin.room.namespaces'));
foreach ((array) $client->kevaListNamespaces() as $value) foreach ((array) $client->kevaListNamespaces() as $value)
{ {
// Get current room namespace (could be third-party)
if ($value['namespaceId'] == $request->get('namespace')) if ($value['namespaceId'] == $request->get('namespace'))
{ {
$name = $value['displayName']; $name = $value['displayName'];
} }
// Check namespace enabled as room in settings
if (in_array($value['namespaceId'], $rooms))
{
$list[$value['namespaceId']] = $value['displayName']; $list[$value['namespaceId']] = $value['displayName'];
} }
}
asort($list); asort($list);

16
templates/default/module/room.html.twig

@ -1,10 +1,24 @@
<form name="room" action="{{ path('room_index') }}" method="get"> <form name="room" action="{{ path('room_index') }}" method="get">
<input type="text" name="namespace" value="{{ room.namespace }}" placeholder="{{ 'join room by kevacoin namespace...' | trans }}" /> <input type="text" name="namespace" value="{{ room.namespace }}" placeholder="{{ 'join room by kevacoin namespace...' | trans }}" />
</form> </form>
{% if list %}
{% set i = 0 %}
{% for namespace, name in list %}
{% if i %}&bull;{% endif %}
<h2>
{% if room.namespace == namespace %}
{{ name }}
{% else %}
<a href="{{ namespace }}">{{ name }}</a>
{% endif %}
</h2>
{% set i = i + 1 %}
{% endfor %}
{% endif %}
{# @TODO alternative implementation draft
{% if room.name %} {% if room.name %}
<h1>{{ room.name }}</h1> <h1>{{ room.name }}</h1>
{% endif %} {% endif %}
{# @TODO
{% if list %} {% if list %}
<ul> <ul>
{% for namespace, name in list %} {% for namespace, name in list %}

Loading…
Cancel
Save