Merge branch 'dev' into widget_menu

This commit is contained in:
Michal Kváček
2016-04-01 21:57:44 +02:00
147 changed files with 5792 additions and 158 deletions
+5 -5
View File
@@ -65,7 +65,7 @@ abstract class Handler implements AppHandler
// create instance of main menu
\Menu::create('mainMenu', function ($menu) {
$menu->route('admin.dashboard', trans('admin/mainMenu.dashboard'), [], 10, ['icon' => 'fa fa-dashboard']);
// $menu->route('admin.dashboard', trans('admin/mainMenu.dashboard'), [], 10, ['icon' => 'fa fa-dashboard']);
$menu->dropdown(trans('admin/mainMenu.userManagement'), function ($sub) {
$sub->route('users.new', trans('admin/mainMenu.newUser'), [], 10, ['icon' => 'fa fa-user-plus']);
$sub->route('users.detail', trans('admin/mainMenu.userDetail'), [], 20, ['icon' => 'fa fa-user']);
@@ -118,10 +118,10 @@ abstract class Handler implements AppHandler
}
}, 29, ['icon' => 'fa fa-folder-open']);
}
$menu->dropdown(trans('admin/mainMenu.customFields'), function ($sub) {
$sub->route('customfields.new', trans('admin/mainMenu.customFieldsNew'), [], 10, ['icon' => 'fa fa-code']);
$sub->route('customfields.overview', trans('admin/mainMenu.customFieldsOverview'), [], 50, ['icon' => 'fa fa-code-fork']);
}, 30, ['icon' => 'fa fa-code']);
// $menu->dropdown(trans('admin/mainMenu.customFields'), function ($sub) {
// $sub->route('customfields.new', trans('admin/mainMenu.customFieldsNew'), [], 10, ['icon' => 'fa fa-code']);
// $sub->route('customfields.overview', trans('admin/mainMenu.customFieldsOverview'), [], 50, ['icon' => 'fa fa-code-fork']);
// }, 30, ['icon' => 'fa fa-code']);
$menu->route('log.overview', trans('admin/mainMenu.actionLog'), [], 40, ['icon' => 'fa fa-history']);
$menu->route('settings.overview', trans('admin/mainMenu.settings'), [], 50, ['icon' => 'fa fa-gear']);
});
+2 -2
View File
@@ -39,8 +39,8 @@ class History implements HistoryHandler
break;
default:
return trans('admin/history.changedFromTo', [
'from' => $changeset->old_value,
'to' => $changeset->new_value
'from' => is_null($changeset->old_value) ? trans('admin/history.emptyValue') : $changeset->old_value,
'to' => is_null($changeset->new_value) ? trans('admin/history.emptyValue') : $changeset->new_value,
]);
break;
}
@@ -5,14 +5,20 @@ use App\Enumerations\Exceptions\EnumerationExistsException;
use App\Handlers\Contracts\SearchHandler;
use App\Handlers\Contracts\SearchPresenterHandler;
use App\Handlers\Registrators\Items\SearchEngine;
use Symfony\Component\Process\Exception\InvalidArgumentException;
class SearchEngineRegistrator
{
const ADMIN = 'admin';
const VISITOR = 'visitor';
protected $searchEngines;
function __construct($app)
{
$this->searchEngines = [];
$this->searchEngines = [
self::ADMIN => [],
self::VISITOR => []
];
}
/**
@@ -21,37 +27,46 @@ class SearchEngineRegistrator
* @param SearchHandler $search
* @param SearchPresenterHandler $presenter
*
* @param $type
*
* @throws EnumerationExistsException
*/
public function register(SearchHandler $search, SearchPresenterHandler $presenter)
public function register(SearchHandler $search, SearchPresenterHandler $presenter, $type)
{
$this->checkIfRegistered($search->getId());
$this->checkIfRegistered($type, $search->getId());
// register new extension
$this->searchEngines[$search->getId()] = [$search, $presenter];
$this->searchEngines[$type][$search->getId()] = [$search, $presenter];
}
/**
* Getter for all registered extensions
*
* @param $type
*
* @return array
*/
public function get()
public function get($type)
{
return $this->searchEngines;
if (!isset($this->searchEngines[$type])) {
throw new InvalidArgumentException('Invalid type ' . $type);
}
return $this->searchEngines[$type];
}
/**
* Checks if this section is not already defined
*
* @param $type
* @param $id
*
* @throws EnumerationExistsException
*/
private function checkIfRegistered($id)
private function checkIfRegistered($type, $id)
{
if (isset($this->searchEngines[$id])) {
throw new EnumerationExistsException('Already existing search engine ' . $id);
if (isset($this->searchEngines[$type][$id])) {
throw new EnumerationExistsException('Already existing search engine ' . $id . ' in ' . $type);
}
}
}
@@ -21,7 +21,6 @@ class TemplateRegistrator
protected $namespace;
/**
* @var string absolute path to currently registered directory
*
* This variable is set in register() method as $baseDirectory/$path
*/
protected $registeredPath;
@@ -78,7 +77,6 @@ class TemplateRegistrator
/**
* Registers new template path.
*
* This method registeres given path itself with all subdirectories
*
* @param string $path path relatively to root of the project
@@ -140,7 +138,13 @@ class TemplateRegistrator
{
// skip custom directories (contains updated templates only)
$dirName = basename($path);
if ($dirName == Template::EDITED_TEMPLATES_DIRECTORY) {
$ignoredDirectories = [
Template::EDITED_TEMPLATES_DIRECTORY,
Template::ASSETS_DIRECTORY,
Template::MODULES_DIRECTORY
];
if (in_array($dirName, $ignoredDirectories)) {
return;
}
@@ -156,7 +160,6 @@ class TemplateRegistrator
/**
* Registers all templates
*
* This method takes all templates in given directory and registers them into database. Templates registered in
* this way may be used for further manipulation.
*
@@ -259,7 +262,6 @@ class TemplateRegistrator
/**
* Get template name
*
* Converts path to template to corresponding name
*
* @param $template
@@ -38,9 +38,9 @@ class WidgetRegistrator
'name' => $widgetName,
'description' => $widgetDescription
]);
}
// install widget (if neccessary)
call_user_func($classname . '::install');
// install widget (if neccessary)
call_user_func($classname . '::install');
}
}
}