Archived
1
0
Fork 0

add deselect server

This commit is contained in:
Varakh 2018-04-05 16:26:12 +02:00
parent ab56fde2a1
commit c05b1e8d06
9 changed files with 27 additions and 6 deletions

View file

@ -34,6 +34,7 @@ class ACL extends \Zend\Permissions\Acl\Acl
'/servers/create',
'/servers/{sid}',
'/servers/select/{sid}',
'/servers/deselect',
'/servers/delete/{sid}',
'/servers/start/{sid}',
'/servers/stop/{sid}',

View file

@ -1,7 +1,6 @@
# site
site_title="Teamspeak 3 Web"
site_url="http://localhost:8080"
site_index="/servers" # values: "/", "..."
site_language="en" # values: each yml you specified in data/locale/
site_date_format="d.m.Y H:i:s" # values: all possible for Date::class

View file

@ -85,6 +85,11 @@ $container[ServerSelectAction::class] = function ($container) {
};
$app->get('/servers/select/{sid}', ServerSelectAction::class);
$container[ServerDeselectAction::class] = function ($container) {
return new ServerDeselectAction($container);
};
$app->get('/servers/deselect', ServerDeselectAction::class);
$container[ServerDeleteAction::class] = function ($container) {
return new ServerDeleteAction($container);
};

View file

@ -7,6 +7,6 @@ final class IndexAction extends AbstractAction
{
public function __invoke(Request $request, Response $response, $args)
{
return $response->withRedirect(getenv('site_index'));
return $response->withRedirect('/servers');
}
}

View file

@ -0,0 +1,17 @@
<?php
use Slim\Http\Request;
use Slim\Http\Response;
final class ServerDeselectAction extends AbstractAction
{
public function __invoke(Request $request, Response $response, $args)
{
// remove selected server from session
$this->session->delete('sid');
$this->session->delete('name');
$this->flash->addMessage('success', $this->translator->trans('done'));
return $response->withRedirect('/servers');
}
}

View file

@ -30,7 +30,6 @@ class BootstrapHelper
$env->required([
'site_title',
'site_url',
'site_index',
'site_language',
'site_date_format',
'theme',

View file

@ -11,7 +11,7 @@
<div class="container-fluid">
<div class="row">
<div class="col-xs-3">
<h1><a href="{{ getenv('site_index') }}">{{ getenv('site_title') }}</a></h1>
<h1><a href="/servers">{{ getenv('site_title') }}</a></h1>
{% if currentUser is not empty %}
<h4 class="label label-primary">{% trans with {'%username%': currentUser.user|upper} %}

View file

@ -1,4 +1,4 @@
<ol class="breadcrumb">
<li><a href="{{ getenv('site_index') }}"><i class="material-icons">home</i></a></li>
<li><a href="/servers"><i class="material-icons">home</i></a></li>
<li class="active">{{ title | default('') }}</li>
</ol>

View file

@ -14,7 +14,7 @@
{% if session_exists('sid') %}
<hr/>
{% if session_exists('sname') %}
<h6 class="header" data-target="#page">{{ session_get('sname') }}</h6>
<h6 class="header" data-target="#page"><a class="small" href="/servers/deselect"><i class="material-icons">close</i></a> {{ session_get('sname') }}</h6>
{% endif %}
<a href="/servers/{{ session_get('sid') }}">
<li class="active withripple" data-target="#page">{% trans %}menu.servers.info{% endtrans %}</li>