Browse Source

update room list menu

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

10
public/css/default.css

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

9
src/Controller/ModuleController.php

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

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

@ -1,10 +1,24 @@ @@ -1,10 +1,24 @@
<form name="room" action="{{ path('room_index') }}" method="get">
<input type="text" name="namespace" value="{{ room.namespace }}" placeholder="{{ 'join room by kevacoin namespace...' | trans }}" />
</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 %}
<h1>{{ room.name }}</h1>
{% endif %}
{# @TODO
{% if list %}
<ul>
{% for namespace, name in list %}

Loading…
Cancel
Save