Merge branch 'module_blog' into dev
This commit is contained in:
@@ -40,8 +40,6 @@ class InstallModule extends Command
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
@@ -56,6 +54,9 @@ class InstallModule extends Command
|
||||
// get config
|
||||
$config = $this->loadConfig();
|
||||
|
||||
if (empty($config))
|
||||
return;
|
||||
|
||||
// check if it is valid
|
||||
$this->checkMandatoryFields($config);
|
||||
|
||||
@@ -78,6 +79,9 @@ class InstallModule extends Command
|
||||
$basePath = $this->modulesPath . DIRECTORY_SEPARATOR . $this->moduleName . DIRECTORY_SEPARATOR;
|
||||
$path = $basePath . 'Config' . DIRECTORY_SEPARATOR . 'config.php';
|
||||
|
||||
if (basename($basePath) == 'Database')
|
||||
return [];
|
||||
|
||||
// check if module has Config/config.php file
|
||||
if (!file_exists($path)) {
|
||||
$path = $basePath . 'info.php';
|
||||
|
||||
@@ -38,6 +38,15 @@ class Translations extends Command
|
||||
|
||||
if (!is_dir($defaultLocalesDir)) {
|
||||
// this is the place for checking for submodules
|
||||
|
||||
$modulePath = dirname(dirname($dir));
|
||||
|
||||
if (file_exists($modulePath . '/info.php')) {
|
||||
$modules = File::directories($modulePath);
|
||||
foreach ($modules as $module) {
|
||||
$this->call('translate:dir', ['dir' => $module . '/Resources/lang']);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -197,8 +197,6 @@ class TemplateRegistrator
|
||||
'editable' => 1
|
||||
];
|
||||
|
||||
echo 'ukladam do db '.$templateName."\n";
|
||||
|
||||
// save template into database
|
||||
$newTemplate = Template::create($params);
|
||||
|
||||
|
||||
@@ -32,11 +32,16 @@ class ContentOverview extends Controller
|
||||
{
|
||||
$moduleFilterHandler = false;
|
||||
$perPage = Input::get('perPage') ? Input::get('perPage') : 20;
|
||||
$pageHeading = 'admin/contents.overview';
|
||||
|
||||
// does user want to filter results using module?
|
||||
if (is_numeric($moduleId)) {
|
||||
$module = Module::findOrFail($moduleId);
|
||||
$moduleFilterHandler = $module->handler;
|
||||
|
||||
if (is_callable([$module->handler, 'getOverviewTitle'])) {
|
||||
$pageHeading = call_user_func([$module->handler, 'getOverviewTitle']);
|
||||
}
|
||||
}
|
||||
|
||||
// get pages for overview
|
||||
@@ -47,10 +52,11 @@ class ContentOverview extends Controller
|
||||
$homepage = $this->content->getHomepage();
|
||||
|
||||
return view('admin.content.overview', [
|
||||
'pages' => $pages,
|
||||
'homepage' => $homepage,
|
||||
'statuses' => ContentStatuses::getWithTranslations(),
|
||||
'module' => isset($module) ? $module : null
|
||||
'pages' => $pages,
|
||||
'homepage' => $homepage,
|
||||
'pageHeading' => $pageHeading,
|
||||
'statuses' => ContentStatuses::getWithTranslations(),
|
||||
'module' => isset($module) ? $module : null
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -116,7 +116,9 @@ class CreateNewContent extends Controller
|
||||
}
|
||||
|
||||
// upload file - if provided
|
||||
$page->uploadTitlePhoto($request);
|
||||
$file = $page->uploadTitlePhoto($request);
|
||||
|
||||
$page->title_photo = $file ? $file['filename'] : null;
|
||||
|
||||
// save module-specific stuff
|
||||
call_user_func_array([$module->handler, 'createNew'], [&$page, $request]);
|
||||
|
||||
@@ -118,12 +118,14 @@ class EditContent extends Controller
|
||||
->with('error', trans('admin/contents.invalidPage'));
|
||||
}
|
||||
|
||||
// upload file - if provided
|
||||
$file = $page->uploadTitlePhoto($request);
|
||||
|
||||
$request->url = Str::slug($request->url);
|
||||
$request->parentPage = $request->parentPage ? $request->parentPage : null;
|
||||
$request->titlePhotoFilename = $page->title_photo;
|
||||
|
||||
// upload file - if provided
|
||||
$page->uploadTitlePhoto($request);
|
||||
$request->titlePhotoFilename = $file ? $file['filename'] : null;
|
||||
|
||||
|
||||
// array of fields in database and fields from request
|
||||
$fields = [
|
||||
@@ -142,7 +144,8 @@ class EditContent extends Controller
|
||||
];
|
||||
|
||||
// save new values with history
|
||||
$data = self::getFields($request, $fields);
|
||||
$data = self::getFields($request, array_values($fields));
|
||||
|
||||
list($revision, $changedColumns) = $page->updateWithHistory($fields, $data);
|
||||
|
||||
$changedColumns += call_user_func_array([$page->module_handler, 'edit'], [&$page, $request, $revision]);
|
||||
|
||||
@@ -53,6 +53,9 @@ class ContentPage extends Controller
|
||||
// add one new "view" for page
|
||||
$page->view();
|
||||
|
||||
// decode module settings
|
||||
$page->module_settings = json_decode($page->module_settings);
|
||||
|
||||
// get handler
|
||||
$handler = new $page->module_handler;
|
||||
|
||||
|
||||
@@ -293,10 +293,10 @@ class Content extends Model
|
||||
public function uploadTitlePhoto(Request $request)
|
||||
{
|
||||
if ($request->hasFile('titlePhoto')) {
|
||||
$file = $this->file->upload($request->file('titlePhoto'), $request);
|
||||
|
||||
$this->title_photo = $file['filename'];
|
||||
return $this->file->upload($request->file('titlePhoto'), $request);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -73,6 +73,14 @@ class GlobalViewDataProvider extends ServiceProvider
|
||||
return preg_replace($pattern, $code, $view);
|
||||
});
|
||||
|
||||
// shortcut for displaying Gravatar
|
||||
Blade::extend(function ($view) {
|
||||
$pattern = $this->createPattern('gravatar');
|
||||
$code = '<?php echo \App\Helpers\Gravatar::img($2); ?>';
|
||||
|
||||
return preg_replace($pattern, $code, $view);
|
||||
});
|
||||
|
||||
// shortcut for assets (placed in /public/assets/<theme>
|
||||
Blade::extend(function ($view) {
|
||||
$pattern = $this->createPattern('asset');
|
||||
|
||||
Reference in New Issue
Block a user