forked from zer.ooo/web
update all panel pages
parent
414f17476f
commit
45ee7b2ebc
File diff suppressed because one or more lines are too long
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Eater\Glim\Handler\Panel;
|
||||
|
||||
use Aura\Session\Segment;
|
||||
use Eater\Glim\Handler\Panel;
|
||||
use Eater\Glim\Model\ServerQuery;
|
||||
|
||||
class Servers extends Panel
|
||||
{
|
||||
public function handle()
|
||||
{
|
||||
/** @var Segment $segment */
|
||||
$segment = $this->get('session')->getSegment('main');
|
||||
$this->get('twig-vars')->def('message', $segment->getFlash('message'));
|
||||
|
||||
$superuser = $this->getUser()->getSuperuser();
|
||||
$vars = [
|
||||
'superuser' => $superuser,
|
||||
'servers' => $this->fetchServers()
|
||||
];
|
||||
|
||||
if ($superuser) {
|
||||
$vars['registered_servers'] = $this->fetchServers('registered');
|
||||
}
|
||||
|
||||
return $this->render('panel/servers.html.twig', $vars);
|
||||
}
|
||||
|
||||
public function fetchServers($status = "signed")
|
||||
{
|
||||
return ServerQuery::create()->filterByStatus($status)->find();
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
{% extends "panel.html.twig" %}
|
||||
|
||||
{% block head %}
|
||||
{{ parent() }}
|
||||
|
||||
<script src="/js/clipboard.min.js"></script>
|
||||
<script src="/js/pages/invites.js"></script>
|
||||
{% endblock %}
|
||||
|
||||
{% block panel_contents %}
|
||||
<h1>Servers</h1>
|
||||
{% if message %}
|
||||
<div class="error-message">{{ message }}</div>
|
||||
{% endif %}
|
||||
<ul class="servers">
|
||||
{% for server in servers %}
|
||||
<li>
|
||||
<div class="text">
|
||||
{{ server.getName() }}
|
||||
</div>
|
||||
<div class="actions">
|
||||
<span><a href="/panel/servers/{{ server.getFingerprint() }}">Details</a></span>
|
||||
</div>
|
||||
</li>
|
||||
{% else %}
|
||||
<li>
|
||||
There are no servers :(
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% if superuser %}
|
||||
<h1>Registered servers</h1>
|
||||
<ul class="servers">
|
||||
{% for server in registered_servers %}
|
||||
<li>
|
||||
<div class="text">
|
||||
{{ server.getFingerprint() }}
|
||||
</div>
|
||||
<div class="actions">
|
||||
<span class="delete">
|
||||
<form action="/panel/server/remove" method="post">
|
||||
<input type="hidden" value="{{ server.getFingerprint() }}" name="fingerprint">
|
||||
<button type="submit">remove</button>
|
||||
</form>
|
||||
</span>
|
||||
<span class="edit" >
|
||||
<a href="/panel/server/{{ server.getFingerprint() }}">edit</a>
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
{% else %}
|
||||
<li>No servers registered</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endblock %}
|
Loading…
Reference in New Issue