FEATURE: translations
This commit is contained in:
+5
-6
@@ -1,8 +1,8 @@
|
|||||||
APP_ENV=testing
|
APP_KEY=
|
||||||
APP_DEBUG=true
|
APP_ENV=
|
||||||
APP_KEY=ZKZAzM23wQ6BPji6zffBjaTzZ3yW7zKQ
|
APP_DEBUG=
|
||||||
|
|
||||||
DB_HOST=localhost
|
DB_HOST=
|
||||||
DB_DATABASE=
|
DB_DATABASE=
|
||||||
DB_USERNAME=
|
DB_USERNAME=
|
||||||
DB_PASSWORD=
|
DB_PASSWORD=
|
||||||
@@ -16,5 +16,4 @@ MAIL_PASSWORD=
|
|||||||
|
|
||||||
SITE_URL=/
|
SITE_URL=/
|
||||||
UPLOAD_URL=/public/uploads
|
UPLOAD_URL=/public/uploads
|
||||||
THUMBNAILS_URL=/uploads/thumbnails
|
THUMBNAILS_URL=/uploads/thumbnails
|
||||||
THEME=
|
|
||||||
+3
-2
@@ -1,8 +1,9 @@
|
|||||||
# published files from modules
|
# published files from modules
|
||||||
/resources/views/modules
|
|
||||||
/public/modules
|
/public/modules
|
||||||
/resources/views/vendor
|
|
||||||
/public/assets
|
/public/assets
|
||||||
|
/resources/views/modules
|
||||||
|
/resources/views/visitor
|
||||||
|
/resources/views/vendor
|
||||||
|
|
||||||
# directories with custom templates
|
# directories with custom templates
|
||||||
**/views/**/custom/*
|
**/views/**/custom/*
|
||||||
|
|||||||
@@ -40,8 +40,6 @@ class InstallModule extends Command
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Execute the console command.
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
@@ -56,6 +54,9 @@ class InstallModule extends Command
|
|||||||
// get config
|
// get config
|
||||||
$config = $this->loadConfig();
|
$config = $this->loadConfig();
|
||||||
|
|
||||||
|
if (empty($config))
|
||||||
|
return;
|
||||||
|
|
||||||
// check if it is valid
|
// check if it is valid
|
||||||
$this->checkMandatoryFields($config);
|
$this->checkMandatoryFields($config);
|
||||||
|
|
||||||
@@ -78,6 +79,9 @@ class InstallModule extends Command
|
|||||||
$basePath = $this->modulesPath . DIRECTORY_SEPARATOR . $this->moduleName . DIRECTORY_SEPARATOR;
|
$basePath = $this->modulesPath . DIRECTORY_SEPARATOR . $this->moduleName . DIRECTORY_SEPARATOR;
|
||||||
$path = $basePath . 'Config' . DIRECTORY_SEPARATOR . 'config.php';
|
$path = $basePath . 'Config' . DIRECTORY_SEPARATOR . 'config.php';
|
||||||
|
|
||||||
|
if (basename($basePath) == 'Database')
|
||||||
|
return [];
|
||||||
|
|
||||||
// check if module has Config/config.php file
|
// check if module has Config/config.php file
|
||||||
if (!file_exists($path)) {
|
if (!file_exists($path)) {
|
||||||
$path = $basePath . 'info.php';
|
$path = $basePath . 'info.php';
|
||||||
|
|||||||
@@ -0,0 +1,78 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Models\Module;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
|
|
||||||
|
class SetTemplate extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'template:set {template} {publish?}';
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'Install template';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$template = $this->argument('template');
|
||||||
|
$publish = $this->argument('publish') !== 'no-publish';
|
||||||
|
|
||||||
|
$templatePath = app_path('../templates/' . $template);
|
||||||
|
if (!is_dir($templatePath) || !file_exists($templatePath . '/config.php')) {
|
||||||
|
throw new NotFoundHttpException('Invalid template ' . $template . '!');
|
||||||
|
}
|
||||||
|
|
||||||
|
// try to find currently installed template
|
||||||
|
$current = Module::where('is_template', true)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
// install template
|
||||||
|
$config = @include $templatePath . '/config.php';
|
||||||
|
$config['staticName'] = $template;
|
||||||
|
|
||||||
|
if ($current) {
|
||||||
|
$info = json_decode($current->module_settings);
|
||||||
|
|
||||||
|
$this->line('Template is already installed. Currently using template ' . trans($current->name) . ' located in /templates/' . $info->staticName.'.');
|
||||||
|
$confirm = $this->ask('Uninstall it and install *' . trans($config['name']) . '*? All data associated with installed template will be lost! [y/n]');
|
||||||
|
|
||||||
|
if ($confirm === 'y') {
|
||||||
|
$this->line('Uninstalling ' . $current->name . '.');
|
||||||
|
$current->uninstall();
|
||||||
|
} else {
|
||||||
|
$this->line('Aborting installation.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Module::install($config['name'], $config['alias'], $config['description'], $config['handler'], false, $config);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$this->error('Cannot install template ' . $template . '. Message: ' . $e->getMessage());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// theme written
|
||||||
|
$this->line('Template successfully set up.');
|
||||||
|
|
||||||
|
if ($publish) {
|
||||||
|
$this->line('');
|
||||||
|
$this->line(' ** PUBLISHING ASSETS AND VIEWS **');
|
||||||
|
// publish assets and views for module and theme
|
||||||
|
$this->call('vendor:publish');
|
||||||
|
$this->call('vendor:publish', ['--tag' => ['public-assets'], '--force' => true]);
|
||||||
|
$this->call('vendor:publish', ['--tag' => ['module-views'], '--force' => true]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
|
||||||
|
|
||||||
use Illuminate\Console\Command;
|
|
||||||
use Illuminate\Support\Str;
|
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|
||||||
|
|
||||||
class SetTheme extends Command
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The name and signature of the console command.
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $signature = 'theme:set {theme_name}';
|
|
||||||
/**
|
|
||||||
* The console command description.
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $description = 'Set theme for visitor area';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new command instance.
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Execute the console command.
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function handle()
|
|
||||||
{
|
|
||||||
$theme = $this->argument('theme_name');
|
|
||||||
|
|
||||||
if (!is_dir(resource_path('views/visitor/' . $theme))) {
|
|
||||||
throw new NotFoundHttpException('Invalid theme ' . $theme . '!');
|
|
||||||
}
|
|
||||||
|
|
||||||
// load .env file
|
|
||||||
$envFile = base_path('.env');
|
|
||||||
$env = file_get_contents($envFile);
|
|
||||||
|
|
||||||
if (!Str::contains($env, 'THEME=')) {
|
|
||||||
$env = sprintf("%s\nTHEME=%s\n", $env, $theme);
|
|
||||||
} else {
|
|
||||||
$env = preg_replace('/THEME=(.*)/i', 'THEME=' . $theme, $env, -1, $cnt);
|
|
||||||
}
|
|
||||||
|
|
||||||
// try to write content
|
|
||||||
$bytesWritten = file_put_contents($envFile, $env);
|
|
||||||
|
|
||||||
// check if write was successfull
|
|
||||||
if (!$bytesWritten) {
|
|
||||||
throw new \Exception('Cannot write to ' . base_path('.env') . '. Add THEME=' . $theme . ' to your .env file manualy.');
|
|
||||||
}
|
|
||||||
|
|
||||||
// theme written
|
|
||||||
$this->line('Theme successfully setup.');
|
|
||||||
$this->line('');
|
|
||||||
$this->line(' ** PUBLISHING ASSETS AND VIEWS **');
|
|
||||||
// publish assets and views for module and theme
|
|
||||||
$this->call('vendor:publish', ['--tag' => ['public-assets'], '--force' => true]);
|
|
||||||
$this->call('vendor:publish', ['--tag' => ['module-views'], '--force' => true]);
|
|
||||||
$this->call('vendor:publish');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -38,6 +38,15 @@ class Translations extends Command
|
|||||||
|
|
||||||
if (!is_dir($defaultLocalesDir)) {
|
if (!is_dir($defaultLocalesDir)) {
|
||||||
// this is the place for checking for submodules
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class Kernel extends ConsoleKernel
|
|||||||
Commands\Translations::class,
|
Commands\Translations::class,
|
||||||
Commands\TranslateAll::class,
|
Commands\TranslateAll::class,
|
||||||
Commands\InitDatabaseSchema::class,
|
Commands\InitDatabaseSchema::class,
|
||||||
Commands\SetTheme::class,
|
Commands\SetTemplate::class,
|
||||||
AddLanguage::class
|
AddLanguage::class
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use App\Models\User;
|
|||||||
|
|
||||||
interface BaseModuleHandler
|
interface BaseModuleHandler
|
||||||
{
|
{
|
||||||
public static function getModuleId();
|
// public static function getModuleId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register admin menu (or multiple ones)
|
* Register admin menu (or multiple ones)
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Handlers\Contracts;
|
||||||
|
|
||||||
|
use App\Http\Requests\Request;
|
||||||
|
use App\Models\Content;
|
||||||
|
use App\Models\Module;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface TemplateHandler
|
||||||
|
*
|
||||||
|
* Inerface used for registering template into CMS core.
|
||||||
|
*
|
||||||
|
* @package App\Handlers\Contracts
|
||||||
|
*/
|
||||||
|
interface TemplateHandler extends BaseModuleHandler
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Uninstall template
|
||||||
|
*
|
||||||
|
* Delete some items in database, delete files etc.
|
||||||
|
*
|
||||||
|
* @param Module $template
|
||||||
|
*/
|
||||||
|
public static function uninstall(Module $template);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get list of registered templates and supported modules.
|
||||||
|
*
|
||||||
|
* Returned array is expected to be array of arrays with following items: module, namespace and templateName.
|
||||||
|
* Example:
|
||||||
|
* return [
|
||||||
|
* ['module' => 'Article', 'templateName' => 'article::template.name']
|
||||||
|
* ];
|
||||||
|
*
|
||||||
|
* When no "namespace" is specified, value strtolower(module) is used instaed.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getPublicTemplatePaths();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare Content object to be rendered using Blade template
|
||||||
|
*
|
||||||
|
* @param Content $content
|
||||||
|
*/
|
||||||
|
public static function beforeRender(Content & $content);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modify input data into format which can be understood by edit template
|
||||||
|
*
|
||||||
|
* @param Content $content
|
||||||
|
*/
|
||||||
|
public static function beforePopulatingEditForm(Content & $content);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Slightly modify Content object before saving into database.
|
||||||
|
*
|
||||||
|
* This way we can do almost whatever we want - even in template
|
||||||
|
*
|
||||||
|
* @param Content $content
|
||||||
|
* @param Request $request
|
||||||
|
*/
|
||||||
|
public static function beforeSave(Content & $content, Request $request);
|
||||||
|
}
|
||||||
@@ -187,7 +187,6 @@ class TemplateRegistrator
|
|||||||
$registeredTemplates = Templates::getWithTranslations();
|
$registeredTemplates = Templates::getWithTranslations();
|
||||||
|
|
||||||
if (!in_array($templateName, $registeredTemplates)) {
|
if (!in_array($templateName, $registeredTemplates)) {
|
||||||
|
|
||||||
$params = [
|
$params = [
|
||||||
'template_name' => $templateName,
|
'template_name' => $templateName,
|
||||||
'name' => $templateName,
|
'name' => $templateName,
|
||||||
@@ -197,8 +196,6 @@ class TemplateRegistrator
|
|||||||
'editable' => 1
|
'editable' => 1
|
||||||
];
|
];
|
||||||
|
|
||||||
echo 'ukladam do db '.$templateName."\n";
|
|
||||||
|
|
||||||
// save template into database
|
// save template into database
|
||||||
$newTemplate = Template::create($params);
|
$newTemplate = Template::create($params);
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class Template
|
|||||||
*
|
*
|
||||||
* @return null|string
|
* @return null|string
|
||||||
*/
|
*/
|
||||||
public static function name($template)
|
public static function name($template, $throwExceptions = true)
|
||||||
{
|
{
|
||||||
$namespace = null;
|
$namespace = null;
|
||||||
if (strpos($template, '::')) {
|
if (strpos($template, '::')) {
|
||||||
@@ -21,10 +21,8 @@ class Template
|
|||||||
$namespace .= '::';
|
$namespace .= '::';
|
||||||
}
|
}
|
||||||
|
|
||||||
$theme = config('app.theme');
|
|
||||||
|
|
||||||
// list of prefixes
|
// list of prefixes
|
||||||
$prefixes = [$theme . '.custom.', $theme . '.', ''];
|
$prefixes = ['custom.', ''];
|
||||||
|
|
||||||
$view = null;
|
$view = null;
|
||||||
foreach ($prefixes as $prefix) {
|
foreach ($prefixes as $prefix) {
|
||||||
@@ -35,7 +33,11 @@ class Template
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_null($view)) {
|
if (is_null($view)) {
|
||||||
throw new InvalidArgumentException('Cannot find template for ' . $namespace . $template);
|
if ($throwExceptions) {
|
||||||
|
throw new InvalidArgumentException('Cannot find template for ' . $namespace . $template);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $view;
|
return $view;
|
||||||
@@ -59,6 +61,13 @@ class Template
|
|||||||
return config('app.upload_url') . '/' . $filename;
|
return config('app.upload_url') . '/' . $filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get path to given asset
|
||||||
|
*
|
||||||
|
* @param $path
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public static function asset($path)
|
public static function asset($path)
|
||||||
{
|
{
|
||||||
if (env('APP_DEBUG')) {
|
if (env('APP_DEBUG')) {
|
||||||
@@ -75,6 +84,14 @@ class Template
|
|||||||
return config('app.url') . '/assets/' . config('app.theme') . '/' . $path;
|
return config('app.url') . '/assets/' . config('app.theme') . '/' . $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print date in configured format
|
||||||
|
*
|
||||||
|
* @param $datestamp
|
||||||
|
* @param bool $withTime
|
||||||
|
*
|
||||||
|
* @return false|string
|
||||||
|
*/
|
||||||
public static function date($datestamp, $withTime = true)
|
public static function date($datestamp, $withTime = true)
|
||||||
{
|
{
|
||||||
$timestamp = strtotime($datestamp);
|
$timestamp = strtotime($datestamp);
|
||||||
|
|||||||
@@ -32,11 +32,16 @@ class ContentOverview extends Controller
|
|||||||
{
|
{
|
||||||
$moduleFilterHandler = false;
|
$moduleFilterHandler = false;
|
||||||
$perPage = Input::get('perPage') ? Input::get('perPage') : 20;
|
$perPage = Input::get('perPage') ? Input::get('perPage') : 20;
|
||||||
|
$pageHeading = 'admin/contents.overview';
|
||||||
|
|
||||||
// does user want to filter results using module?
|
// does user want to filter results using module?
|
||||||
if (is_numeric($moduleId)) {
|
if (is_numeric($moduleId)) {
|
||||||
$module = Module::findOrFail($moduleId);
|
$module = Module::findOrFail($moduleId);
|
||||||
$moduleFilterHandler = $module->handler;
|
$moduleFilterHandler = $module->handler;
|
||||||
|
|
||||||
|
if (is_callable([$module->handler, 'getOverviewTitle'])) {
|
||||||
|
$pageHeading = call_user_func([$module->handler, 'getOverviewTitle']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// get pages for overview
|
// get pages for overview
|
||||||
@@ -47,10 +52,11 @@ class ContentOverview extends Controller
|
|||||||
$homepage = $this->content->getHomepage();
|
$homepage = $this->content->getHomepage();
|
||||||
|
|
||||||
return view('admin.content.overview', [
|
return view('admin.content.overview', [
|
||||||
'pages' => $pages,
|
'pages' => $pages,
|
||||||
'homepage' => $homepage,
|
'homepage' => $homepage,
|
||||||
'statuses' => ContentStatuses::getWithTranslations(),
|
'pageHeading' => $pageHeading,
|
||||||
'module' => isset($module) ? $module : null
|
'statuses' => ContentStatuses::getWithTranslations(),
|
||||||
|
'module' => isset($module) ? $module : null
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,6 +14,7 @@ use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
|
|||||||
use Modules\Categories\Entities\Category;
|
use Modules\Categories\Entities\Category;
|
||||||
use Pingpong\Modules\Facades\Module as ModuleInstance;
|
use Pingpong\Modules\Facades\Module as ModuleInstance;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
|
|
||||||
class CreateNewContent extends Controller
|
class CreateNewContent extends Controller
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -87,6 +88,9 @@ class CreateNewContent extends Controller
|
|||||||
public function postNew(CreateNewContentRequest $request, $moduleId)
|
public function postNew(CreateNewContentRequest $request, $moduleId)
|
||||||
{
|
{
|
||||||
$page = new Content();
|
$page = new Content();
|
||||||
|
$template = Module::where('is_template', true)
|
||||||
|
->where('enabled', true)
|
||||||
|
->first();
|
||||||
try {
|
try {
|
||||||
$module = Module::findOrFail($moduleId);
|
$module = Module::findOrFail($moduleId);
|
||||||
} catch (NotFoundHttpException $e) {
|
} catch (NotFoundHttpException $e) {
|
||||||
@@ -116,7 +120,13 @@ class CreateNewContent extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
// upload file - if provided
|
// upload file - if provided
|
||||||
$page->uploadTitlePhoto($request);
|
$file = $page->uploadTitlePhoto($request);
|
||||||
|
|
||||||
|
$page->title_photo = $file ? $file['filename'] : null;
|
||||||
|
|
||||||
|
// let template to modify request and content page
|
||||||
|
|
||||||
|
call_user_func_array([$template->handler, 'beforeSave'], [&$page, $request]);
|
||||||
|
|
||||||
// save module-specific stuff
|
// save module-specific stuff
|
||||||
call_user_func_array([$module->handler, 'createNew'], [&$page, $request]);
|
call_user_func_array([$module->handler, 'createNew'], [&$page, $request]);
|
||||||
|
|||||||
@@ -56,23 +56,32 @@ class EditContent extends Controller
|
|||||||
$page = Content::findOrFail($id);
|
$page = Content::findOrFail($id);
|
||||||
$page->module_settings = json_decode($page->module_settings);
|
$page->module_settings = json_decode($page->module_settings);
|
||||||
|
|
||||||
$allModules = ModulesHandlerToId::getWithTranslations();
|
// select template
|
||||||
$moduleId = $allModules[$page->module_handler];
|
$template = Module::where('is_template', true)
|
||||||
$module = Module::findOrFail($moduleId);
|
->where('enabled', true)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
// get module ID
|
||||||
|
$module = Module::where('handler', $page->module_handler)->firstOrFail();
|
||||||
|
|
||||||
$templates = Template::where('module_id', $moduleId)
|
// get all Blade templates for rendering page
|
||||||
|
$templates = Template::where('module_id', $module->id)
|
||||||
->select(['template_name', 'name', 'description'])
|
->select(['template_name', 'name', 'description'])
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
// get module for Categories - PingPong module
|
||||||
$categoryModule = ModuleInstance::get('categories');
|
$categoryModule = ModuleInstance::get('categories');
|
||||||
|
|
||||||
// add categories, if supported
|
// add categories, if supported
|
||||||
$categories = [];
|
$categories = [];
|
||||||
if ($module->support_categories && $categoryModule->enabled()) {
|
if ($module->support_categories && $categoryModule->enabled()) {
|
||||||
$categories = Category::where('module_id', $moduleId)
|
$categories = Category::where('module_id', $module->id)
|
||||||
->get();
|
->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// modify data for edit form according to installed template
|
||||||
|
call_user_func_array([$template->handler, 'beforePopulatingEditForm'], [&$page]);
|
||||||
|
|
||||||
$history = $this->history->getStructuredHistoryOf($page);
|
$history = $this->history->getStructuredHistoryOf($page);
|
||||||
|
|
||||||
// render view
|
// render view
|
||||||
@@ -107,6 +116,10 @@ class EditContent extends Controller
|
|||||||
* @var $page Content
|
* @var $page Content
|
||||||
*/
|
*/
|
||||||
$page = Content::findOrFail($id);
|
$page = Content::findOrFail($id);
|
||||||
|
|
||||||
|
$template = Module::where('is_template', true)
|
||||||
|
->where('enabled', true)
|
||||||
|
->first();
|
||||||
} catch (NotFoundHttpException $e) {
|
} catch (NotFoundHttpException $e) {
|
||||||
|
|
||||||
// log attempt of invalid edit
|
// log attempt of invalid edit
|
||||||
@@ -118,12 +131,17 @@ class EditContent extends Controller
|
|||||||
->with('error', trans('admin/contents.invalidPage'));
|
->with('error', trans('admin/contents.invalidPage'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// upload file - if provided
|
||||||
|
$file = $page->uploadTitlePhoto($request);
|
||||||
|
|
||||||
|
// let template to modify request and content page
|
||||||
|
call_user_func_array([$template->handler, 'beforeSave'], [&$page, $request]);
|
||||||
|
|
||||||
$request->url = Str::slug($request->url);
|
$request->url = Str::slug($request->url);
|
||||||
$request->parentPage = $request->parentPage ? $request->parentPage : null;
|
$request->parentPage = $request->parentPage ? $request->parentPage : null;
|
||||||
$request->titlePhotoFilename = $page->title_photo;
|
|
||||||
|
|
||||||
// upload file - if provided
|
$request->titlePhotoFilename = $file ? $file['filename'] : null;
|
||||||
$page->uploadTitlePhoto($request);
|
|
||||||
|
|
||||||
// array of fields in database and fields from request
|
// array of fields in database and fields from request
|
||||||
$fields = [
|
$fields = [
|
||||||
@@ -142,7 +160,8 @@ class EditContent extends Controller
|
|||||||
];
|
];
|
||||||
|
|
||||||
// save new values with history
|
// save new values with history
|
||||||
$data = self::getFields($request, $fields);
|
$data = self::getFields($request, array_values($fields));
|
||||||
|
|
||||||
list($revision, $changedColumns) = $page->updateWithHistory($fields, $data);
|
list($revision, $changedColumns) = $page->updateWithHistory($fields, $data);
|
||||||
|
|
||||||
$changedColumns += call_user_func_array([$page->module_handler, 'edit'], [&$page, $request, $revision]);
|
$changedColumns += call_user_func_array([$page->module_handler, 'edit'], [&$page, $request, $revision]);
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ class EditTemplate extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
// save new content only if something was changed
|
// save new content only if something was changed
|
||||||
if ($this->isContentDifferent($originalTemplate, $customTemplate, $request->templateContent)) {
|
if ($template->editable && $this->isContentDifferent($originalTemplate, $customTemplate, $request->templateContent)) {
|
||||||
|
|
||||||
// create directory for custom updates
|
// create directory for custom updates
|
||||||
if (!is_dir($customDir)) {
|
if (!is_dir($customDir)) {
|
||||||
|
|||||||
@@ -79,6 +79,13 @@ class EditWidget extends Controller
|
|||||||
// create new widget
|
// create new widget
|
||||||
$widget = Widget::findOrFail($id);
|
$widget = Widget::findOrFail($id);
|
||||||
|
|
||||||
|
// check if widget area is deletable
|
||||||
|
if (!$widget->deletable) {
|
||||||
|
return redirect()
|
||||||
|
->back()
|
||||||
|
->with('error', trans('admin/widgets.notDeletable'));
|
||||||
|
}
|
||||||
|
|
||||||
$widget->delete();
|
$widget->delete();
|
||||||
|
|
||||||
// redirect with success notification
|
// redirect with success notification
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace App\Http\Controllers\Admin;
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Http\Requests;
|
|
||||||
use App\Http\Requests\EditWidgetAreaRequest;
|
use App\Http\Requests\EditWidgetAreaRequest;
|
||||||
use App\Models\WidgetArea;
|
use App\Models\WidgetArea;
|
||||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||||
@@ -61,6 +60,13 @@ class EditWidgetArea extends Controller
|
|||||||
return $this->invalidArea();
|
return $this->invalidArea();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check if widget area is deletable
|
||||||
|
if (!$area->deletable) {
|
||||||
|
return redirect()
|
||||||
|
->back()
|
||||||
|
->with('error', trans('admin/widgetAreas.notDeletableArea'));
|
||||||
|
}
|
||||||
|
|
||||||
// delete area
|
// delete area
|
||||||
$area->delete();
|
$area->delete();
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ namespace App\Http\Controllers\Visitor;
|
|||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Http\Requests;
|
use App\Http\Requests;
|
||||||
use App\Models\Content;
|
use App\Models\Content;
|
||||||
|
use App\Models\Module;
|
||||||
|
use App\Models\Template;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
class ContentPage extends Controller
|
class ContentPage extends Controller
|
||||||
@@ -53,9 +55,17 @@ class ContentPage extends Controller
|
|||||||
// add one new "view" for page
|
// add one new "view" for page
|
||||||
$page->view();
|
$page->view();
|
||||||
|
|
||||||
|
// decode module settings
|
||||||
|
$page->module_settings = json_decode($page->module_settings);
|
||||||
|
|
||||||
// get handler
|
// get handler
|
||||||
$handler = new $page->module_handler;
|
$handler = new $page->module_handler;
|
||||||
|
|
||||||
|
$template = Module::where('is_template', true)->where('enabled', true)->first();
|
||||||
|
|
||||||
|
// do something template-specific
|
||||||
|
call_user_func_array([$template->handler, 'beforeRender'], [&$page]);
|
||||||
|
|
||||||
// render page
|
// render page
|
||||||
return $handler->render($page, '');
|
return $handler->render($page, '');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,7 @@ class EditTemplateRequest extends Request
|
|||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name' => 'required|max:128',
|
'name' => 'required|max:128',
|
||||||
'templateContent' => 'required'
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -293,10 +293,10 @@ class Content extends Model
|
|||||||
public function uploadTitlePhoto(Request $request)
|
public function uploadTitlePhoto(Request $request)
|
||||||
{
|
{
|
||||||
if ($request->hasFile('titlePhoto')) {
|
if ($request->hasFile('titlePhoto')) {
|
||||||
$file = $this->file->upload($request->file('titlePhoto'), $request);
|
return $this->file->upload($request->file('titlePhoto'), $request);
|
||||||
|
|
||||||
$this->title_photo = $file['filename'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+54
-3
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Handlers\Contracts\TemplateHandler;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Support\Facades\App;
|
use Illuminate\Support\Facades\App;
|
||||||
|
|
||||||
@@ -20,7 +21,8 @@ class Module extends Model
|
|||||||
'module_settings',
|
'module_settings',
|
||||||
'enabled',
|
'enabled',
|
||||||
'support_categories',
|
'support_categories',
|
||||||
'manages_content'
|
'manages_content',
|
||||||
|
'is_template'
|
||||||
];
|
];
|
||||||
protected $guarded = [];
|
protected $guarded = [];
|
||||||
|
|
||||||
@@ -45,6 +47,7 @@ class Module extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
$managesContent = $handler ? in_array('App\Handlers\Contracts\AppHandler', class_implements($handler)) : false;
|
$managesContent = $handler ? in_array('App\Handlers\Contracts\AppHandler', class_implements($handler)) : false;
|
||||||
|
$isTemplate = $handler ? in_array(TemplateHandler::class, class_implements($handler)) : false;
|
||||||
$supportCategories = $managesContent ? call_user_func([$handler, 'supportCategories']) : false;
|
$supportCategories = $managesContent ? call_user_func([$handler, 'supportCategories']) : false;
|
||||||
|
|
||||||
if ($parentModuleId) {
|
if ($parentModuleId) {
|
||||||
@@ -62,8 +65,9 @@ class Module extends Model
|
|||||||
'support_categories' => $supportCategories,
|
'support_categories' => $supportCategories,
|
||||||
'alias' => $alias,
|
'alias' => $alias,
|
||||||
'module_settings' => json_encode($settings),
|
'module_settings' => json_encode($settings),
|
||||||
'parent_id' => $parentModuleId,
|
'parent_id' => $parentModuleId ? $parentModuleId : null,
|
||||||
'enabled' => 1
|
'enabled' => 1,
|
||||||
|
'is_template' => $isTemplate
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// install something module-specific
|
// install something module-specific
|
||||||
@@ -73,4 +77,51 @@ class Module extends Model
|
|||||||
|
|
||||||
return $module;
|
return $module;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete module from database and uninstall its dependencies
|
||||||
|
*
|
||||||
|
* @throws \ErrorException
|
||||||
|
*/
|
||||||
|
public function uninstall()
|
||||||
|
{
|
||||||
|
// check if user does not want to install module in runtime
|
||||||
|
if (!App::runningInConsole()) {
|
||||||
|
throw new \ErrorException('Modules can be uninstalled only via Artisan!');
|
||||||
|
}
|
||||||
|
|
||||||
|
// delete everything in /resources/views/visitor
|
||||||
|
if ($this->is_template) {
|
||||||
|
$this->deleteDirectory(resource_path('views/visitor'));
|
||||||
|
$this->deleteDirectory(public_path('assets'));
|
||||||
|
|
||||||
|
// delete all template paths
|
||||||
|
TemplatePath::getQuery()->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->handler && is_callable([$this->handler, 'uninstall'])) {
|
||||||
|
call_user_func([$this->handler, 'uninstall'], $this);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete directory when uninstalling module.
|
||||||
|
*
|
||||||
|
* @param $directory
|
||||||
|
*
|
||||||
|
* @throws \ErrorException
|
||||||
|
*/
|
||||||
|
private function deleteDirectory($directory)
|
||||||
|
{
|
||||||
|
if (!is_dir($directory))
|
||||||
|
return;
|
||||||
|
|
||||||
|
$success = \File::deleteDirectory($directory, true);
|
||||||
|
|
||||||
|
if (!$success) {
|
||||||
|
throw new \ErrorException('Cannot delete ' . $directory);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -30,8 +30,6 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
{
|
{
|
||||||
// ignore running from artisan
|
// ignore running from artisan
|
||||||
if (App::runningInConsole()) {
|
if (App::runningInConsole()) {
|
||||||
$this->publishViewResources();
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,13 +37,6 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
$this->registerTemplates();
|
$this->registerTemplates();
|
||||||
$this->registerSettings();
|
$this->registerSettings();
|
||||||
$this->registerSearch();
|
$this->registerSearch();
|
||||||
|
|
||||||
// check if given template is valid
|
|
||||||
$theme = config('app.theme');
|
|
||||||
$themeDir = resource_path('views/visitor/' . $theme);
|
|
||||||
if (!$theme || empty($theme) || !is_dir($themeDir)) {
|
|
||||||
throw new InvalidArgumentException('No or invalid theme set! Use artisan theme:set or edit .env file manually and include THEME option, please');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -120,10 +111,10 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
/**
|
/**
|
||||||
* @var $registrator TemplateRegistrator
|
* @var $registrator TemplateRegistrator
|
||||||
*/
|
*/
|
||||||
$registrator = $this->app->make('registerTemplateDir');
|
// $registrator = $this->app->make('registerTemplateDir');
|
||||||
$registrator->setBaseDirectory('resources/views/visitor');
|
// $registrator->setBaseDirectory('resources/views/visitor');
|
||||||
|
|
||||||
$registrator->register(config('app.theme'), 'admin/templates.core');
|
// $registrator->register(config('app.theme'), 'admin/templates.core');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -150,37 +141,5 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
$registrator->register(new Files(), new AdminFiles(), SearchEngineRegistrator::ADMIN);
|
$registrator->register(new Files(), new AdminFiles(), SearchEngineRegistrator::ADMIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Publish all public assets from all themes
|
|
||||||
*/
|
|
||||||
private function publishViewResources()
|
|
||||||
{
|
|
||||||
$theme = config('app.theme');
|
|
||||||
$themeDir = resource_path('views/visitor/' . $theme);
|
|
||||||
|
|
||||||
// publish assets if exists for current theme
|
|
||||||
if (is_dir($themeDir . '/' . Template::ASSETS_DIRECTORY)) {
|
|
||||||
$this->publishes([$themeDir . '/' . Template::ASSETS_DIRECTORY => public_path('assets/' . $theme)], 'public-assets');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_dir($themeDir . '/' . Template::MODULES_DIRECTORY)) {
|
|
||||||
$this->publishModuleViews($themeDir . '/' . Template::MODULES_DIRECTORY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private function publishModuleViews($themeModules)
|
|
||||||
{
|
|
||||||
$theme = config('app.theme');
|
|
||||||
$modules = File::directories($themeModules);
|
|
||||||
|
|
||||||
$moduleViews = [];
|
|
||||||
foreach ($modules as $module) {
|
|
||||||
$moduleName = strtolower(basename($module));
|
|
||||||
$moduleViews[$module] = resource_path('views/modules/' . $moduleName . '/visitor/' . $theme);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($moduleViews)) {
|
|
||||||
$this->publishes($moduleViews, 'module-views');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,6 +73,14 @@ class GlobalViewDataProvider extends ServiceProvider
|
|||||||
return preg_replace($pattern, $code, $view);
|
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>
|
// shortcut for assets (placed in /public/assets/<theme>
|
||||||
Blade::extend(function ($view) {
|
Blade::extend(function ($view) {
|
||||||
$pattern = $this->createPattern('asset');
|
$pattern = $this->createPattern('asset');
|
||||||
|
|||||||
@@ -5,18 +5,13 @@ use Illuminate\Support\Facades\App;
|
|||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
|
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
|
||||||
use Symfony\Component\Translation\Translator;
|
|
||||||
|
|
||||||
class LaravelLocalizationServiceProvider extends ServiceProvider
|
class LaravelLocalizationServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
public function register()
|
public function register()
|
||||||
{
|
{
|
||||||
try {
|
$languages = DB::table('languages')
|
||||||
$languages = DB::table('languages')
|
->get();
|
||||||
->get();
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
$languages = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
$supportedLocales = [];
|
$supportedLocales = [];
|
||||||
if (empty($languages)) {
|
if (empty($languages)) {
|
||||||
@@ -28,11 +23,7 @@ class LaravelLocalizationServiceProvider extends ServiceProvider
|
|||||||
];
|
];
|
||||||
|
|
||||||
// create default language
|
// create default language
|
||||||
try {
|
Language::create($supportedLocales[config('app.locale')]);
|
||||||
Language::create($supportedLocales[config('app.locale')]);
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
// ignore, table languages probably does not exist.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($languages as $language) {
|
foreach ($languages as $language) {
|
||||||
|
|||||||
@@ -15,14 +15,15 @@ class ModuleManager extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
// ignore running from artisan
|
// this service provider needs published config - config is merged right after this service provider
|
||||||
if (App::runningInConsole()) {
|
try {
|
||||||
|
$modules = Module::where('is_template', false)
|
||||||
|
->get();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// ignore error
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// this service provider needs published config - config is merged right after this service provider
|
|
||||||
$modules = Module::get();
|
|
||||||
|
|
||||||
// iterate over all modules and enable or disable them
|
// iterate over all modules and enable or disable them
|
||||||
foreach ($modules as $module) {
|
foreach ($modules as $module) {
|
||||||
$this->createModulesJson($module);
|
$this->createModulesJson($module);
|
||||||
@@ -58,7 +59,7 @@ class ModuleManager extends ServiceProvider
|
|||||||
|
|
||||||
// check if module config is writable
|
// check if module config is writable
|
||||||
if (!is_writable(dirname($path))) {
|
if (!is_writable(dirname($path))) {
|
||||||
Log::warning('Cannot write to '.$path);
|
Log::warning('Cannot write to ' . $path);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,122 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use App\Handlers\Registrators\TemplateRegistrator;
|
||||||
|
use App\Models\Module;
|
||||||
|
use App\Models\Template;
|
||||||
|
use Illuminate\Support\Facades\App;
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use InvalidArgumentException;
|
||||||
|
|
||||||
|
class TemplateServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
private function getTemplate()
|
||||||
|
{
|
||||||
|
// select template
|
||||||
|
try {
|
||||||
|
$template = Module::where('is_template', true)
|
||||||
|
->where('enabled', true)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($template) {
|
||||||
|
$template->settings = json_decode($template->module_settings);
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $template;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
// ignore running from artisan
|
||||||
|
if (App::runningInConsole()) {
|
||||||
|
$this->publishViewResources();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$template = $this->getTemplate();
|
||||||
|
|
||||||
|
if (!$template) {
|
||||||
|
throw new \ErrorException('Template is not set, cannot continue');
|
||||||
|
}
|
||||||
|
|
||||||
|
// include files
|
||||||
|
$files = isset($template->settings->files) ? $template->settings->files : [];
|
||||||
|
|
||||||
|
foreach ($files as $file) {
|
||||||
|
include_once $file;
|
||||||
|
}
|
||||||
|
|
||||||
|
// register templates
|
||||||
|
$publicTemplates = call_user_func([$template->handler, 'getPublicTemplatePaths']);
|
||||||
|
|
||||||
|
if (!is_array($publicTemplates)) {
|
||||||
|
throw new \ErrorException($template->handler . '::getPublicTemplatePaths() must return array!');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($publicTemplates)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var $registrator TemplateRegistrator
|
||||||
|
*/
|
||||||
|
$registrator = $this->app->make('registerTemplateDir');
|
||||||
|
foreach ($publicTemplates as $template) {
|
||||||
|
// setup some global variables
|
||||||
|
$module = strtolower($template['module']);
|
||||||
|
$namespace = isset($template['namespace']) ? $template['namespace'] : strtolower($template['module']);
|
||||||
|
try {
|
||||||
|
$registrator->setBaseDirectory('resources/views/modules/' . $module);
|
||||||
|
$registrator->setNamespace($namespace);
|
||||||
|
$registrator->setModuleId(call_user_func([config($module . '.handler'), 'getModuleId']));
|
||||||
|
|
||||||
|
// register path with current template name
|
||||||
|
$registrator->register('visitor', $template['templateName']);
|
||||||
|
} catch (InvalidArgumentException $e) {
|
||||||
|
// ignore this exception
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the service provider.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Publish all public assets from all themes
|
||||||
|
*/
|
||||||
|
private function publishViewResources()
|
||||||
|
{
|
||||||
|
$template = $this->getTemplate();
|
||||||
|
if (!$template) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$templateDir = app_path('../templates/' . $template->settings->staticName . '/Resources');
|
||||||
|
$assetsDir = $templateDir . '/' . Template::ASSETS_DIRECTORY;
|
||||||
|
$viewsDir = $templateDir . '/views';
|
||||||
|
|
||||||
|
// publish assets if exists for current theme
|
||||||
|
if (is_dir($assetsDir)) {
|
||||||
|
$this->publishes([$assetsDir => public_path('assets/visitor')], 'public-assets');
|
||||||
|
}
|
||||||
|
|
||||||
|
// publish base visitors views
|
||||||
|
$this->publishes([$viewsDir . '/visitor' => resource_path('views/visitor')], 'module-views');
|
||||||
|
|
||||||
|
// publish admin views
|
||||||
|
if (is_dir($viewsDir . '/modules')) {
|
||||||
|
$this->publishes([$viewsDir . '/modules' => resource_path('views/modules')], 'module-views');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-7
@@ -30,16 +30,11 @@
|
|||||||
],
|
],
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"App\\": "app/",
|
"App\\": "app/",
|
||||||
"Modules\\": "modules/"
|
"Modules\\": "modules/",
|
||||||
|
"Templates\\": "templates/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"post-root-package-install": [
|
|
||||||
"php -r \"copy('.env.example', '.env');\""
|
|
||||||
],
|
|
||||||
"post-create-project-cmd": [
|
|
||||||
"php artisan key:generate"
|
|
||||||
],
|
|
||||||
"post-install-cmd": [
|
"post-install-cmd": [
|
||||||
"php artisan clear-compiled",
|
"php artisan clear-compiled",
|
||||||
"php artisan optimize"
|
"php artisan optimize"
|
||||||
|
|||||||
+77
-77
@@ -129,49 +129,49 @@ return [
|
|||||||
|
|
||||||
'providers' => [
|
'providers' => [
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Laravel Framework Service Providers...
|
* Laravel Framework Service Providers...
|
||||||
*/
|
*/
|
||||||
Illuminate\Auth\AuthServiceProvider::class,
|
Illuminate\Auth\AuthServiceProvider::class,
|
||||||
Illuminate\Broadcasting\BroadcastServiceProvider::class,
|
Illuminate\Broadcasting\BroadcastServiceProvider::class,
|
||||||
Illuminate\Bus\BusServiceProvider::class,
|
Illuminate\Bus\BusServiceProvider::class,
|
||||||
Illuminate\Cache\CacheServiceProvider::class,
|
Illuminate\Cache\CacheServiceProvider::class,
|
||||||
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
|
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
|
||||||
Illuminate\Cookie\CookieServiceProvider::class,
|
Illuminate\Cookie\CookieServiceProvider::class,
|
||||||
Illuminate\Database\DatabaseServiceProvider::class,
|
Illuminate\Database\DatabaseServiceProvider::class,
|
||||||
Illuminate\Encryption\EncryptionServiceProvider::class,
|
Illuminate\Encryption\EncryptionServiceProvider::class,
|
||||||
Illuminate\Filesystem\FilesystemServiceProvider::class,
|
Illuminate\Filesystem\FilesystemServiceProvider::class,
|
||||||
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
|
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
|
||||||
Illuminate\Hashing\HashServiceProvider::class,
|
Illuminate\Hashing\HashServiceProvider::class,
|
||||||
Illuminate\Mail\MailServiceProvider::class,
|
Illuminate\Mail\MailServiceProvider::class,
|
||||||
Illuminate\Pagination\PaginationServiceProvider::class,
|
Illuminate\Pagination\PaginationServiceProvider::class,
|
||||||
Illuminate\Pipeline\PipelineServiceProvider::class,
|
Illuminate\Pipeline\PipelineServiceProvider::class,
|
||||||
Illuminate\Queue\QueueServiceProvider::class,
|
Illuminate\Queue\QueueServiceProvider::class,
|
||||||
Illuminate\Redis\RedisServiceProvider::class,
|
Illuminate\Redis\RedisServiceProvider::class,
|
||||||
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
|
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
|
||||||
Illuminate\Session\SessionServiceProvider::class,
|
Illuminate\Session\SessionServiceProvider::class,
|
||||||
Illuminate\Translation\TranslationServiceProvider::class,
|
Illuminate\Translation\TranslationServiceProvider::class,
|
||||||
Illuminate\Validation\ValidationServiceProvider::class,
|
Illuminate\Validation\ValidationServiceProvider::class,
|
||||||
Illuminate\View\ViewServiceProvider::class,
|
Illuminate\View\ViewServiceProvider::class,
|
||||||
Mcamara\LaravelLocalization\LaravelLocalizationServiceProvider::class,
|
Mcamara\LaravelLocalization\LaravelLocalizationServiceProvider::class,
|
||||||
// this class must be before ModulesServiceProvider from PingPong, because it handles files module.json
|
// this class must be before ModulesServiceProvider from PingPong, because it handles files module.json
|
||||||
App\Providers\ModuleManager::class,
|
App\Providers\ModuleManager::class,
|
||||||
Pingpong\Modules\ModulesServiceProvider::class,
|
Pingpong\Modules\ModulesServiceProvider::class,
|
||||||
Pingpong\Menus\MenusServiceProvider::class,
|
Pingpong\Menus\MenusServiceProvider::class,
|
||||||
App\Providers\SubmodulesManager::class,
|
App\Providers\SubmodulesManager::class,
|
||||||
|
Franzose\ClosureTable\ClosureTableServiceProvider::class,
|
||||||
|
\Watson\Sitemap\SitemapServiceProvider::class,
|
||||||
|
/*
|
||||||
|
* Application Service Providers...
|
||||||
|
*/
|
||||||
|
App\Providers\AppServiceProvider::class,
|
||||||
|
App\Providers\AuthServiceProvider::class,
|
||||||
|
App\Providers\EventServiceProvider::class,
|
||||||
|
App\Providers\RouteServiceProvider::class,
|
||||||
|
App\Providers\GlobalViewDataProvider::class,
|
||||||
|
\App\Providers\TemplateServiceProvider::class,
|
||||||
|
|
||||||
Franzose\ClosureTable\ClosureTableServiceProvider::class,
|
],
|
||||||
\Watson\Sitemap\SitemapServiceProvider::class,
|
|
||||||
/*
|
|
||||||
* Application Service Providers...
|
|
||||||
*/
|
|
||||||
App\Providers\AppServiceProvider::class,
|
|
||||||
App\Providers\AuthServiceProvider::class,
|
|
||||||
App\Providers\EventServiceProvider::class,
|
|
||||||
App\Providers\RouteServiceProvider::class,
|
|
||||||
App\Providers\GlobalViewDataProvider::class,
|
|
||||||
|
|
||||||
],
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Class Aliases
|
| Class Aliases
|
||||||
@@ -185,41 +185,41 @@ return [
|
|||||||
|
|
||||||
'aliases' => [
|
'aliases' => [
|
||||||
|
|
||||||
'App' => Illuminate\Support\Facades\App::class,
|
'App' => Illuminate\Support\Facades\App::class,
|
||||||
'Artisan' => Illuminate\Support\Facades\Artisan::class,
|
'Artisan' => Illuminate\Support\Facades\Artisan::class,
|
||||||
'Auth' => Illuminate\Support\Facades\Auth::class,
|
'Auth' => Illuminate\Support\Facades\Auth::class,
|
||||||
'Blade' => Illuminate\Support\Facades\Blade::class,
|
'Blade' => Illuminate\Support\Facades\Blade::class,
|
||||||
'Cache' => Illuminate\Support\Facades\Cache::class,
|
'Cache' => Illuminate\Support\Facades\Cache::class,
|
||||||
'Config' => Illuminate\Support\Facades\Config::class,
|
'Config' => Illuminate\Support\Facades\Config::class,
|
||||||
'Cookie' => Illuminate\Support\Facades\Cookie::class,
|
'Cookie' => Illuminate\Support\Facades\Cookie::class,
|
||||||
'Crypt' => Illuminate\Support\Facades\Crypt::class,
|
'Crypt' => Illuminate\Support\Facades\Crypt::class,
|
||||||
'DB' => Illuminate\Support\Facades\DB::class,
|
'DB' => Illuminate\Support\Facades\DB::class,
|
||||||
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
|
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
|
||||||
'Event' => Illuminate\Support\Facades\Event::class,
|
'Event' => Illuminate\Support\Facades\Event::class,
|
||||||
'File' => Illuminate\Support\Facades\File::class,
|
'File' => Illuminate\Support\Facades\File::class,
|
||||||
'Gate' => Illuminate\Support\Facades\Gate::class,
|
'Gate' => Illuminate\Support\Facades\Gate::class,
|
||||||
'Hash' => Illuminate\Support\Facades\Hash::class,
|
'Hash' => Illuminate\Support\Facades\Hash::class,
|
||||||
'Lang' => Illuminate\Support\Facades\Lang::class,
|
'Lang' => Illuminate\Support\Facades\Lang::class,
|
||||||
'Log' => Illuminate\Support\Facades\Log::class,
|
'Log' => Illuminate\Support\Facades\Log::class,
|
||||||
'Mail' => Illuminate\Support\Facades\Mail::class,
|
'Mail' => Illuminate\Support\Facades\Mail::class,
|
||||||
'Menu' => Pingpong\Menus\MenuFacade::class,
|
'Menu' => Pingpong\Menus\MenuFacade::class,
|
||||||
'Module' => Pingpong\Modules\Facades\Module::class,
|
'Module' => Pingpong\Modules\Facades\Module::class,
|
||||||
'Password' => Illuminate\Support\Facades\Password::class,
|
'Password' => Illuminate\Support\Facades\Password::class,
|
||||||
'Queue' => Illuminate\Support\Facades\Queue::class,
|
'Queue' => Illuminate\Support\Facades\Queue::class,
|
||||||
'Redirect' => Illuminate\Support\Facades\Redirect::class,
|
'Redirect' => Illuminate\Support\Facades\Redirect::class,
|
||||||
'Redis' => Illuminate\Support\Facades\Redis::class,
|
'Redis' => Illuminate\Support\Facades\Redis::class,
|
||||||
'Request' => Illuminate\Support\Facades\Request::class,
|
'Request' => Illuminate\Support\Facades\Request::class,
|
||||||
'Response' => Illuminate\Support\Facades\Response::class,
|
'Response' => Illuminate\Support\Facades\Response::class,
|
||||||
'Route' => Illuminate\Support\Facades\Route::class,
|
'Route' => Illuminate\Support\Facades\Route::class,
|
||||||
'Schema' => Illuminate\Support\Facades\Schema::class,
|
'Schema' => Illuminate\Support\Facades\Schema::class,
|
||||||
'Session' => Illuminate\Support\Facades\Session::class,
|
'Session' => Illuminate\Support\Facades\Session::class,
|
||||||
'Sitemap' => Watson\Sitemap\Facades\Sitemap::class,
|
'Sitemap' => Watson\Sitemap\Facades\Sitemap::class,
|
||||||
'Storage' => Illuminate\Support\Facades\Storage::class,
|
'Storage' => Illuminate\Support\Facades\Storage::class,
|
||||||
'URL' => Illuminate\Support\Facades\URL::class,
|
'URL' => Illuminate\Support\Facades\URL::class,
|
||||||
'Validator' => Illuminate\Support\Facades\Validator::class,
|
'Validator' => Illuminate\Support\Facades\Validator::class,
|
||||||
'LaravelLocalization' => Mcamara\LaravelLocalization\Facades\LaravelLocalization::class,
|
'LaravelLocalization' => Mcamara\LaravelLocalization\Facades\LaravelLocalization::class,
|
||||||
'View' => Illuminate\Support\Facades\View::class,
|
'View' => Illuminate\Support\Facades\View::class,
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class SaveTemplatesIntoModulesTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('modules', function (Blueprint $table){
|
||||||
|
$table->boolean('is_template')->default(false)->comment('Templates can be treated as modules.');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('modules', function (Blueprint $table){
|
||||||
|
$table->dropColumn('is_template');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class AddTemplateSupportToWidgets extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('widget_types', function (Blueprint $table) {
|
||||||
|
$table->integer('template_id')
|
||||||
|
->comment('Commes this widget with template?')
|
||||||
|
->after('handler')
|
||||||
|
->nullable(true)
|
||||||
|
->default(null);
|
||||||
|
$table->integer('module_id')
|
||||||
|
->comment('Commes this widget with some module?')
|
||||||
|
->after('template_id')
|
||||||
|
->nullable(true)
|
||||||
|
->default(null);
|
||||||
|
|
||||||
|
$table->foreign('template_id')
|
||||||
|
->references('id')
|
||||||
|
->on('modules')
|
||||||
|
->onDelete('cascade')
|
||||||
|
->onUpdate('cascade');
|
||||||
|
|
||||||
|
$table->foreign('module_id')
|
||||||
|
->references('id')
|
||||||
|
->on('modules')
|
||||||
|
->onDelete('cascade')
|
||||||
|
->onUpdate('cascade');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('widget_types', function (Blueprint $table) {
|
||||||
|
$table->dropForeign('widget_types_module_id_foreign');
|
||||||
|
$table->dropForeign('widget_types_template_id_foreign');
|
||||||
|
$table->dropColumn(['template_id', 'module_id']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class MakeWidgetsAndWidgetAreasNotDeletable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('widgets', function (Blueprint $table) {
|
||||||
|
$table->boolean('deletable')
|
||||||
|
->default(true)
|
||||||
|
->comment('Can this widget be deleted?');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('widget_areas', function (Blueprint $table) {
|
||||||
|
$table->boolean('deletable')
|
||||||
|
->default(true)
|
||||||
|
->comment('Can this widget area be deleted?');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('widgets', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('deletable');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('widget_areas', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('deletable');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
+674
-326
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,26 @@
|
|||||||
|
<?php namespace Modules\Blog\Article\Entities;
|
||||||
|
|
||||||
|
use App\Models\Content;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Comment extends Model
|
||||||
|
{
|
||||||
|
protected $fillable = [
|
||||||
|
'user_id',
|
||||||
|
'content_id',
|
||||||
|
'content',
|
||||||
|
'email',
|
||||||
|
'name'
|
||||||
|
];
|
||||||
|
|
||||||
|
public function author()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class, 'user_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function article()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Content::class, 'content_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ use App\Http\Controllers\Controller;
|
|||||||
use App\Http\Requests\Request;
|
use App\Http\Requests\Request;
|
||||||
use App\Models\Content;
|
use App\Models\Content;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use Modules\Blog\Article\Entities\Comment;
|
||||||
|
|
||||||
class Article extends Handler
|
class Article extends Handler
|
||||||
{
|
{
|
||||||
@@ -21,6 +22,14 @@ class Article extends Handler
|
|||||||
*/
|
*/
|
||||||
public function render(Content $content, $parameters)
|
public function render(Content $content, $parameters)
|
||||||
{
|
{
|
||||||
|
$content->comments = [];
|
||||||
|
if (isset($content->module_settings->allowComments) && $content->module_settings->allowComments) {
|
||||||
|
$content->comments = Comment::where('content_id', $content->id)
|
||||||
|
->where('approved', 1)
|
||||||
|
->orderBy('created_at')
|
||||||
|
->get();
|
||||||
|
}
|
||||||
|
|
||||||
return Controller::VisitorsView($content->template, ['page' => $content]);
|
return Controller::VisitorsView($content->template, ['page' => $content]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,6 +88,11 @@ class Article extends Handler
|
|||||||
return $changedColumns;
|
return $changedColumns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getOverviewTitle()
|
||||||
|
{
|
||||||
|
return trans('article::module.allArticles');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param User $user
|
* @param User $user
|
||||||
@@ -89,10 +103,20 @@ class Article extends Handler
|
|||||||
|
|
||||||
$menu = \Menu::instance('mainMenu');
|
$menu = \Menu::instance('mainMenu');
|
||||||
|
|
||||||
$menu->dropdown(trans('article::module.name'), function ($sub) {
|
$blogSubmenu = $menu->whereTitle(trans('article::module.blog'));
|
||||||
|
if (!$blogSubmenu) {
|
||||||
|
$blogSubmenu = $menu->dropdown(trans('article::module.blog'), function ($sub) {
|
||||||
|
}, 20, ['icon' => 'fa fa-fw fa-book']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$blogSubmenu->dropdown(trans('article::module.name'), function ($sub) {
|
||||||
$sub->route('content.new', trans('article::article.new'), ['id' => self::getModuleId()], 10, ['icon' => 'fa fa-fw fa-pencil']);
|
$sub->route('content.new', trans('article::article.new'), ['id' => self::getModuleId()], 10, ['icon' => 'fa fa-fw fa-pencil']);
|
||||||
$sub->route('content.overview', trans('article::article.overview'), ['id' => self::getModuleId()], 30, ['icon' => 'fa fa-fw fa-book']);
|
$sub->route('content.overview', trans('article::article.overview'), ['id' => self::getModuleId()], 30, ['icon' => 'fa fa-fw fa-book']);
|
||||||
}, 10, ['icon' => 'fa fa-fw fa-book']);
|
}, 10, ['icon' => 'fa fa-fw fa-book']);
|
||||||
|
|
||||||
|
$blogSubmenu->dropdown(trans('article::module.comments'), function ($sub) {
|
||||||
|
$sub->route('comments.overview', trans('article::module.commentsOverview'), [], 10, ['icon' => 'fa fa-fw fa-commenting-o']);
|
||||||
|
}, 20, ['icon' => 'fa fa-fw fa-comments-o']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getModuleId()
|
public static function getModuleId()
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
namespace Modules\Blog\Article\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use Modules\Blog\Article\Entities\Comment;
|
||||||
|
use Pingpong\Modules\Routing\Controller;
|
||||||
|
|
||||||
|
class CommentsOverview extends Controller
|
||||||
|
{
|
||||||
|
public function getOverview()
|
||||||
|
{
|
||||||
|
$comments = Comment::with('article')
|
||||||
|
->with('author')
|
||||||
|
->orderBy('approved')
|
||||||
|
->orderBy('created_at', 'DESC')
|
||||||
|
->paginate(20);
|
||||||
|
|
||||||
|
return view('article::admin/comments.overview', ['comments' => $comments]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
namespace Modules\Blog\Article\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use Modules\Blog\Article\Entities\Comment;
|
||||||
|
use Pingpong\Modules\Routing\Controller;
|
||||||
|
|
||||||
|
class EditComment extends Controller
|
||||||
|
{
|
||||||
|
public function approve($id)
|
||||||
|
{
|
||||||
|
$comment = Comment::findOrFail($id);
|
||||||
|
$comment->approved = 1;
|
||||||
|
$comment->save();
|
||||||
|
|
||||||
|
// Event::fire(ApprovedComment);
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->back()
|
||||||
|
->with('success', trans('article::comments.approved'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete($id)
|
||||||
|
{
|
||||||
|
$comment = Comment::findOrFail($id);
|
||||||
|
$comment->delete();
|
||||||
|
|
||||||
|
// Event::fire(DeletedComment);
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->back()
|
||||||
|
->with('success', trans('article::comments.deleted'));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
namespace Modules\Blog\Article\Http\Controllers\Visitor;
|
||||||
|
|
||||||
|
use App\Models\Content;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Modules\Blog\Article\Entities\Comment;
|
||||||
|
use Modules\Blog\Article\Handlers\Article;
|
||||||
|
use Pingpong\Modules\Routing\Controller;
|
||||||
|
|
||||||
|
class CreateNewComment extends Controller
|
||||||
|
{
|
||||||
|
public function postNew(\Modules\Blog\Article\Http\Requests\CreateNewComment $request, $articleId)
|
||||||
|
{
|
||||||
|
$article = Content::where('id', $articleId)
|
||||||
|
->where('module_handler', Article::class)
|
||||||
|
->firstOrFail();
|
||||||
|
|
||||||
|
$article->module_settings = json_decode($article->module_settings);
|
||||||
|
|
||||||
|
if (!isset($article->module_settings->allowComments) || !$article->module_settings->allowComments) {
|
||||||
|
return redirect()
|
||||||
|
->route('page.content', ['url' => $article->url])
|
||||||
|
->with('error', trans('article::comments.disabledComments'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$content = $request->message;
|
||||||
|
$user = Auth::user();
|
||||||
|
if ($user) {
|
||||||
|
$name = $user->name;
|
||||||
|
$email = $user->email;
|
||||||
|
} else {
|
||||||
|
$name = $request->name;
|
||||||
|
$email = $request->email;
|
||||||
|
}
|
||||||
|
|
||||||
|
Comment::create([
|
||||||
|
'user_id' => $user ? $user->id : null,
|
||||||
|
'content_id' => $article->id,
|
||||||
|
'name' => $name,
|
||||||
|
'email' => $email,
|
||||||
|
'content' => $content
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('page.content', ['url' => $article->url])
|
||||||
|
->with('success', trans('article::comments.saved'));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Blog\Article\Http\Requests;
|
||||||
|
|
||||||
|
use App\Http\Requests\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class CreateNewComment extends Request
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
|
||||||
|
$required = ['message' => 'required'];
|
||||||
|
|
||||||
|
if (!$user) {
|
||||||
|
$required['name'] = 'required';
|
||||||
|
$required['email'] = 'required|email';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $required;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,25 +1,28 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// routes for comments
|
||||||
|
|
||||||
Route::group([
|
Route::group([
|
||||||
'middleware' => 'web',
|
'middleware' => ['web', 'auth', 'adminMenu'],
|
||||||
'prefix' => 'article',
|
'prefix' => 'admin/comments',
|
||||||
'namespace' => 'Modules\Blog\Article\Http\Controllers'
|
'namespace' => 'Modules\Blog\Article\Http\Controllers\Admin'
|
||||||
], function () {
|
], function () {
|
||||||
Route::get('/', 'CategoriesOverview@getOverview')
|
|
||||||
->name('article.overview');
|
|
||||||
|
|
||||||
Route::get('/new', 'CreateNewCategory@getNew')
|
Route::get('/', 'CommentsOverview@getOverview')
|
||||||
->name('article.new');
|
->name('comments.overview');
|
||||||
|
|
||||||
Route::post('/new', 'CreateNewCategory@postNew')
|
Route::get('/delete/{id}', 'EditComment@delete')
|
||||||
->name('article.postNew');
|
->name('comments.delete');
|
||||||
|
|
||||||
Route::get('/edit/{id}', 'EditCategory@getEdit')
|
Route::get('/approve/{id}', 'EditComment@approve')
|
||||||
->name('article.edit');
|
->name('comments.approve');
|
||||||
|
});
|
||||||
|
|
||||||
Route::post('/edit/{id}', 'EditCategory@postEdit')
|
Route::group([
|
||||||
->name('article.postEdit');
|
'middleware' => ['web'],
|
||||||
|
'prefix' => 'comments',
|
||||||
|
'namespace' => 'Modules\Blog\Article\Http\Controllers\Visitor'
|
||||||
|
], function () {
|
||||||
|
|
||||||
Route::get('/delete/{id}', 'EditCategory@delete')
|
Route::post('/new/{id}', 'CreateNewComment@postNew')
|
||||||
->name('article.delete');
|
->name('comments.new');
|
||||||
});
|
});
|
||||||
@@ -62,22 +62,6 @@ class ArticleServiceProvider extends ServiceProvider {
|
|||||||
$this->loadViewsFrom(array_merge(array_map(function ($path) {
|
$this->loadViewsFrom(array_merge(array_map(function ($path) {
|
||||||
return $path . '/modules/article';
|
return $path . '/modules/article';
|
||||||
}, \Config::get('view.paths')), [$sourcePath]), 'article');
|
}, \Config::get('view.paths')), [$sourcePath]), 'article');
|
||||||
|
|
||||||
/**
|
|
||||||
* @var $registrator TemplateRegistrator
|
|
||||||
*/
|
|
||||||
try {
|
|
||||||
// setup some global variables
|
|
||||||
$registrator = $this->app->make('registerTemplateDir');
|
|
||||||
$registrator->setBaseDirectory('resources/views/modules/article/visitor');
|
|
||||||
$registrator->setNamespace('article');
|
|
||||||
$registrator->setModuleId(Article::getModuleId());
|
|
||||||
|
|
||||||
// register path with current template name
|
|
||||||
$registrator->register(config('app.theme'), 'article::admin/adminMenu.templatePath');
|
|
||||||
} catch (InvalidArgumentException $e) {
|
|
||||||
// ignore this exception
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
return [
|
||||||
|
"allowComments" => "Povolit komentáře?",
|
||||||
|
"new" => "Napsat",
|
||||||
|
"overview" => "Všechny články",
|
||||||
|
];
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
return [
|
||||||
|
"approve" => "Schválit komentář a zobrazovat ho u článku",
|
||||||
|
"approved" => "Komentář úspěšně schválen",
|
||||||
|
"commentedArticle" => "Komentovaný článek",
|
||||||
|
"createdAt" => "Vloženo :date",
|
||||||
|
"deleted" => "Komentář smazán",
|
||||||
|
];
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
return [
|
||||||
|
"allArticles" => "Všechny články",
|
||||||
|
"blog" => "Blog",
|
||||||
|
"comments" => "Komentáře",
|
||||||
|
"commentsOverview" => "Všechny komentáře",
|
||||||
|
"description" => "Základní submodul pro blog. Tento modul umožňuje psát články.",
|
||||||
|
"name" => "Články",
|
||||||
|
];
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
return [
|
||||||
|
'createdAt' => 'Created at :date',
|
||||||
|
'commentedArticle' => 'Article',
|
||||||
|
'approve' => 'Approve comment',
|
||||||
|
'approved' => 'Comment successfully approved',
|
||||||
|
'deleted' => 'Comment deleted'
|
||||||
|
];
|
||||||
@@ -1,5 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
return [
|
return [
|
||||||
'name' => 'Article',
|
'name' => 'Articles',
|
||||||
'description' => 'Base submodule for blog'
|
'description' => 'Base submodule for blog',
|
||||||
|
'comments' => 'Comments',
|
||||||
|
'commentsOverview' => 'All comments',
|
||||||
|
'allArticles' => 'All articles',
|
||||||
|
'blog' => 'Blog'
|
||||||
];
|
];
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
return [
|
||||||
|
"allowComments" => "Povoliť komentáre?",
|
||||||
|
"new" => " Napísať nový",
|
||||||
|
"overview" => "Všetky články",
|
||||||
|
];
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
return [
|
||||||
|
"approve" => "Schváliť komentár",
|
||||||
|
"approved" => "Komentár úspešne schválený.",
|
||||||
|
"commentedArticle" => "Článok",
|
||||||
|
"createdAt" => "Vytvorené: :date",
|
||||||
|
"deleted" => "Komentár zmazaný.",
|
||||||
|
];
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
return [
|
||||||
|
"allArticles" => "Všetky články",
|
||||||
|
"blog" => "Blog",
|
||||||
|
"comments" => "Komentáre",
|
||||||
|
"commentsOverview" => "Všetky komentáre",
|
||||||
|
"description" => "Základný submodul pre blog",
|
||||||
|
"name" => "Články",
|
||||||
|
];
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
@extends('admin.layoutWithNavigation')
|
||||||
|
|
||||||
|
@section('pageHeading', trans('article::module.comments'))
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
@if (count($comments))
|
||||||
|
@foreach($comments as $comment)
|
||||||
|
|
||||||
|
<div class="card @if(!$comment->approved) card-warning @else card-default @endif">
|
||||||
|
<div class="card-header">
|
||||||
|
<div class="header-block">
|
||||||
|
<p class="title">
|
||||||
|
<img src="@gravatar($comment->author->email, 25)" class="img-rounded" alt="">
|
||||||
|
{{$comment->author->name}} ({{$comment->author->email}})
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-block">
|
||||||
|
<p>
|
||||||
|
{{$comment->content}}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer">
|
||||||
|
@lang('article::comments.createdAt', ['date' => \App\Helpers\Template::date($comment->created_at)]) |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@lang('article::comments.commentedArticle'): <a href="{{route('page.content', ['url' => $comment->article->url])}}" target="_blank">
|
||||||
|
{{$comment->article->title}}
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<div class="pull-right">
|
||||||
|
@if (!$comment->approved)
|
||||||
|
<a href="{{route('comments.approve', ['id' => $comment->id])}}" class="btn btn-sm btn-success" title="@lang('article::comments.approve')"
|
||||||
|
data-toggle="tooltip"><i class="fa fa-fw fa-check"></i></a>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<a href="{{route('comments.delete', ['id' => $comment->id])}}" class="btn btn-sm btn-warning"><i class="fa fa-fw fa-trash"></i></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{{--<div class="comment row">--}}
|
||||||
|
{{--<div class="col-lg-2">--}}
|
||||||
|
{{--<img class="img-rounded" src="@gravatar($comment->author->email)" alt="">--}}
|
||||||
|
|
||||||
|
{{--{{$comment->author->name}}--}}
|
||||||
|
|
||||||
|
{{--@date($comment->created_at)--}}
|
||||||
|
|
||||||
|
{{--</div>--}}
|
||||||
|
{{--<div class="col-lg-10">{{$comment->content}}</div>--}}
|
||||||
|
{{--<div class="col-lg2">--}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{{--</div>--}}
|
||||||
|
{{--</div>--}}
|
||||||
|
@endforeach
|
||||||
|
@else
|
||||||
|
<div class="alert alert-info">
|
||||||
|
@lang('article::comments.noComments')
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
@endsection
|
||||||
@@ -1,89 +1,89 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="columns large-6">
|
<div class="col-lg-6">
|
||||||
<label>
|
<input type="text" name="title" required class="form-control slug-source"
|
||||||
@lang('admin/contents.field_title')
|
placeholder="@lang('admin/contents.field_title')"
|
||||||
|
value="{{old('title', $page->title)}}" />
|
||||||
|
|
||||||
<input type="text" name="title" class="slug-source" placeholder="@lang('admin/contents.field_title')"
|
@include('admin.snippets.hasError', ['field' => 'title'])
|
||||||
value="{{old('title', $page->title)}}" />
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="columns large-4">
|
<div class="col-lg-4">
|
||||||
<label>
|
|
||||||
@lang('admin/contents.field_url')
|
|
||||||
|
|
||||||
<input type="text" name="url" class="slug-target" placeholder="@lang('admin/contents.field_url')"
|
<input type="text" name="url" required class="form-control slug-target"
|
||||||
value="{{old('url', $page->url)}}" />
|
placeholder="@lang('admin/contents.field_url')"
|
||||||
|
value="{{old('url', $page->url)}}" />
|
||||||
|
|
||||||
@if (isset($errors) && $errors->has('url'))
|
@include('admin.snippets.hasError', ['field' => 'url'])
|
||||||
<div class="callout alert">
|
|
||||||
{{ $errors->first('url') }}
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="column large-2 text-center">
|
<div class="col-lg-2 text-center">
|
||||||
<label>
|
<label>
|
||||||
@lang('admin/contents.lockUrl')<br />
|
<input class="checkbox" value="1" id="lockUrl"
|
||||||
|
|
||||||
<input type="checkbox" value="1" id="lockUrl"
|
|
||||||
@if(old('lockUrl') || ($page->id > 0 && \Illuminate\Support\Str::slug($page->title) != $page->url)) checked
|
@if(old('lockUrl') || ($page->id > 0 && \Illuminate\Support\Str::slug($page->title) != $page->url)) checked
|
||||||
@endif name="lockUrl" />
|
@endif name="lockUrl" type="checkbox">
|
||||||
|
<span>@lang('admin/contents.lockUrl')</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="columns large-6">
|
<div class="col-lg-6">
|
||||||
<label>
|
<select class="form-control" name="status">
|
||||||
<select name="status">
|
@foreach($contentStatuses as $status => $translation)
|
||||||
@foreach($contentStatuses as $status => $translation)
|
<option value="{{$status}}" @if(old('status', $page->status) == $status) selected @endif>
|
||||||
<option value="{{$status}}" @if(old('status', $page->status) == $status) selected @endif>
|
{{$translation}}
|
||||||
{{$translation}}
|
</option>
|
||||||
</option>
|
@endforeach
|
||||||
@endforeach
|
</select>
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
@if (isset($errors) && $errors->has('status'))
|
@include('admin.snippets.hasError', ['field' => 'status'])
|
||||||
<div class="callout alert">
|
|
||||||
{{ $errors->first('status') }}
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
</div>
|
||||||
<div class="column large-6">
|
<div class="col-lg-4">
|
||||||
|
<select class="form-control" name="parentPage">
|
||||||
|
<option value="">@lang('admin/contents.noParentPage')</option>
|
||||||
|
|
||||||
|
@foreach($rootPages as $rootPage)
|
||||||
|
<option value="{{$rootPage->id}}"
|
||||||
|
@if(old('parent_page', $page->parent_id) == $rootPage->id) selected @endif>
|
||||||
|
{{$rootPage->title}}
|
||||||
|
</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
|
||||||
|
@include('admin.snippets.hasError', ['field' => 'parentPage'])
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-2 text-center">
|
||||||
<label>
|
<label>
|
||||||
@lang('article::article.allowComments')
|
<input class="checkbox" value="1"
|
||||||
<input type="checkbox" value="1" @if(old('allowComments', isset($page->module_settings->allowComments) ? $page->module_settings->allowComments : true)) checked @endif name="allowComments" />
|
@if(old('allowComments', isset($page->module_settings->allowComments) ? $page->module_settings->allowComments : true)) checked
|
||||||
|
@endif name="allowComments" type="checkbox">
|
||||||
|
<span>@lang('article::article.allowComments')</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if($module->support_categories && count($categories))
|
@if($module->support_categories && count($categories))
|
||||||
<div class="column large-12">
|
<div class="col-lg-12">
|
||||||
<label>
|
<select class="form-control" name="category">
|
||||||
@lang('admin/contents.category')
|
<option value="">@lang('admin/contents.noCategory')</option>
|
||||||
|
@foreach($categories as $category)
|
||||||
<select name="category">
|
<option value="{{$category->id}}"
|
||||||
<option value=""> ---</option>
|
@if($category->id == old('category', $page->category_id)) selected @endif>
|
||||||
@foreach($categories as $category)
|
{{str_repeat(' - ', $category->real_depth)}} {{$category->name}}
|
||||||
<option value="{{$category->id}}"
|
</option>
|
||||||
@if($category->id == old('category', $page->category_id)) selected @endif>
|
@endforeach
|
||||||
{{str_repeat(' - ', $category->real_depth)}} {{$category->name}}
|
</select>
|
||||||
</option>
|
|
||||||
@endforeach
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="columns large-12">
|
<div class="col-lg-12">
|
||||||
<label>
|
<textarea name="pageContent" id="pageContent" class="wysiwyg-editor">
|
||||||
<textarea name="pageContent" id="pageContent" class="wysiwyg-editor">
|
{{old('pageContent', $page->content)}}
|
||||||
{{old('pageContent', $page->content)}}
|
</textarea>
|
||||||
</textarea>
|
|
||||||
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "pingpong-modules/article",
|
|
||||||
"description": "",
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Pingpong Labs",
|
|
||||||
"email": "pingpong.labs@gmail.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"Modules\\Article\\": ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'name' => 'ArticleList'
|
'name' => 'Article list',
|
||||||
|
'translatedName' => 'articlelist::module.name',
|
||||||
|
'translatedDescription' => 'articlelist::module.description',
|
||||||
|
'alias' => 'blog-articlelist',
|
||||||
|
'handler' => \Modules\Blog\ArticleList\Handlers\ArticleList::class,
|
||||||
|
'providers' => [\Modules\Blog\ArticleList\Providers\ArticleListServiceProvider::class],
|
||||||
|
'files' => ['start.php'],
|
||||||
|
'order' => 0,
|
||||||
];
|
];
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
<?php namespace Modules\Blog\ArticleList\Database\Seeders;
|
|
||||||
|
|
||||||
use Illuminate\Database\Seeder;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class ArticleListDatabaseSeeder extends Seeder {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Run the database seeds.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function run()
|
|
||||||
{
|
|
||||||
Model::unguard();
|
|
||||||
|
|
||||||
// $this->call("OthersTableSeeder");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,155 @@
|
|||||||
|
<?php
|
||||||
|
namespace Modules\Blog\ArticleList\Handlers;
|
||||||
|
|
||||||
|
use App\Enumerations\ModulesHandlerToId;
|
||||||
|
use App\Handlers\Handler;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Http\Requests\Request;
|
||||||
|
use App\Models\Content;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Input;
|
||||||
|
use Modules\Blog\Article\Handlers\Article;
|
||||||
|
use Modules\Categories\Entities\Category;
|
||||||
|
|
||||||
|
class ArticleList extends Handler
|
||||||
|
{
|
||||||
|
public static function registerAdminMenu(User $user)
|
||||||
|
{
|
||||||
|
parent::registerAdminMenu($user);
|
||||||
|
|
||||||
|
$menu = \Menu::instance('mainMenu');
|
||||||
|
|
||||||
|
$blogSubmenu = $menu->whereTitle(trans('article::module.blog'));
|
||||||
|
if (!$blogSubmenu) {
|
||||||
|
$blogSubmenu = $menu->dropdown(trans('article::module.blog'), function ($sub) {
|
||||||
|
}, 20, ['icon' => 'fa fa-fw fa-book']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$blogSubmenu->route('content.new', trans('articlelist::module.name'), ['id' => self::getModuleId()], 100, ['icon' => 'fa fa-fw fa-list-alt']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render given module into visitor area.
|
||||||
|
*
|
||||||
|
* @param Content $content DB model from table contents
|
||||||
|
* @param array $parameters parameters used for modifications/custom settings of given model
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function render(Content $content, $parameters)
|
||||||
|
{
|
||||||
|
$articles = Content::where('module_handler', Article::class);
|
||||||
|
|
||||||
|
// selected category?
|
||||||
|
|
||||||
|
// selected articles from archive?
|
||||||
|
$year = Input::get('y');
|
||||||
|
$month = Input::get('m');
|
||||||
|
$day = Input::get('d');
|
||||||
|
|
||||||
|
if ($year) {
|
||||||
|
$articles = $articles->where(DB::raw('YEAR(created_at)'), $year);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($month) {
|
||||||
|
$articles = $articles->where(DB::raw('MONTH(created_at)'), $month);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($day) {
|
||||||
|
$articles = $articles->where(DB::raw('DAY(created_at)'), $day);
|
||||||
|
}
|
||||||
|
|
||||||
|
// is given any category?
|
||||||
|
$categoryUrl = Input::get('category');
|
||||||
|
if ($categoryUrl && \Module::get('Categories')
|
||||||
|
->enabled()
|
||||||
|
) {
|
||||||
|
$category = Category::where('url', $categoryUrl)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$subcategories = $category->getChildren()
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
$categories = [$category->id];
|
||||||
|
$categories = array_merge($categories, array_map(function ($cat) {
|
||||||
|
return $cat['id'];
|
||||||
|
}, $subcategories));
|
||||||
|
|
||||||
|
$articles = $articles->whereIn('category_id', $categories);
|
||||||
|
}
|
||||||
|
|
||||||
|
// show articles for not-logged users of even for logged onew?
|
||||||
|
if (!Auth::user()) {
|
||||||
|
$articles = $articles->where('status', Content::STATUS_PUBLIC);
|
||||||
|
} else {
|
||||||
|
$articles = $articles->whereIn('status', [Content::STATUS_PUBLIC, Content::STATUS_PROTECTED]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// show articles only from specified user
|
||||||
|
$author = Input::get('author');
|
||||||
|
if ($author) {
|
||||||
|
$user = User::findOrFail($author);
|
||||||
|
|
||||||
|
$articles = $articles->where('user_id', $user->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
$articles = $articles->orderBy('created_at', 'DESC')
|
||||||
|
->paginate(20);
|
||||||
|
|
||||||
|
return Controller::VisitorsView($content->template, ['page' => $content, 'articles' => $articles]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getModuleId()
|
||||||
|
{
|
||||||
|
$handler = config('articlelist.handler');
|
||||||
|
$allModules = ModulesHandlerToId::getWithTranslations();
|
||||||
|
$moduleId = isset($allModules[$handler]) ? $allModules[$handler] : null;
|
||||||
|
|
||||||
|
return $moduleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function supportCategories()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save module-specific values into database
|
||||||
|
*
|
||||||
|
* @param Content $content
|
||||||
|
* @param Request $request
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
* @internal param Widget $widget
|
||||||
|
*/
|
||||||
|
public static function createNew(Content &$content, Request $request)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method used for editing existing content page.
|
||||||
|
*
|
||||||
|
* Reason why it is separated from createNew() method is simple - we need to save history of changes.
|
||||||
|
*
|
||||||
|
* @param Content $content
|
||||||
|
* @param Request $request
|
||||||
|
*
|
||||||
|
* @param $revisionID string ID of revision used
|
||||||
|
*
|
||||||
|
* @return int number of edited fields
|
||||||
|
*/
|
||||||
|
public static function edit(Content &$content, Request $request, $revisionID)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Install module
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public static function install()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
<?php namespace Modules\Blog\ArticleList\Providers;
|
<?php namespace Modules\Blog\ArticleList\Providers;
|
||||||
|
|
||||||
|
use App\Handlers\Registrators\TemplateRegistrator;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use InvalidArgumentException;
|
||||||
|
use Modules\Blog\ArticleList\Handlers\ArticleList;
|
||||||
|
|
||||||
class ArticleListServiceProvider extends ServiceProvider {
|
class ArticleListServiceProvider extends ServiceProvider {
|
||||||
|
|
||||||
@@ -30,7 +33,6 @@ class ArticleListServiceProvider extends ServiceProvider {
|
|||||||
*/
|
*/
|
||||||
public function register()
|
public function register()
|
||||||
{
|
{
|
||||||
//
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,12 +42,8 @@ class ArticleListServiceProvider extends ServiceProvider {
|
|||||||
*/
|
*/
|
||||||
protected function registerConfig()
|
protected function registerConfig()
|
||||||
{
|
{
|
||||||
$this->publishes([
|
$this->publishes([__DIR__.'/../Config/config.php' => config_path('articlelist.php')]);
|
||||||
__DIR__.'/../Config/config.php' => config_path('articlelist.php'),
|
$this->mergeConfigFrom(__DIR__.'/../Config/config.php', 'articlelist');
|
||||||
]);
|
|
||||||
$this->mergeConfigFrom(
|
|
||||||
__DIR__.'/../Config/config.php', 'articlelist'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,16 +54,30 @@ class ArticleListServiceProvider extends ServiceProvider {
|
|||||||
public function registerViews()
|
public function registerViews()
|
||||||
{
|
{
|
||||||
$viewPath = base_path('resources/views/modules/articlelist');
|
$viewPath = base_path('resources/views/modules/articlelist');
|
||||||
|
|
||||||
$sourcePath = __DIR__.'/../Resources/views';
|
$sourcePath = __DIR__.'/../Resources/views';
|
||||||
|
|
||||||
$this->publishes([
|
$this->publishes([$sourcePath => $viewPath]);
|
||||||
$sourcePath => $viewPath
|
|
||||||
]);
|
|
||||||
|
|
||||||
$this->loadViewsFrom(array_merge(array_map(function ($path) {
|
$this->loadViewsFrom(array_merge(array_map(function ($path) {
|
||||||
return $path . '/modules/articlelist';
|
return $path . '/modules/articlelist';
|
||||||
}, \Config::get('view.paths')), [$sourcePath]), 'articlelist');
|
}, \Config::get('view.paths')), [$sourcePath]), 'articlelist');
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var $registrator TemplateRegistrator
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
// setup some global variables
|
||||||
|
$registrator = $this->app->make('registerTemplateDir');
|
||||||
|
$registrator->setBaseDirectory('resources/views/modules/articlelist/visitor');
|
||||||
|
$registrator->setNamespace('articlelist');
|
||||||
|
$registrator->setModuleId(ArticleList::getModuleId());
|
||||||
|
|
||||||
|
// register path with current template name
|
||||||
|
$registrator->register(config('app.theme'), 'articlelist::module.templatePath');
|
||||||
|
} catch (InvalidArgumentException $e) {
|
||||||
|
// ignore this exception
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
return [
|
||||||
|
"description" => "Modul pro zobrazování seznamu článků na webu.",
|
||||||
|
"name" => "Seznam článků",
|
||||||
|
];
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
return [
|
||||||
|
'name' => 'Article list',
|
||||||
|
'description' => 'Module for displaying list of articles on web',
|
||||||
|
];
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
return [
|
||||||
|
"description" => "Modul pre zobrazenie zoznamu článkov na webe",
|
||||||
|
"name" => "Zoznam článkov",
|
||||||
|
];
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
@extends('articlelist::layouts.master')
|
|
||||||
|
|
||||||
@section('content')
|
|
||||||
|
|
||||||
<h1>Hello World</h1>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
This view is loaded from module: {!! config('articlelist.name') !!}
|
|
||||||
</p>
|
|
||||||
|
|
||||||
@stop
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<title>Module ArticleList</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
@yield('content')
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
return [
|
|
||||||
'name' => 'Comments',
|
|
||||||
'translatedName' => 'comments::module.name',
|
|
||||||
'translatedDescription' => 'comments::module.description',
|
|
||||||
'alias' => 'blog-comments',
|
|
||||||
'handler' => \Modules\Blog\Comments\Handlers\Comments::class,
|
|
||||||
'providers' => [\Modules\Blog\Comments\Providers\CommentsServiceProvider::class],
|
|
||||||
'files' => ['start.php'],
|
|
||||||
'order' => 0,
|
|
||||||
];
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace Modules\Blog\Comments\Handlers;
|
|
||||||
|
|
||||||
use App\Enumerations\ModulesHandlerToId;
|
|
||||||
use App\Handlers\BaseHandler;
|
|
||||||
use App\Models\User;
|
|
||||||
|
|
||||||
class Comments extends BaseHandler
|
|
||||||
{
|
|
||||||
public static function getModuleId()
|
|
||||||
{
|
|
||||||
$handler = config('comments.handler');
|
|
||||||
$allModules = ModulesHandlerToId::getWithTranslations();
|
|
||||||
$moduleId = isset($allModules[$handler]) ? $allModules[$handler] : null;
|
|
||||||
|
|
||||||
return $moduleId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Install module
|
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public static function install()
|
|
||||||
{
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function registerAdminMenu(User $user)
|
|
||||||
{
|
|
||||||
$menu = \Menu::instance('mainMenu');
|
|
||||||
|
|
||||||
$menu->dropdown(trans('comments::module.name'), function ($sub) {
|
|
||||||
$sub->route('comments.overview', trans('comments::module.overview'), [], 10, ['icon' => 'fa fa-fw fa-commenting-o']);
|
|
||||||
}, 10, ['icon' => 'fa fa-fw fa-comments-o']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<?php namespace Modules\Blog\Comments\Http\Controllers;
|
|
||||||
|
|
||||||
use Pingpong\Modules\Routing\Controller;
|
|
||||||
|
|
||||||
class CommentsController extends Controller {
|
|
||||||
|
|
||||||
public function index()
|
|
||||||
{
|
|
||||||
return view('articlelist::index');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
Route::group(['middleware' => 'web', 'prefix' => 'comments', 'namespace' => 'Modules\Blog\Comments\Http\Controllers'], function()
|
|
||||||
{
|
|
||||||
Route::get('/', 'CommentsController@index')->name('comments.overview');
|
|
||||||
});
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
<?php namespace Modules\Blog\Comments\Providers;
|
|
||||||
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
|
||||||
|
|
||||||
class CommentsServiceProvider extends ServiceProvider {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates if loading of the provider is deferred.
|
|
||||||
*
|
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
protected $defer = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Boot the application events.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function boot()
|
|
||||||
{
|
|
||||||
$this->registerTranslations();
|
|
||||||
$this->registerConfig();
|
|
||||||
$this->registerViews();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register the service provider.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function register()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register config.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function registerConfig()
|
|
||||||
{
|
|
||||||
$this->publishes([__DIR__.'/../Config/config.php' => config_path('comments.php')]);
|
|
||||||
$this->mergeConfigFrom(__DIR__.'/../Config/config.php', 'comments');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register views.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function registerViews()
|
|
||||||
{
|
|
||||||
$viewPath = base_path('resources/views/modules/comments');
|
|
||||||
$sourcePath = __DIR__.'/../Resources/views';
|
|
||||||
|
|
||||||
$this->publishes([$sourcePath => $viewPath]);
|
|
||||||
|
|
||||||
$this->loadViewsFrom(array_merge(array_map(function ($path) {
|
|
||||||
return $path . '/modules/comments';
|
|
||||||
}, \Config::get('view.paths')), [$sourcePath]), 'comments');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register translations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function registerTranslations()
|
|
||||||
{
|
|
||||||
$langPath = base_path('resources/lang/modules/comments');
|
|
||||||
|
|
||||||
if (is_dir($langPath)) {
|
|
||||||
$this->loadTranslationsFrom($langPath, 'comments');
|
|
||||||
} else {
|
|
||||||
$this->loadTranslationsFrom(__DIR__ .'/../Resources/lang', 'comments');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the services provided by the provider.
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function provides()
|
|
||||||
{
|
|
||||||
return array();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<?php
|
|
||||||
return [
|
|
||||||
'name' => 'Comments',
|
|
||||||
'description' => "Bring comment support to blog module",
|
|
||||||
'overview' => 'All comments'
|
|
||||||
];
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Register Namespaces And Routes
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| When a module starting, this file will executed automatically. This helps
|
|
||||||
| to register some namespaces like translator or view. Also this file
|
|
||||||
| will load the routes file for each module. You may also modify
|
|
||||||
| this file as you want.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
require __DIR__ . '/Http/routes.php';
|
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
|
class CreateComments extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('comments', function (Blueprint $table) {
|
||||||
|
$table->increments('id');
|
||||||
|
$table->timestamps();
|
||||||
|
$table->integer('user_id')
|
||||||
|
->nullable(true)
|
||||||
|
->default(null)
|
||||||
|
->comment('When comment was inserted by logged user, save his ID here');
|
||||||
|
$table->integer('content_id');
|
||||||
|
$table->string('email');
|
||||||
|
$table->string('name');
|
||||||
|
$table->text('content');
|
||||||
|
$table->boolean('approved');
|
||||||
|
|
||||||
|
$table->foreign('content_id')
|
||||||
|
->references('id')
|
||||||
|
->on('contents')
|
||||||
|
->onDelete('cascade')
|
||||||
|
->onUpdate('cascade');
|
||||||
|
|
||||||
|
$table->foreign('user_id')
|
||||||
|
->references('id')
|
||||||
|
->on('users')
|
||||||
|
->onDelete('set null')
|
||||||
|
->onUpdate('cascade');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::drop('comments');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
return [
|
return [
|
||||||
'name' => 'Blog',
|
'name' => 'Blog',
|
||||||
'description' => '',
|
'translatedName' => 'article::module.blog',
|
||||||
'hasSubmodules' => true,
|
'description' => 'article.module.blogDescription',
|
||||||
|
'hasSubmodules' => true,
|
||||||
];
|
];
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
return [
|
||||||
|
"actions" => "Akcie",
|
||||||
|
"deleteSuccessfull" => "Kategória úspešne zmazaná.",
|
||||||
|
"description" => "Modul pre správu kategórií a kategorizovanie obsahu",
|
||||||
|
"edit" => "Upraviť kategóriu",
|
||||||
|
"fields" => ["description" => "Popis",
|
||||||
|
"module" => "Modul",
|
||||||
|
"name" => "Názov",
|
||||||
|
"parentCategory" => "Rodičovská kategória",
|
||||||
|
"save" => "Uložiť kategóriu",
|
||||||
|
"url" => "URL",
|
||||||
|
],
|
||||||
|
"module" => "Modul",
|
||||||
|
"name" => "Kategórie",
|
||||||
|
"new" => "Nová kategória",
|
||||||
|
"noCategories" => "Žiadne kategórie nie sú dostupné.",
|
||||||
|
"overview" => "Všetky kategórie",
|
||||||
|
"saveSuccessfull" => "Kategória úspešne uložená.",
|
||||||
|
];
|
||||||
@@ -62,22 +62,6 @@ class ContactFormServiceProvider extends ServiceProvider
|
|||||||
$this->loadViewsFrom(array_merge(array_map(function ($path) {
|
$this->loadViewsFrom(array_merge(array_map(function ($path) {
|
||||||
return $path . '/modules/contactform';
|
return $path . '/modules/contactform';
|
||||||
}, \Config::get('view.paths')), [$sourcePath]), 'contactform');
|
}, \Config::get('view.paths')), [$sourcePath]), 'contactform');
|
||||||
|
|
||||||
/**
|
|
||||||
* @var $registrator TemplateRegistrator
|
|
||||||
*/
|
|
||||||
$registrator = $this->app->make('registerTemplateDir');
|
|
||||||
try {
|
|
||||||
// setup some global variables
|
|
||||||
$registrator->setBaseDirectory('resources/views/modules/contactform/visitor');
|
|
||||||
$registrator->setNamespace('contactform');
|
|
||||||
$registrator->setModuleId(call_user_func([config('contactform.handler'), 'getModuleId']));
|
|
||||||
|
|
||||||
// register path with current template name
|
|
||||||
$registrator->register(config('app.theme'), 'contactform::admin/adminMenu.templatePath');
|
|
||||||
} catch (InvalidArgumentException $e) {
|
|
||||||
// ignore this exception
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ return [
|
|||||||
"defaultSubject" => "Nová zpráva z kontaktního formuláře",
|
"defaultSubject" => "Nová zpráva z kontaktního formuláře",
|
||||||
"email" => "E-mail",
|
"email" => "E-mail",
|
||||||
"emailList" => "Odesílat zprávy na tyto adresy",
|
"emailList" => "Odesílat zprávy na tyto adresy",
|
||||||
"gpsLat" => "GPS délka",
|
"gpsLat" => "GPS šířka",
|
||||||
"gpsLng" => "GPS délka",
|
"gpsLng" => "GPS délka",
|
||||||
"phone" => "Kontaktní telefon",
|
"phone" => "Kontaktní telefon",
|
||||||
"subject" => "Předmět zprávy",
|
"subject" => "Předmět zprávy",
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
return [
|
||||||
|
"contactForm" => "Kontaktný formulár",
|
||||||
|
"new" => "Nový",
|
||||||
|
"overview" => "Všetky formuláre",
|
||||||
|
"sentMessages" => "Správy",
|
||||||
|
"templatePath" => "Kontaktný formulár",
|
||||||
|
];
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
return [
|
||||||
|
"address" => "Adresa",
|
||||||
|
"compName" => "Názov zobrazený nad adresou",
|
||||||
|
"contactEmail" => "E-mail, kam budú doručované správy z tohoto formulára",
|
||||||
|
"contactInformation" => "Kontaktné informácie",
|
||||||
|
"content" => "Obsah kontaktného formulára",
|
||||||
|
"defaultSubject" => "Nová správa z kontaktného formulára",
|
||||||
|
"email" => "E-mail",
|
||||||
|
"emailList" => "Odosielať správy na tieto adresy",
|
||||||
|
"gpsLat" => "GPS šírka",
|
||||||
|
"gpsLng" => "GPS dĺžka",
|
||||||
|
"phone" => "Kontaktný telefón",
|
||||||
|
"subject" => "Predmet správy",
|
||||||
|
];
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
return [
|
||||||
|
"columnAddress" => "Adresa",
|
||||||
|
"columnCompanyName" => "Názov spoločnosti",
|
||||||
|
"columnContactEmail" => "Kontaktný e-mail",
|
||||||
|
"columnEmail" => "E-mail",
|
||||||
|
"columnGpsLat" => "GPS šírka",
|
||||||
|
"columnGpsLng" => "GPS dĺžka",
|
||||||
|
"columnPhone" => "Telefón",
|
||||||
|
"columnSubject" => "Predmet",
|
||||||
|
];
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
return [
|
||||||
|
"recaptchaSecret" => "Application secret key pre reCaptcha",
|
||||||
|
"recaptchaSiteKey" => "Site key pre reCaptcha",
|
||||||
|
];
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
return [
|
||||||
|
"description" => "Jednoduchý kontaktný formulár",
|
||||||
|
"name" => "Kontaktný formulár",
|
||||||
|
];
|
||||||
@@ -62,22 +62,6 @@ class GalleryServiceProvider extends ServiceProvider
|
|||||||
$this->loadViewsFrom(array_merge(array_map(function ($path) {
|
$this->loadViewsFrom(array_merge(array_map(function ($path) {
|
||||||
return $path.'/modules/gallery';
|
return $path.'/modules/gallery';
|
||||||
}, \Config::get('view.paths')), [$sourcePath]), 'gallery');
|
}, \Config::get('view.paths')), [$sourcePath]), 'gallery');
|
||||||
|
|
||||||
/**
|
|
||||||
* @var $registrator TemplateRegistrator
|
|
||||||
*/
|
|
||||||
$registrator = $this->app->make('registerTemplateDir');
|
|
||||||
try {
|
|
||||||
// setup some global variables
|
|
||||||
$registrator->setBaseDirectory('resources/views/modules/gallery/visitor');
|
|
||||||
$registrator->setNamespace('gallery');
|
|
||||||
$registrator->setModuleId(call_user_func([config('gallery.handler'), 'getModuleId']));
|
|
||||||
|
|
||||||
// register path with current template name
|
|
||||||
$registrator->register(config('app.theme'), 'gallery::admin/adminMenu.templatePath');
|
|
||||||
} catch (InvalidArgumentException $e) {
|
|
||||||
// ignore this exception
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
return [
|
||||||
|
"new" => "Nová galéria",
|
||||||
|
"overview" => "Všetky galérie",
|
||||||
|
"templatePath" => "Šablóny galérie",
|
||||||
|
];
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
return [
|
||||||
|
"invalidGallery" => "Táto stránka nie je platná fotogaléria.",
|
||||||
|
"makeSlider" => "Vytvoriť slider z tejto fotogalérie",
|
||||||
|
"orbitSliderMissing" => "Nie je možné vytvoriť slider. Widget pre zobrazenie slideru nie je nainštalovaný.",
|
||||||
|
"sliderCreated" => "Slider úspešne vytvorený.",
|
||||||
|
"sliderEdit" => "Nastavenie slideru",
|
||||||
|
"sliderFailed" => "Slider nemohol byť vytvorený. Správa: :message",
|
||||||
|
"upload" => "Nahrať fotografie",
|
||||||
|
"uploadAfterSavingGallery" => "Nahrávanie do tejto galérie nie je dostupné. Najprv uložte galériu a fotografie nahrávajte až v rámci editácie.",
|
||||||
|
];
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
return [
|
||||||
|
"description" => "Jednoduchá galéria zobrazujúca fotografie/grafiku v jednoduchom lightboxe. Tento modul neponúka žiadne špeciálne zobrazovanie fotografií.",
|
||||||
|
"name" => "Galéria",
|
||||||
|
];
|
||||||
@@ -38,18 +38,6 @@ class StaticPagesServiceProvider extends ServiceProvider
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Method for installing module into database
|
|
||||||
// */
|
|
||||||
// protected function install()
|
|
||||||
// {
|
|
||||||
// $handler = config('staticpages.handler');
|
|
||||||
// $installedModules = ModulesHandlerToId::getWithTranslations();
|
|
||||||
// if (!isset($installedModules[$handler])) {
|
|
||||||
// Module::install('staticpages::module.name', 'staticpages', 'staticpages::module.description');
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register config.
|
* Register config.
|
||||||
*
|
*
|
||||||
@@ -69,30 +57,14 @@ class StaticPagesServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function registerViews()
|
public function registerViews()
|
||||||
{
|
{
|
||||||
$viewPath = base_path('resources/views/modules/staticpages');
|
|
||||||
$sourcePath = __DIR__ . '/../Resources/views';
|
$sourcePath = __DIR__ . '/../Resources/views';
|
||||||
|
$viewPath = base_path('resources/views/modules/staticpages');
|
||||||
|
|
||||||
$this->publishes([$sourcePath => $viewPath], 'module-views');
|
$this->publishes([$sourcePath => $viewPath], 'module-views');
|
||||||
|
|
||||||
$this->loadViewsFrom(array_merge(array_map(function ($path) {
|
$this->loadViewsFrom(array_merge(array_map(function ($path) {
|
||||||
return $path . '/modules/staticpages';
|
return $path . '/modules/staticpages';
|
||||||
}, \Config::get('view.paths')), [$sourcePath]), 'staticpages');
|
}, \Config::get('view.paths')), [$sourcePath]), 'staticpages');
|
||||||
|
|
||||||
/**
|
|
||||||
* @var $registrator TemplateRegistrator
|
|
||||||
*/
|
|
||||||
$registrator = $this->app->make('registerTemplateDir');
|
|
||||||
try {
|
|
||||||
// setup some global variables
|
|
||||||
$registrator->setBaseDirectory('resources/views/modules/staticpages/visitor');
|
|
||||||
$registrator->setNamespace('staticpages');
|
|
||||||
$registrator->setModuleId(call_user_func([config('staticpages.handler'), 'getModuleId']));
|
|
||||||
|
|
||||||
// register path with current template name
|
|
||||||
$registrator->register(config('app.theme'), 'staticpages::admin.templatePath');
|
|
||||||
} catch (InvalidArgumentException $e) {
|
|
||||||
// ignore this exception
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
return [
|
||||||
|
"new" => "Nová stránka",
|
||||||
|
"overview" => "Zoznam všetkých statických stránok",
|
||||||
|
"templatePath" => "Statické stránky",
|
||||||
|
];
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
return [
|
||||||
|
"new" => "Vytvoriť novú",
|
||||||
|
"overview" => "Prehľad",
|
||||||
|
"staticPages" => "Statické stránky",
|
||||||
|
];
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
return [
|
||||||
|
"description" => "Statické stránky sú určené k zobrazovaniu statického obsahu na webe.",
|
||||||
|
"name" => "Statické stránky",
|
||||||
|
];
|
||||||
+7
-7
@@ -14191,7 +14191,6 @@ img {
|
|||||||
|
|
||||||
.timeline > li {
|
.timeline > li {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.timeline > li:before,
|
.timeline > li:before,
|
||||||
@@ -14204,7 +14203,6 @@ img {
|
|||||||
clear: both;
|
clear: both;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.timeline > li > .timeline-panel {
|
.timeline > li > .timeline-panel {
|
||||||
width: 46%;
|
width: 46%;
|
||||||
float: left;
|
float: left;
|
||||||
@@ -14250,7 +14248,7 @@ img {
|
|||||||
top: 26px;
|
top: 26px;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
margin-left: -14px;
|
margin-left: -14px;
|
||||||
background-color: #ddd;
|
background-color: #DDD;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
@@ -14349,6 +14347,7 @@ img {
|
|||||||
.ace-editor-container {
|
.ace-editor-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-editor {
|
.ace-editor {
|
||||||
position: absolute !important;
|
position: absolute !important;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -14365,11 +14364,12 @@ img {
|
|||||||
padding: .5em;
|
padding: .5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.header-block img {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.truncate {
|
.truncate {
|
||||||
width: 90%;
|
word-break: break-all;
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.bold {
|
.bold {
|
||||||
|
|||||||
@@ -1,17 +1,23 @@
|
|||||||
<?php
|
<?php
|
||||||
return [
|
return [
|
||||||
"actions" => "Akce",
|
"actions" => "Akce",
|
||||||
"code" => "Unikátní kód (používá se v šablonách pro vykreslení)",
|
"associateWidgets" => "Přiřadit widgety do této plochy",
|
||||||
"createNew" => "Vytvořit novou plochu",
|
"code" => "Unikátní kód (používá se v šablonách pro vykreslení)",
|
||||||
"description" => "Popis",
|
"createNew" => "Vytvořit novou plochu",
|
||||||
"edit" => "Upravuji plochu :name",
|
"delete" => "Smazat",
|
||||||
"editButton" => "Upravit",
|
"description" => "Popis",
|
||||||
"editSuccessfull" => "Změny úspěšně uloženy",
|
"edit" => "Upravuji plochu :name",
|
||||||
"invalidArea" => "Zvolená plocha pro widgety není platná. Vyberte prosím nějakou jinou.",
|
"editButton" => "Upravit",
|
||||||
"name" => "Jméno",
|
"editSuccessfull" => "Změny úspěšně uloženy",
|
||||||
"new" => "Nová plocha pro widgety",
|
"editTooltip" => "Upravit plochu pro widgety",
|
||||||
"noEntries" => "Zatím nebyla definována žádná plocha pro widgety.",
|
"invalidArea" => "Zvolená plocha pro widgety není platná. Vyberte prosím nějakou jinou.",
|
||||||
"overview" => "Seznam všech ploch pro widgety",
|
"name" => "Jméno",
|
||||||
"successfullyCreated" => "Plocha pro widgety úspěšně vytvořena",
|
"new" => "Nová plocha pro widgety",
|
||||||
"successfullyDeleted" => "Úspěšně smazáno",
|
"noEntries" => "Zatím nebyla definována žádná plocha pro widgety.",
|
||||||
|
"notDeletableArea" => "Nelze smazat požadovanou plochu. Tato plocha je nezbytnou součástí nainstalované šablony a její odstranění by znefunkčnilo celou šablonu.",
|
||||||
|
"overview" => "Seznam všech ploch pro widgety",
|
||||||
|
"save" => "Uložit",
|
||||||
|
"successfullyCreated" => "Plocha pro widgety úspěšně vytvořena",
|
||||||
|
"successfullyDeleted" => "Úspěšně smazáno",
|
||||||
|
"uniqueCode" => "Unikátní kód",
|
||||||
];
|
];
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user