fixed panel stylesheet

This commit is contained in:
Parziphal 2013-10-02 15:33:41 -05:00
parent 34886a0daf
commit c14289855a
7 changed files with 19 additions and 21 deletions

View File

@ -99,8 +99,8 @@ class Base
$this->setPhpConfig(); $this->setPhpConfig();
$this->_load_files(); $this->_load_files();
$this->_load_active_record(); $this->_load_active_record();
$this->initPlugins();
$this->setDispatcher(); $this->setDispatcher();
$this->initPlugins();
$this->init(); $this->init();
$this->runInitializers(); $this->runInitializers();
} }
@ -156,6 +156,7 @@ class Base
public function router() public function router()
{ {
// if (!$this->_dispatcher) vpe((new \Exception)->getTraceAsString());
return $this->_dispatcher->router(); return $this->_dispatcher->router();
} }

View File

@ -1,6 +0,0 @@
/**
*= require bootstrap
*/
body {
padding-top: 60px;
}

View File

@ -0,0 +1,5 @@
<?= file_get_contents(__DIR__ . '/railspanel-bootstrap.css') ?>
body {
padding-top: 60px;
}

View File

@ -13,13 +13,15 @@ class AdminController extends ApplicationController
public function stylesheet() public function stylesheet()
{ {
$path = realpath(__DIR__ . '/../assets/panel.css'); $file = realpath(__DIR__ . '/../assets/railspanel.css.php');
$file = new Rails\Assets\File('css', $path); ob_start();
$parser = new Rails\Assets\Parser\Base($file); require $file;
$parser->parse(); // $file = new Rails\Assets\File('css', $path);
// $parser = new Rails\Assets\Parser\Base($file);
// $parser->parse();
$this->response()->headers()->setContentType('text/css'); $this->response()->headers()->setContentType('text/css');
$this->render(['text' => $parser->parsedFile()]); $this->render(['text' => ob_get_clean()]);
} }
final public function genTableData() final public function genTableData()

View File

@ -131,11 +131,7 @@ final class Rails
$prefix = str_replace('\\', '/', self::$config->assets->prefix); $prefix = str_replace('\\', '/', self::$config->assets->prefix);
$router = self::application()->router(); $router = self::application()->router();
if ($router && $router->route() && $router->route()->isPanelRoute()) { if (!$router || !$router->route() || !$router->route()->isPanelRoute()) {
$basePaths = [
realpath(Rails::path() . '/../../vendor/assets')
];
} else {
$basePaths = [ $basePaths = [
str_replace('\\', '/', Rails::config()->paths->application) . $prefix, str_replace('\\', '/', Rails::config()->paths->application) . $prefix,
str_replace('\\', '/', Rails::root() . '/lib') . $prefix, str_replace('\\', '/', Rails::root() . '/lib') . $prefix,
@ -167,7 +163,7 @@ final class Rails
self::$assets->addPaths($paths); self::$assets->addPaths($paths);
self::$assets->addFilePatterns($this->config()->patterns->toArray(); self::$assets->addFilePatterns(self::config()->assets->patterns->toArray());
} }
return self::$assets; return self::$assets;
} }
@ -434,9 +430,10 @@ final class Rails
$autoloadFile = defined("COMPOSER_AUTOLOAD_FILE") ? $autoloadFile = defined("COMPOSER_AUTOLOAD_FILE") ?
COMPOSER_AUTOLOAD_FILE : COMPOSER_AUTOLOAD_FILE :
Rails::path() . '/../../../autoload.php'; Rails::path() . '/../../../../autoload.php';
self::$loader->setComposerAutoload(require $autoloadFile); self::$loader->setComposerAutoload(require $autoloadFile);
// $loader = require $autoloadFile;
// vpe($loader->loadClass("Rails\Bootstrap2\Initializer"));
spl_autoload_register([Rails::loader(), 'loadClass']); spl_autoload_register([Rails::loader(), 'loadClass']);
set_exception_handler('Rails::exceptionHandler'); set_exception_handler('Rails::exceptionHandler');

1
vendor/README vendored
View File

@ -1 +0,0 @@
This assets folder is used by the Rails Panel.