Skip to content
This repository has been archived by the owner on Aug 4, 2019. It is now read-only.

Commit

Permalink
Refactor /manage and SlateAdmin backend configuration into namespaced…
Browse files Browse the repository at this point in the history
… class pair
  • Loading branch information
themightychris committed Jan 21, 2018
1 parent d7cdab0 commit 03f937f
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 16 deletions.
11 changes: 0 additions & 11 deletions php-classes/SlateAdmin.php

This file was deleted.

13 changes: 13 additions & 0 deletions php-classes/SlateAdmin/RequestHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace SlateAdmin;


class RequestHandler extends \Emergence\Site\RequestHandler
{
public static function handleRequest()
{
$GLOBALS['Session']->requireAccountLevel('Staff');
return static::sendResponse(WebApp::load()->render(), 'webapps/SlateAdmin');
}
}
29 changes: 29 additions & 0 deletions php-classes/SlateAdmin/WebApp.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace SlateAdmin;


class WebApp extends \Emergence\WebApps\SenchaApp
{
public static $plugins = [];


public static function getPlugins()
{
return static::$plugins;
}

public static function load($name = 'SlateAdmin')
{
return parent::load($name);
}

public function render()
{
$response = parent::render();

$response->setPayloadKey('plugins', static::getPlugins());

return $response;
}
}
6 changes: 1 addition & 5 deletions site-root/manage.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
<?php

$GLOBALS['Session']->requireAccountLevel('Staff');

$app = Emergence\WebApps\App::get('SlateAdmin');

Emergence\Site\RequestHandler::sendResponse($app->render(), 'webapps/SlateAdmin');
SlateAdmin\RequestHandler::handleRequest();

0 comments on commit 03f937f

Please sign in to comment.