Browse Source

fix room list

main
ghost 1 year ago
parent
commit
21f47db55b
  1. 20
      public/css/default.css
  2. 15
      src/Controller/ModuleController.php
  3. 4
      src/Controller/RoomController.php
  4. 20
      templates/default/module/room.html.twig

20
public/css/default.css

@ -64,6 +64,14 @@ main
display: block; display: block;
} }
main > h1
{
font-size: 14px;
font-weight: normal;
margin: 16px 0;
padding: 0 4px;
}
main > form > input[type="text"] main > form > input[type="text"]
{ {
box-sizing: border-box; box-sizing: border-box;
@ -71,6 +79,18 @@ main > form > input[type="text"]
width: 100%; width: 100%;
} }
main > ul
{
margin-bottom: 16px;
margin-left: 16px;
margin-top: 16px;
}
main > ul > li
{
margin: 8px 0;
}
footer footer
{ {
display: block; display: block;

15
src/Controller/ModuleController.php

@ -48,16 +48,29 @@ class ModuleController extends AbstractController
$this->getParameter('app.kevacoin.password') $this->getParameter('app.kevacoin.password')
); );
$name = null;
$list = []; $list = [];
foreach ((array) $client->kevaListNamespaces() as $value) foreach ((array) $client->kevaListNamespaces() as $value)
{ {
if ($value['namespaceId'] == $request->get('namespace'))
{
$name = $value['displayName'];
}
$list[$value['namespaceId']] = $value['displayName']; $list[$value['namespaceId']] = $value['displayName'];
} }
asort($list);
return $this->render( return $this->render(
'default/module/room.html.twig', 'default/module/room.html.twig',
[ [
'room' => $request->get('room'), 'room' => [
'name' => $name,
'namespace' => $request->get('namespace')
],
'list' => $list 'list' => $list
] ]
); );

4
src/Controller/RoomController.php

@ -65,6 +65,10 @@ class RoomController extends AbstractController
return $this->render( return $this->render(
'default/room/index.html.twig', 'default/room/index.html.twig',
[ [
'room' =>
[
'namespace' => $request->get('namespace')
],
'messages' => $messages, 'messages' => $messages,
'request' => $request 'request' => $request
] ]

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

@ -1,3 +1,21 @@
<form name="room" action="{{ path('room_index') }}" method="get"> <form name="room" action="{{ path('room_index') }}" method="get">
<input type="text" name="room" value="{{ room }}" 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 room.name %}
<h1>{{ room.name }}</h1>
{% endif %}
{# @TODO
{% 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…
Cancel
Save