FIX: lots of bugfixes, sorry for ugly commit

This commit is contained in:
Michal Kváček
2017-02-09 23:10:11 +01:00
parent 99ed8806da
commit b7d4ab9515
47 changed files with 180 additions and 199 deletions
-8
View File
@@ -34,7 +34,6 @@ abstract class BaseHandler implements BaseModuleHandler
* Submenus can be registered later
*/
$menu->dropdown(trans('admin/mainMenu.contentPages'), function ($sub) {
$sub->addDivider(9999);
$sub->route('content.overview', trans('admin/mainMenu.contentPageOverview'), [], 10000, ['icon' => 'fa fa-fw fa-list']);
}, 20, ['icon' => 'fa fa-fw fa-database']);
@@ -96,18 +95,11 @@ abstract class BaseHandler implements BaseModuleHandler
}, 60, ['icon' => 'fa fa-fw fa-file-code-o']);
}
// $menu->dropdown(trans('admin/mainMenu.customFields'), function ($sub) {
// $sub->route('customfields.new', trans('admin/mainMenu.customFieldsNew'), [], 10, ['icon' => 'fa fa-fw fa-code']);
// $sub->route('customfields.overview', trans('admin/mainMenu.customFieldsOverview'), [], 50, ['icon' => 'fa fa-fw fa-code-fork']);
// }, 30, ['icon' => 'fa fa-fw fa-code']);
$sub->route('log.overview', trans('admin/mainMenu.actionLog'), [], 70, ['icon' => 'fa fa-fw fa-history']);
$sub->route('settings.overview', trans('admin/mainMenu.settings'), [], 80, ['icon' => 'fa fa-fw fa-gear']);
}, 10000, ['icon' => 'fa fa-fw fa-gears']);
});
// order
// create menu with user profile
\Menu::create('profileMenu', function ($menu) {
$menu->route('users.detail', trans('admin/userManagement.profile'), [], 10, ['icon' => 'fa fa-fw fa-user icon']);
@@ -1,9 +1,10 @@
<?php
namespace App\CMS\Handlers\Registrators;
use App\CMS\Contracts\Repositories\Template;
use App\CMS\Enumerations\TemplatePaths;
use App\CMS\Enumerations\Templates;
use App\CMS\Contracts\Repositories\Template;
use App\Models\Templates\Template as TemplateModel;
use App\Models\Templates\TemplatePath;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
@@ -134,7 +135,10 @@ class TemplateRegistrator
*/
protected function relativePath($directory)
{
return trim(str_replace(base_path(), '', $directory), '/');
$directory = str_replace('/', DIRECTORY_SEPARATOR, $directory);
$directory = str_replace('\\', DIRECTORY_SEPARATOR, $directory);
return trim(str_replace(base_path(), '', $directory), '\\/');
}
/**
@@ -145,6 +149,10 @@ class TemplateRegistrator
*/
protected function scanForSubdirectories($directory, $name)
{
if (!is_dir($directory)) {
return;
}
$directories = File::directories($directory);
foreach ($directories as $dir) {
@@ -222,7 +230,7 @@ class TemplateRegistrator
];
// save template into database
$newTemplate = Template::create($params);
$newTemplate = TemplateModel::create($params);
// push template into enumeration - so it will not be registered again
Templates::push($newTemplate->id, $templateName);
@@ -295,12 +303,17 @@ class TemplateRegistrator
*
* @return string
*/
private function getTemplateName($template)
protected function getTemplateName($template)
{
$templateName = str_replace($this->registeredPath . DIRECTORY_SEPARATOR, '', $template);
$templateName = $template;
$templateName = str_replace($this->registeredPath, '', $templateName);
$templateName = str_replace('\\', DIRECTORY_SEPARATOR, $templateName);
$templateName = str_replace('/', DIRECTORY_SEPARATOR, $templateName);
$templateName = str_replace(DIRECTORY_SEPARATOR, '.', $templateName);
$templateName = str_replace(Template::TEMPLATE_SUFFIX, '', $templateName);
$templateName = preg_replace('/\.{2,}/', '.', $templateName);
return $this->namespace . $templateName;
return $this->namespace . trim($templateName, '.');
}
}
@@ -8,7 +8,6 @@ class WidgetRegistrator
{
protected $registeredWidgets = [];
/**
* Method used for registering new widgets
*
@@ -51,7 +50,9 @@ class WidgetRegistrator
]);
// install widget (if neccessary)
call_user_func($classname . '::install');
if (is_callable([$classname, 'install'])) {
call_user_func($classname . '::install');
}
}
}
}