mirror of
https://github.com/kevachat/webapp.git
synced 2025-01-10 23:08:14 +00:00
update room list
This commit is contained in:
parent
471e047465
commit
7c94416550
@ -26,7 +26,7 @@ class ModuleController extends AbstractController
|
|||||||
'wallet' =>
|
'wallet' =>
|
||||||
[
|
[
|
||||||
'balance' => (float) $client->getBalance(),
|
'balance' => (float) $client->getBalance(),
|
||||||
'block' => (int) $client->getBlockCount()
|
'block' => (int) $client->getBlockCount()
|
||||||
],
|
],
|
||||||
'mine' =>
|
'mine' =>
|
||||||
[
|
[
|
||||||
@ -56,37 +56,40 @@ class ModuleController extends AbstractController
|
|||||||
$this->getParameter('app.kevacoin.password')
|
$this->getParameter('app.kevacoin.password')
|
||||||
);
|
);
|
||||||
|
|
||||||
$name = null;
|
|
||||||
|
|
||||||
$list = [];
|
$list = [];
|
||||||
|
|
||||||
$rooms = explode('|', $this->getParameter('app.kevacoin.room.namespaces'));
|
// Get configured rooms list
|
||||||
|
foreach ((array) explode('|', $this->getParameter('app.kevacoin.room.namespaces')) as $namespace)
|
||||||
foreach ((array) $client->kevaListNamespaces() as $value)
|
|
||||||
{
|
{
|
||||||
// Get current room namespace (could be third-party)
|
$list[$namespace] = [
|
||||||
if ($value['namespaceId'] == $request->get('namespace'))
|
'name' => $namespace,
|
||||||
{
|
'namespace' => $namespace,
|
||||||
$name = $value['displayName'];
|
'active' => $namespace === $request->get('namespace')
|
||||||
}
|
];
|
||||||
|
|
||||||
// Check namespace enabled as room in .env
|
|
||||||
if (in_array($value['namespaceId'], $rooms))
|
|
||||||
{
|
|
||||||
$list[$value['namespaceId']] = $value['displayName'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
asort($list);
|
// Find related room names
|
||||||
|
foreach ((array) $client->kevaListNamespaces() as $value)
|
||||||
|
{
|
||||||
|
if (isset($list[$value['namespaceId']]))
|
||||||
|
{
|
||||||
|
$list[$value['namespaceId']]['name'] = $value['displayName'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $this->render(
|
return $this->render(
|
||||||
'default/module/room.html.twig',
|
'default/module/room.html.twig',
|
||||||
[
|
[
|
||||||
'room' => [
|
'list' => array_values(
|
||||||
'name' => $name,
|
$list
|
||||||
'namespace' => $request->get('namespace')
|
),
|
||||||
],
|
'form' =>
|
||||||
'list' => $list
|
[
|
||||||
|
'namespace' =>
|
||||||
|
[
|
||||||
|
'value' => $request->get('namespace')
|
||||||
|
]
|
||||||
|
]
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,40 +1,20 @@
|
|||||||
<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="{{ form.namespace.value }}" placeholder="{{ 'join room by kevacoin namespace...' | trans }}" />
|
||||||
</form>
|
</form>
|
||||||
{% if list %}
|
{% if list %}
|
||||||
{% set i = 0 %}
|
{% for i, room in list %}
|
||||||
{% for namespace, name in list %}
|
|
||||||
{% if i %}•{% endif %}
|
{% if i %}•{% endif %}
|
||||||
<h2>
|
<h2>
|
||||||
{% if namespace == room.namespace %}
|
{% if room.active %}
|
||||||
{{ name }}
|
{{ room.name }}
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="{{ path('room_namespace', { namespace : namespace }) }}">{{ name }}</a>
|
<a href="{{ path('room_namespace', { namespace : room.namespace }) }}">{{ room.name }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</h2>
|
</h2>
|
||||||
<sup>
|
<sup>
|
||||||
<a href="{{ path('room_namespace', { namespace : namespace, feed : 'rss' }) }}" title="{{ 'RSS' | trans }}" target="_blank"><svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 16 16">
|
<a href="{{ path('room_namespace', { namespace : room.namespace, feed : 'rss' }) }}" title="{{ 'RSS' | trans }}" target="_blank"><svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 16 16">
|
||||||
<path d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2zm1.5 2.5c5.523 0 10 4.477 10 10a1 1 0 1 1-2 0 8 8 0 0 0-8-8 1 1 0 0 1 0-2m0 4a6 6 0 0 1 6 6 1 1 0 1 1-2 0 4 4 0 0 0-4-4 1 1 0 0 1 0-2m.5 7a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3"/>
|
<path d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2zm1.5 2.5c5.523 0 10 4.477 10 10a1 1 0 1 1-2 0 8 8 0 0 0-8-8 1 1 0 0 1 0-2m0 4a6 6 0 0 1 6 6 1 1 0 1 1-2 0 4 4 0 0 0-4-4 1 1 0 0 1 0-2m.5 7a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3"/>
|
||||||
</svg></a>
|
</svg></a>
|
||||||
</sup>
|
</sup>
|
||||||
{% set i = i + 1 %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{# @TODO alternative implementation draft
|
|
||||||
{% if room.name %}
|
|
||||||
<h1>{{ room.name }}</h1>
|
|
||||||
{% endif %}
|
|
||||||
{% if list %}
|
|
||||||
<ul>
|
|
||||||
{% for namespace, name in list %}
|
|
||||||
<li>
|
|
||||||
{% if room.namespace == namespace %}
|
|
||||||
{{ name }}
|
|
||||||
{% else %}
|
|
||||||
<a href="{{ namespace }}">{{ name }}</a>
|
|
||||||
{% endif %}
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% endif %}
|
|
||||||
#}
|
|
Loading…
Reference in New Issue
Block a user