Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c2502a2355 | ||
|
|
2d60010f9e | ||
|
|
3275e5aeed | ||
|
|
a7e91ef499 | ||
|
|
638f6ef134 | ||
|
|
e9e9f0976c | ||
|
|
5707750f5b | ||
|
|
72c64dc6d1 | ||
|
|
f876a08429 | ||
|
|
f48c0cfac3 |
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace App\CMS\Handlers\Registrators;
|
||||
|
||||
use App\CMS\Enumerations\Exceptions\EnumerationExistsException;
|
||||
use App\CMS\Exceptions\Enumerations\EnumerationExistsException;
|
||||
use App\CMS\Handlers\Contracts\SearchHandler;
|
||||
use App\CMS\Handlers\Contracts\SearchPresenterHandler;
|
||||
use App\CMS\Handlers\Registrators\Items\SearchEngine;
|
||||
|
||||
@@ -22,16 +22,9 @@ class CurrentTemplate implements TemplateHandler
|
||||
{
|
||||
if (!self::$initialized) {
|
||||
self::$template = Cache::rememberForever('current-template', function () {
|
||||
$template = Module::where('is_template', true)
|
||||
return Module::where('is_template', true)
|
||||
->where('enabled', true)
|
||||
->first();
|
||||
|
||||
// todo remove after adding $casts into Module model
|
||||
if ($template) {
|
||||
$template->module_settings = json_decode($template->module_settings);
|
||||
}
|
||||
|
||||
return $template;
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -27,12 +27,12 @@ class WidgetAreas
|
||||
|
||||
protected static function loadWidgetArea($uniqueCode)
|
||||
{
|
||||
dd($uniqueCode);
|
||||
WidgetArea::where('code', $uniqueCode)
|
||||
->increment('viewed');
|
||||
|
||||
$widgets = Cache::remember('widget-area-' . $uniqueCode, setting('widgetCacheLifetime', 5), function () use ($uniqueCode) {
|
||||
$widgetArea = new WidgetArea();
|
||||
$widgetArea = app(\App\CMS\Repositories\Widgets\WidgetArea::class);
|
||||
|
||||
return $widgetArea->getWidgets($uniqueCode)
|
||||
->get();
|
||||
});
|
||||
@@ -69,6 +69,8 @@ class WidgetAreas
|
||||
self::initWidgetAreas();
|
||||
}
|
||||
|
||||
// dd($uniqueCode);
|
||||
|
||||
if (!isset(self::$widgetAreas[$uniqueCode])) {
|
||||
self::loadWidgetArea($uniqueCode);
|
||||
}
|
||||
|
||||
@@ -31,22 +31,13 @@ class CreateDirectory implements Interaction
|
||||
{
|
||||
$data['parentDirectory'] = isset($data['parentDirectory']) ? $data['parentDirectory'] : null;
|
||||
|
||||
// todo this should probably go into validation, but we are not able to get $data in getValidationRules
|
||||
// check if created folder does not exist in current directory
|
||||
if ($this->repository->checkIfNameExists($data['name'], $data['parentDirectory'])) {
|
||||
throw new SubdirectoryExistsInDirectory();
|
||||
}
|
||||
|
||||
// todo use Directory::create() and rename columns/fields in request
|
||||
// create new database entry
|
||||
$directory = new Directory();
|
||||
$directory->name = $data['name'];
|
||||
$directory->parent_id = $data['parentDirectory'];
|
||||
$directory->user_id = \Auth::user()->id;
|
||||
$directory->description = $data['description'];
|
||||
$directory->save();
|
||||
|
||||
return $directory;
|
||||
return $this->repository->create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\CMS\MenuPresenters;
|
||||
|
||||
use Pingpong\Menus\MenuItem;
|
||||
use Pingpong\Menus\Presenters\Presenter;
|
||||
use Nwidart\Menus\MenuItem;
|
||||
use Nwidart\Menus\Presenters\Presenter;
|
||||
|
||||
class FoundationDrilldownMenuPresenter extends Presenter
|
||||
{
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\CMS\MenuPresenters;
|
||||
|
||||
use Pingpong\Menus\Presenters\Presenter;
|
||||
use Nwidart\Menus\Presenters\Presenter;
|
||||
|
||||
class FoundationDropdownMenuPresenter extends Presenter
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
namespace App\CMS\MenuPresenters;
|
||||
|
||||
use Pingpong\Menus\MenuItem;
|
||||
use Pingpong\Menus\Presenters\Presenter;
|
||||
use Nwidart\Menus\MenuItem;
|
||||
use Nwidart\Menus\Presenters\Presenter;
|
||||
|
||||
class MetismenuPresenter extends Presenter
|
||||
{
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
namespace App\CMS\MenuPresenters;
|
||||
|
||||
use Pingpong\Menus\MenuItem;
|
||||
use Pingpong\Menus\Presenters\Presenter;
|
||||
use Nwidart\Menus\MenuItem;
|
||||
use Nwidart\Menus\Presenters\Presenter;
|
||||
|
||||
|
||||
class ProfileMenuPresenter extends Presenter
|
||||
{
|
||||
|
||||
+4
-8
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
namespace App\CMS\Modules\ServiceProviders;
|
||||
|
||||
abstract class ModuleServiceProvider extends ServiceProvider
|
||||
use Illuminate\Support\ServiceProvider as LaravelServiceProvider;
|
||||
|
||||
abstract class ServiceProvider extends LaravelServiceProvider
|
||||
{
|
||||
/**
|
||||
* Indicates if loading of the provider is deferred.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $defer = false;
|
||||
@@ -20,7 +20,6 @@ abstract class ModuleServiceProvider extends ServiceProvider
|
||||
|
||||
/**
|
||||
* Boot the application events.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
@@ -35,7 +34,6 @@ abstract class ModuleServiceProvider extends ServiceProvider
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerConfig()
|
||||
@@ -50,7 +48,6 @@ abstract class ModuleServiceProvider extends ServiceProvider
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerViews()
|
||||
@@ -69,7 +66,6 @@ abstract class ModuleServiceProvider extends ServiceProvider
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerTranslations()
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => '$Module$',
|
||||
'translatedName' => '$module$::$module$.name',
|
||||
'translatedDescription' => '$module$::$module$.description',
|
||||
'alias' => 'categories',
|
||||
'handler' => \Modules\$Module$\Handlers\$Module$Handler::class,
|
||||
'providers' => [\Modules\$Module$\Providers\$Module$ServiceProvider::class],
|
||||
'files' => ['Http/routes.php'],
|
||||
'order' => 0,
|
||||
];
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
namespace Modules\$ModuleNamespace$\Entities;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class $Entity$ extends Model {
|
||||
// ...
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\$ModuleNamespace$\Handlers;
|
||||
|
||||
use App\CMS\Contracts\Content\ContentTitles;
|
||||
use App\Models\Content\Content;
|
||||
|
||||
class $Module$ContentHandler extends $Module$Handler implements ContentTitles
|
||||
{
|
||||
/**
|
||||
* Get translated title for pages overview of given type.
|
||||
* This value is used for rendering list of all content pages of given type in administration.
|
||||
* @return string
|
||||
*/
|
||||
public static function getOverviewTitle()
|
||||
{
|
||||
// TODO: Implement getOverviewTitle() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Title displayed above for for creating new content page
|
||||
* @return string
|
||||
*/
|
||||
public static function getCreateNewTitle()
|
||||
{
|
||||
// TODO: Implement getCreateNewTitle() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Title for form displayed for editin content page
|
||||
*
|
||||
* @param Content $content
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function getEditTitle(Content $content)
|
||||
{
|
||||
// TODO: Implement getEditTitle() method.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\$ModuleNamespace$\Handlers;
|
||||
|
||||
use App\CMS\Handlers\Handler;
|
||||
use App\Models\User;
|
||||
|
||||
class $Module$Handler extends Handler
|
||||
{
|
||||
/**
|
||||
* Register admin menu
|
||||
*
|
||||
* @param User $user
|
||||
*/
|
||||
public static function registerAdminMenu(User $user)
|
||||
{
|
||||
// register links in admin menu
|
||||
$menu = \Menu::instance('mainMenu');
|
||||
|
||||
$menu->dropdown(trans('$module$::$module$.name'), function ($submenu) use ($user) {
|
||||
$submenu->route('$module$.overview', trans('$module$::$module$.overview'), [], 20, ['icon' => 'fa fa-fw fa-list']);
|
||||
$submenu->route('$module$.new', trans('$module$::$module$.new'), [], 21, ['icon' => 'fa fa-fw fa-plus']);
|
||||
}, 15, ['icon' => 'fa fa-fw']);
|
||||
|
||||
|
||||
|
||||
// TODO: add admin menu entries
|
||||
}
|
||||
|
||||
/**
|
||||
* Does this module support categories?
|
||||
* @return boolean
|
||||
*/
|
||||
public static function supportCategories()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\$ModuleNamespace$\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Admin\Controller;
|
||||
use Modules\$ModuleNamespace$\Http\Requests\Update$Entity$;
|
||||
use Modules\$ModuleNamespace$\Http\Requests\Create$Entity$;
|
||||
use Modules\$ModuleNamespace$\Repositories\$Module$Repository;
|
||||
use $EntityNamespace$\$Entity$ as $Entity$Entity;
|
||||
|
||||
class $Module$ extends Controller
|
||||
{
|
||||
/**
|
||||
* @var $Module$Repository
|
||||
*/
|
||||
private $$module$Repository;
|
||||
|
||||
public function __construct($Module$Repository $$module$Repository)
|
||||
{
|
||||
$this->$module$Repository = $$module$Repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$items = $Entity$Entity::all();
|
||||
|
||||
return view('$module$::admin/index', compact('items'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display form for updating entity
|
||||
*
|
||||
* @param $Entity$Entity $entity
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function edit($Entity$Entity $entity)
|
||||
{
|
||||
return view('$module$::admin/update', compact('entity'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update existing entity
|
||||
*
|
||||
* @param Update$Entity$ $request
|
||||
* @param $Entity$Entity $item
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function update(Update$Entity$ $request, $Entity$Entity $entity)
|
||||
{
|
||||
|
||||
// ...
|
||||
|
||||
$this->$module$Repository->update($entity, $request->all());
|
||||
|
||||
return redirect()
|
||||
->back()
|
||||
->with('success', trans('$module$.$module.successfullyUpdated'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display form for creating new entity
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function create() {
|
||||
$entity = new $Entity$Entity();
|
||||
|
||||
return view('$module$::admin/create', compact('entity'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new instance of entity
|
||||
*/
|
||||
public function store(Create$Entity$ $request) {
|
||||
// ...
|
||||
|
||||
$this->$module$Repository->create($request->all());
|
||||
|
||||
return redirect()
|
||||
->back()
|
||||
->with('success', trans('$module$.$module.successfullyUpdated'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete entity
|
||||
*
|
||||
* @param $Entity$ $entity
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function destroy($Entity$ $entity) {
|
||||
$entity->delete();
|
||||
|
||||
return redirect()
|
||||
->back()
|
||||
->with('success', trans('$module$.$module.successfullyDeleted'));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
namespace Modules\$ModuleNamespace$\Http\Requests;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
class Create$Entity$ extends Request {
|
||||
public function rules()
|
||||
{
|
||||
return parent::rules();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
namespace Modules\$ModuleNamespace$\Http\Requests;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
class Update$Entity$ extends Request {
|
||||
public function rules()
|
||||
{
|
||||
return parent::rules();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
\Route::group([
|
||||
'prefix' => \LaravelLocalization::setLocale() . '/admin/$module$',
|
||||
'middleware' => ['admin'],
|
||||
'namespace' => 'Modules\$Module$\Http\Controllers\Admin'
|
||||
], function () {
|
||||
Route::get('/', '$Module$@index')
|
||||
->name('$module$.overview');
|
||||
|
||||
Route::get('/new', '$Module$@create')
|
||||
->name('$module$.new');
|
||||
|
||||
Route::post('/new', '$Module$@store')
|
||||
->name('$module$.postNew');
|
||||
|
||||
Route::get('/edit/{id}', '$Module$@edit')
|
||||
->name('$module$.edit');
|
||||
|
||||
Route::post('/edit/{id}', '$Module$@update')
|
||||
->name('$module$.postEdit');
|
||||
|
||||
Route::get('/delete/{id}', '$Module$@delete')
|
||||
->name('$module$.delete');
|
||||
});
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\$Module$\Providers;
|
||||
|
||||
use App\CMS\Contracts\Modules\ServiceProvider;
|
||||
|
||||
/**
|
||||
* Class $Module$ServiceProvider
|
||||
*
|
||||
* Service provider for module $Module$
|
||||
*
|
||||
* @package Modules\$Module$\Providers
|
||||
*/
|
||||
class $Module$ServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Set module Alias
|
||||
*/
|
||||
protected function setModuleAlias()
|
||||
{
|
||||
$this->alias = strtolower('$module$');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set path to module
|
||||
*/
|
||||
protected function setModulePath()
|
||||
{
|
||||
$this->path = __DIR__;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace Modules\$ModuleNamespace$\Repositories;
|
||||
|
||||
use $EntityNamespace$\$Entity$ as $Entity$Entity;
|
||||
|
||||
class $Module$Repository {
|
||||
/**
|
||||
* Create new instance of entity
|
||||
*
|
||||
* @param $data
|
||||
*/
|
||||
public function create($data) {
|
||||
$Entity$Entity::create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update entity
|
||||
*
|
||||
* @param $Entity$Entity $entity
|
||||
*/
|
||||
public function update($Entity$Entity $entity, $data) {
|
||||
$entity->update($data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => '$Module$',
|
||||
'new' => 'Vytvořit nový',
|
||||
'description' => '',
|
||||
'successfullyUpdated' => 'Úspěšně upraveno.',
|
||||
'successfullyCreated' => 'Úspěšně vytvořeno.',
|
||||
'successfullyDeleted' => 'Úspěšně smazáno.',
|
||||
'overview' => 'Přehled',
|
||||
'noItems' => 'Žádná data.',
|
||||
'save' => 'Uložit'
|
||||
];
|
||||
@@ -0,0 +1,7 @@
|
||||
@extends('admin.layoutWithNavigation')
|
||||
|
||||
@section('pageHeading', @trans('$module$::$module$.name'))
|
||||
|
||||
@section('content')
|
||||
@include('$module$::admin/form', ['action' => route('$module$.new')])
|
||||
@endsection
|
||||
@@ -0,0 +1,7 @@
|
||||
@extends('admin.layoutWithNavigation')
|
||||
|
||||
@section('pageHeading', @trans('$module$::$module$.name'))
|
||||
|
||||
@section('content')
|
||||
@include('$module$::admin/form', ['action' => route('$module$.update')])
|
||||
@endsection
|
||||
@@ -0,0 +1,6 @@
|
||||
<form action="{{$action}}" method="post">
|
||||
|
||||
{{--...--}}
|
||||
|
||||
<input type="submit" class="btn btn-primary" value="@lang('$module$::$module$.save')">
|
||||
</form>
|
||||
@@ -0,0 +1,17 @@
|
||||
@extends('admin.layoutWithNavigation')
|
||||
|
||||
@section('pageHeading', @trans('$module$::$module$.overview'))
|
||||
|
||||
@section('content')
|
||||
@if (!empty($items))
|
||||
<table>
|
||||
@foreach($items as $item)
|
||||
|
||||
@endforeach
|
||||
</table>
|
||||
@else
|
||||
<div class="alert alert-info">
|
||||
<em>@trans('$module$::$module$.noItems')</em>
|
||||
</div>
|
||||
@endif
|
||||
@endsection
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\CMS\Pipeline\SavePipeline\Process;
|
||||
|
||||
use App\CMS\Contracts\Content\SavePipeline\Process;
|
||||
@@ -19,6 +20,10 @@ class UploadRelatedFiles implements Process
|
||||
*/
|
||||
function handle(Content & $page, array & $input)
|
||||
{
|
||||
if (!isset($input['files'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$files = $input['files'];
|
||||
$assignedFiles = isset($input['keepAssigned']) ? $input['keepAssigned'] : [];
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\CMS\Repositories\FileManager;
|
||||
|
||||
use App\CMS\Helpers\RootDirectory;
|
||||
@@ -25,7 +26,33 @@ class Directory
|
||||
return $exists->exists();
|
||||
}
|
||||
|
||||
public function update(DirectoryModel $directory, $data) {
|
||||
/**
|
||||
* Create new directory
|
||||
*
|
||||
* @param $data
|
||||
*
|
||||
* @return DirectoryModel
|
||||
*/
|
||||
public function create($data)
|
||||
{
|
||||
$directory = new DirectoryModel();
|
||||
$directory->name = $data['name'];
|
||||
$directory->parent_id = $data['parentDirectory'];
|
||||
$directory->user_id = \Auth::user()->id;
|
||||
$directory->description = $data['description'];
|
||||
$directory->save();
|
||||
|
||||
return $directory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update given directory
|
||||
*
|
||||
* @param DirectoryModel $directory
|
||||
* @param $data
|
||||
*/
|
||||
public function update(DirectoryModel $directory, $data)
|
||||
{
|
||||
$directory->name = $data['name'];
|
||||
$directory->description = $data['description'];
|
||||
$directory->save();
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
namespace App\CMS\Repositories\FileManager;
|
||||
|
||||
use App\Models\FileManager\File as FileModel;
|
||||
|
||||
class File {
|
||||
/**
|
||||
* Update given instance of File
|
||||
*
|
||||
* @param FileModel $file
|
||||
* @param $data
|
||||
*/
|
||||
public function update(FileModel $file, $data) {
|
||||
$file->update($data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
namespace App\CMS\Repositories\Users;
|
||||
|
||||
use App\CMS\Repositories\Repository;
|
||||
use App\Models\User as UserModel;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class User extends Repository {
|
||||
/**
|
||||
* Update given user
|
||||
*
|
||||
* @param UserModel $user
|
||||
* @param $data
|
||||
*/
|
||||
public function update(UserModel $user, $data) {
|
||||
// update username if set
|
||||
if (isset($data['username'])) {
|
||||
$user->username = $data['username'];
|
||||
}
|
||||
|
||||
// change name (if set)
|
||||
if (isset($data['name'])) {
|
||||
$user->name = $data['name'];
|
||||
}
|
||||
|
||||
if (isset($data['role'])) {
|
||||
$user->role = $data['role'];
|
||||
}
|
||||
|
||||
if (isset($data['status'])) {
|
||||
$user->status = $data['status'];
|
||||
}
|
||||
|
||||
if (isset($data['password'])) {
|
||||
$user->password = Hash::make($data['password']);
|
||||
}
|
||||
|
||||
$user->email = $data['email'];
|
||||
|
||||
$user->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new user
|
||||
*
|
||||
* @param $data
|
||||
*
|
||||
* @return UserModel
|
||||
*/
|
||||
public function create($data)
|
||||
{
|
||||
// create new user
|
||||
$user = new UserModel();
|
||||
$user->name = $data['name'];
|
||||
$user->email = $data['email'];
|
||||
$user->username = $data['username'];
|
||||
$user->role = $data['role'];
|
||||
$user->password = Hash::make($data['password']);
|
||||
|
||||
// store user into database
|
||||
$user->save();
|
||||
|
||||
return $user;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Modules;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class CreateNew extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'module:new
|
||||
{name : module name}
|
||||
{parentModule? : name of parent module}
|
||||
{--entity= : entity}';
|
||||
/**
|
||||
* The console command description.
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Create new CMS module.';
|
||||
protected $moduleName;
|
||||
protected $moduleNamespace;
|
||||
protected $entity;
|
||||
protected $entityNamespace;
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$defaultEntityNamespace = $this->loadArguments();
|
||||
$path = preg_replace('|/{2,}|i', '/', config('modules.paths.modules') . '/' . $this->moduleNamespace);
|
||||
|
||||
if (is_dir($path)) {
|
||||
$this->error('Module already exists in ' . $path);
|
||||
return;
|
||||
}
|
||||
|
||||
// copy stub files
|
||||
\File::copyDirectory(config('modules.paths.stubs'), $path);
|
||||
|
||||
$files = \File::allFiles($path);
|
||||
foreach ($files as $file) {
|
||||
$newName = str_replace('stub', 'php', $this->replacePlaceholders($file->getPathname()));
|
||||
|
||||
// ignore new entity when using existing entity
|
||||
if ($this->entityNamespace != $defaultEntityNamespace && Str::contains('Entities', $file)) {
|
||||
\File::delete($file);
|
||||
continue;
|
||||
}
|
||||
|
||||
// rename file
|
||||
\File::move($file, $newName);
|
||||
|
||||
// change its content
|
||||
$content = file_get_contents($newName);
|
||||
$content = $this->replacePlaceholders($content);
|
||||
file_put_contents($newName, $content);
|
||||
}
|
||||
|
||||
$this->info('Module successfully created.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Find and replace all placeholders in given content
|
||||
*
|
||||
* @param $content
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
private function replacePlaceholders($content)
|
||||
{
|
||||
$replace = [
|
||||
'$Module$' => $this->moduleName,
|
||||
'$ModuleNamespace$' => str_replace('/', '\\', $this->moduleNamespace),
|
||||
'$module$' => strtolower($this->moduleName),
|
||||
'$EntityNamespace$' => $this->entityNamespace,
|
||||
'$Entity$' => $this->entity
|
||||
];
|
||||
|
||||
foreach ($replace as $what => $for) {
|
||||
$content = str_replace($what, $for, $content);
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load command arguments
|
||||
* @return string
|
||||
*/
|
||||
private function loadArguments()
|
||||
{
|
||||
$parent = $this->argument('parentModule');
|
||||
$this->moduleName = $moduleName = $this->argument('name');
|
||||
$this->moduleNamespace = trim($parent . '/' . $moduleName, '/');
|
||||
|
||||
$entity = $this->option('entity');
|
||||
|
||||
$defaultEntityNamespace = '\\Modules\\' . str_replace('/', '\\', $this->moduleNamespace) . '\Entities\\';
|
||||
|
||||
if (!empty($entity)) {
|
||||
$parts = explode('\\', $entity);
|
||||
$this->entity = $parts[count($parts) - 1];
|
||||
unset($parts[count($parts) - 1]);
|
||||
$this->entityNamespace = implode('\\', $parts);
|
||||
} else {
|
||||
$this->entityNamespace = $defaultEntityNamespace;
|
||||
$this->entity = $this->moduleName;
|
||||
}
|
||||
|
||||
return $defaultEntityNamespace;
|
||||
}
|
||||
}
|
||||
+3
-13
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
namespace App\Console\Commands\Modules;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\File;
|
||||
@@ -12,7 +12,7 @@ class InstallAllModules extends Command
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'install-all-modules';
|
||||
protected $signature = 'module:install-all';
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
@@ -20,16 +20,6 @@ class InstallAllModules extends Command
|
||||
*/
|
||||
protected $description = 'Crawl /modules directory and install all modules';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
@@ -45,7 +35,7 @@ class InstallAllModules extends Command
|
||||
|
||||
// try to install each module
|
||||
try {
|
||||
$this->call('install-module', ['name' => $moduleName]);
|
||||
$this->call('module:install', ['name' => $moduleName]);
|
||||
} catch (\Exception $e) {
|
||||
$this->line('Module ' . $moduleName . ' already installed.');
|
||||
}
|
||||
+5
-5
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
namespace App\Console\Commands\Modules;
|
||||
|
||||
use App\Models\Module;
|
||||
use App\ModuleManager\Installer;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Contracts\Filesystem\FileNotFoundException;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
@@ -17,7 +18,7 @@ class InstallModule extends Command
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'install-module {name} {parentModuleId?}';
|
||||
protected $signature = 'module:install {name} {parentModuleId?}';
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
@@ -156,12 +157,11 @@ class InstallModule extends Command
|
||||
$settings = [
|
||||
'staticName' => $this->moduleName,
|
||||
'providers' => $providers,
|
||||
'aliases' => isset($config['aliases']) ? $config['aliases'] : [],
|
||||
'order' => isset($config['order']) ? $config['order'] : 0,
|
||||
'files' => isset($config['files']) ? $config['files'] : []
|
||||
];
|
||||
|
||||
$module = Module::install($name, $alias, $description, $handler, $this->parentModuleId, $settings);
|
||||
$module = Installer::install($name, $alias, $description, $handler, $this->parentModuleId, $settings);
|
||||
}
|
||||
|
||||
// try to install submodules
|
||||
@@ -184,7 +184,7 @@ class InstallModule extends Command
|
||||
$submodule = str_replace($this->modulesPath . DIRECTORY_SEPARATOR, '', $submodulePath);
|
||||
|
||||
try {
|
||||
$this->call('install-module', ['name' => $submodule, 'parentModuleId' => $parentModule->id]);
|
||||
$this->call('module:install', ['name' => $submodule, 'parentModuleId' => $parentModule->id]);
|
||||
} catch (\Exception $e) {
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
@@ -3,6 +3,8 @@
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Module;
|
||||
use App\ModuleManager\Installer;
|
||||
use App\ModuleManager\Uninstaller;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
@@ -43,14 +45,13 @@ class SetTemplate extends Command
|
||||
$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 . '.');
|
||||
$this->line('Template is already installed. Currently using template ' . trans($current->name) . ' located in /templates/' . $current->module_settings['staticName'] . '.');
|
||||
$confirm = $this->confirm('Uninstall it and install *' . trans($config['name']) . '*? All data associated with installed template will be lost!');
|
||||
|
||||
if ($confirm) {
|
||||
$this->line('Uninstalling ' . $current->name . '.');
|
||||
$current->uninstall();
|
||||
|
||||
Uninstaller::uninstall($current);
|
||||
} else {
|
||||
$this->line('Aborting installation.');
|
||||
return;
|
||||
@@ -58,7 +59,7 @@ class SetTemplate extends Command
|
||||
}
|
||||
|
||||
try {
|
||||
Module::install($config['name'], $config['alias'], $config['description'], $config['handler'], false, $config);
|
||||
Installer::install($config['name'], $config['alias'], $config['description'], $config['handler'], false, $config);
|
||||
} catch (\Exception $e) {
|
||||
$this->error('Cannot install template ' . $template . '. Message: ' . $e->getMessage());
|
||||
return;
|
||||
@@ -72,6 +73,8 @@ class SetTemplate extends Command
|
||||
|
||||
// run again artisan for publishing resources
|
||||
// it cannot be done using $this->call, because we need to load different template into service providers
|
||||
if ($publish) {
|
||||
exec('php artisan vendor:publish');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use App\Console\Commands\Modules\CreateNew;
|
||||
use App\Console\Commands\PublishTemplateResources;
|
||||
use App\Console\Commands\TemplateInfo;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
@@ -17,8 +18,9 @@ class Kernel extends ConsoleKernel
|
||||
protected $commands = [
|
||||
Commands\NewUser::class,
|
||||
Commands\ChangePassword::class,
|
||||
Commands\InstallModule::class,
|
||||
Commands\InstallAllModules::class,
|
||||
CreateNew::class,
|
||||
Commands\Modules\InstallModule::class,
|
||||
Commands\Modules\InstallAllModules::class,
|
||||
Commands\TranslateDirectory::class,
|
||||
Commands\TranslateAll::class,
|
||||
Commands\InitDatabaseSchema::class,
|
||||
@@ -37,7 +39,5 @@ class Kernel extends ConsoleKernel
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
// $schedule->command('inspire')
|
||||
// ->hourly();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ use App\CMS\Interactions\Admin\Content\ChangeStatus;
|
||||
use App\CMS\Interactions\Admin\Content\DeletePage;
|
||||
use App\CMS\Interactions\Admin\Content\SetHomepage;
|
||||
use App\Http\Controllers\Admin\Controller;
|
||||
use App\Models\Content\Content;
|
||||
use App\Models\Content\ContentHistory;
|
||||
|
||||
class ContentActions extends Controller
|
||||
{
|
||||
@@ -25,15 +27,13 @@ class ContentActions extends Controller
|
||||
* This method is called in static page overview from quick actions. It checks if status is valid, if page exists
|
||||
* and updates status.
|
||||
*
|
||||
* @param $id
|
||||
* @param Content $page
|
||||
* @param $status
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function changeStatus($id, $status)
|
||||
public function changeStatus(Content $page, $status)
|
||||
{
|
||||
$page = $this->content->getOne($id);
|
||||
|
||||
Interaction::handle(ChangeStatus::class, ['status' => $status], $page);
|
||||
|
||||
// redirect back to overview with info for user
|
||||
@@ -45,14 +45,12 @@ class ContentActions extends Controller
|
||||
/**
|
||||
* Delete page
|
||||
*
|
||||
* @param $id
|
||||
* @param Content $page
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function delete($id)
|
||||
public function delete(Content $page)
|
||||
{
|
||||
$page = $this->content->getOne($id);
|
||||
|
||||
Interaction::handle(DeletePage::class, [], $page);
|
||||
|
||||
// redirect back to overview with info for user
|
||||
@@ -66,14 +64,12 @@ class ContentActions extends Controller
|
||||
/**
|
||||
* Sets page as homepage
|
||||
*
|
||||
* @param $id
|
||||
* @param Content $page
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function setHomepage($id)
|
||||
public function setHomepage(Content $page)
|
||||
{
|
||||
$page = $this->content->getOne($id);
|
||||
|
||||
Interaction::handle(SetHomepage::class, [], $page);
|
||||
|
||||
// redirect back to overview with info for user
|
||||
|
||||
@@ -5,6 +5,7 @@ use App\CMS\Contracts\Repositories\Content as IContent;
|
||||
use App\CMS\Contracts\Repositories\Module as IModule;
|
||||
use App\CMS\Enumerations\ContentStatuses;
|
||||
use App\Http\Controllers\Admin\Controller;
|
||||
use App\Models\Module;
|
||||
|
||||
class ContentOverview extends Controller
|
||||
{
|
||||
@@ -26,19 +27,19 @@ class ContentOverview extends Controller
|
||||
/**
|
||||
* Overview for all content pages.
|
||||
*
|
||||
* @param null|int $moduleId
|
||||
* @param Module|null $module
|
||||
* @param null $status
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
* @internal param int|null $moduleId
|
||||
*/
|
||||
public function index($moduleId = null, $status = null)
|
||||
public function index(Module $module = null, $status = null)
|
||||
{
|
||||
// get module settings
|
||||
$module = $this->module->getOne($moduleId);
|
||||
$pageHeading = $this->module->getOverviewTitle($module);
|
||||
|
||||
// get pages for overview
|
||||
$handler = $module !== null ? $module->handler : null;
|
||||
$handler = $module->exists ? $module->handler : null;
|
||||
$pages = $this->content->getOverview($handler, [$status])
|
||||
->paginate(setting('paginatedResults', 20));
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ use App\Cms\Interactions\Admin\Content\NewContent;
|
||||
use App\Http\Controllers\Admin\Controller;
|
||||
use App\Http\Requests\CreateNewContentRequest;
|
||||
use App\Http\Requests\Request;
|
||||
use App\Models\Module;
|
||||
use Modules\Categories\Contracts\Repositories\Category as ICategory;
|
||||
|
||||
/**
|
||||
@@ -67,9 +68,8 @@ class CreateNewContent extends Controller
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function create($module)
|
||||
public function create(Module $module)
|
||||
{
|
||||
$module = $this->module->getOne($module);
|
||||
$statuses = ContentStatuses::getWithTranslations();
|
||||
$pageHeading = $this->module->getCreateContentTitle($module);
|
||||
$templates = $this->template->getForModule($module);
|
||||
@@ -95,15 +95,14 @@ class CreateNewContent extends Controller
|
||||
/**
|
||||
* Save new content page
|
||||
*
|
||||
* @param CreateNewContentRequest $request
|
||||
* @param $moduleId
|
||||
* @param CreateNewContentRequest|Request $request
|
||||
* @param Module $module
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @internal param $moduleId
|
||||
*/
|
||||
public function store(Request $request, $moduleId)
|
||||
public function store(Request $request, Module $module)
|
||||
{
|
||||
$module = $this->module->getOne($moduleId);
|
||||
|
||||
// create new page
|
||||
Interaction::handle(NewContent::class, $request->all(), $module->handler);
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ use App\Models\Content\ContentHistory;
|
||||
use App\Models\FileManager\File;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Modules\Categories\Contracts\Repositories\Category as ICategory;
|
||||
use Modules\Categories\Repositories\Category;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
class EditContent extends Controller
|
||||
@@ -58,7 +59,7 @@ class EditContent extends Controller
|
||||
* @param ICategory $category
|
||||
* @param ITemplate $template
|
||||
*/
|
||||
public function __construct(ContentHistory $history, File $file, IContent $content, IModuleRepository $module, ICategory $category, ITemplate $template)
|
||||
public function __construct(ContentHistory $history, File $file, IContent $content, IModuleRepository $module, Category $category, ITemplate $template)
|
||||
{
|
||||
$this->history = $history;
|
||||
$this->file = $file;
|
||||
@@ -71,14 +72,13 @@ class EditContent extends Controller
|
||||
/**
|
||||
* Display form for editing static page
|
||||
*
|
||||
* @param $id
|
||||
* @param Content $page
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function edit($id)
|
||||
public function edit(Content $page)
|
||||
{
|
||||
$statuses = ContentStatuses::getWithTranslations();
|
||||
$page = $this->content->getOne($id);
|
||||
|
||||
// get module ID
|
||||
$module = $this->module->getByHandler($page->moduleHandler);
|
||||
@@ -105,29 +105,14 @@ class EditContent extends Controller
|
||||
/**
|
||||
* Edit static page and save changes into history.
|
||||
*
|
||||
* @param EditContentRequest $request
|
||||
* @param $id
|
||||
* @param EditContentRequest|Request $request
|
||||
* @param Content $page
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @internal param $id
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
public function update(Request $request, Content $page)
|
||||
{
|
||||
try {
|
||||
/**
|
||||
* @var $page Content
|
||||
*/
|
||||
$page = $this->content->getOne($id);
|
||||
} catch (NotFoundHttpException $e) {
|
||||
|
||||
// log attempt of invalid edit
|
||||
Event::fire(new AttemptToEditInvalidContent($id));
|
||||
|
||||
// page for editing not found
|
||||
return redirect()
|
||||
->route('content.overview')
|
||||
->with('error', trans('admin/contents.invalidPage'));
|
||||
}
|
||||
|
||||
// edit page
|
||||
Interaction::handle(EditContentInteraction::class, $request->all(), $page);
|
||||
|
||||
|
||||
@@ -19,30 +19,31 @@ class History extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @param Content $page
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function getOverview($id)
|
||||
public function getOverview(Content $page)
|
||||
{
|
||||
// test if given content id is static page and if exists
|
||||
$content = Content::findOrFail($id);
|
||||
|
||||
$history = $this->history->getStructuredHistoryOf($content);
|
||||
$history = $this->history->getStructuredHistoryOf($page);
|
||||
|
||||
return view('admin/history.overview', [
|
||||
'history' => $history,
|
||||
'page' => $content
|
||||
'page' => $page
|
||||
]);
|
||||
}
|
||||
|
||||
public function getDiff($revision, $id)
|
||||
/**
|
||||
* @param ContentHistory $revision
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function getDiff(ContentHistory $revision)
|
||||
{
|
||||
$change = $this->history->findOrFail($id);
|
||||
$diff = $this->history->getDiff($change);
|
||||
$diff = $this->history->getDiff($revision);
|
||||
|
||||
return view('admin/history.diff', [
|
||||
'change' => $change,
|
||||
'change' => $revision,
|
||||
'diff' => $diff
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ use App\CMS\Interactions\Admin\FileManager\CreateDirectory;
|
||||
use App\CMS\Repositories\FileManager\Directory as DirectoryRepository;
|
||||
use App\Http\Controllers\Admin\Controller;
|
||||
use App\Http\Requests;
|
||||
use App\Models\FileManager\Directory;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateNewDirectory extends Controller
|
||||
@@ -30,9 +31,10 @@ class CreateNewDirectory extends Controller
|
||||
/**
|
||||
* Create new directory
|
||||
*
|
||||
* @param Requests\CreateNewDirectoryRequest $request
|
||||
* @param Requests\CreateNewDirectoryRequest|Request $request
|
||||
*
|
||||
* @return $this|\Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
|
||||
* @internal param Directory $parentDirectory
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
|
||||
@@ -5,19 +5,20 @@ namespace App\Http\Controllers\Admin\FileManager;
|
||||
use App\CMS\Repositories\FileManager\Directory as DirectoryRepository;
|
||||
use App\Http\Controllers\Admin\Controller;
|
||||
use App\Http\Requests;
|
||||
use App\Http\Requests\EditDirectoryRequest;
|
||||
use App\Models\FileManager\Directory;
|
||||
|
||||
class EditDirectory extends Controller
|
||||
{
|
||||
/**
|
||||
* @param Requests\EditDirectoryRequest $request
|
||||
* @param EditDirectoryRequest $request
|
||||
* @param Directory $directory
|
||||
*
|
||||
* @return $this|\Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
|
||||
* @internal param $directoryId
|
||||
*
|
||||
*/
|
||||
public function update(Requests\EditDirectoryRequest $request, Directory $directory)
|
||||
public function update(EditDirectoryRequest $request, Directory $directory)
|
||||
{
|
||||
$repository = app(DirectoryRepository::class);
|
||||
if ($repository->checkIfNameExists($request->name, $directory->parent_id, $directory->id)) {
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Admin\FileManager;
|
||||
|
||||
use App\CMS\Helpers\FileManager;
|
||||
use App\CMS\Helpers\RootDirectory;
|
||||
use App\CMS\Repositories\FileManager\File as FileRepository;
|
||||
use App\Events\EditFile;
|
||||
use App\Http\Controllers\Admin\Controller;
|
||||
use App\Http\Requests\EditUploadedFileRequest;
|
||||
@@ -14,14 +15,12 @@ class EditUploadedFile extends Controller
|
||||
{
|
||||
/**
|
||||
* Edit form
|
||||
*
|
||||
* Render edit form for displaying details and updating given file
|
||||
*
|
||||
* @param File $file
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\View\View
|
||||
* @internal param int $id file id
|
||||
*
|
||||
*/
|
||||
public function show(File $file)
|
||||
{
|
||||
@@ -35,7 +34,6 @@ class EditUploadedFile extends Controller
|
||||
|
||||
/**
|
||||
* Updates file
|
||||
*
|
||||
* User can change only keywords, original filename and description. Mime type, hash and other fields remain
|
||||
* unchanged
|
||||
*
|
||||
@@ -44,16 +42,11 @@ class EditUploadedFile extends Controller
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @internal param $id
|
||||
*
|
||||
*/
|
||||
public function update(EditUploadedFileRequest $request, File $file)
|
||||
{
|
||||
// set values from form
|
||||
$file->name = $request->name;
|
||||
$file->keywords = $request->keywords;
|
||||
$file->description = $request->description;
|
||||
$file->directory_id = $request->directory_id;
|
||||
$file->save();
|
||||
$repository = app(FileRepository::class);
|
||||
$repository->update($file, $request->all());
|
||||
|
||||
// fire action
|
||||
Event::fire(new EditFile($file));
|
||||
|
||||
@@ -32,12 +32,12 @@ class UploadedFilesOverview extends Controller
|
||||
*/
|
||||
public function index(Directory $directory = null)
|
||||
{
|
||||
// include hidden directories?
|
||||
$includeHidden = Input::get('hidden');
|
||||
// dd($directory);
|
||||
|
||||
// include hidden directories?
|
||||
$subdirectories = $this->directoryRepository->getAllSubdirectories($directory);
|
||||
|
||||
if (!$includeHidden) {
|
||||
if (!Input::get('hidden', true)) {
|
||||
$subdirectories = $subdirectories->where('hidden', false);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers\Admin\Templates;
|
||||
|
||||
use App\Cms\Repositories\Templates\Template as TemplateRepository;
|
||||
use App\Http\Controllers\Admin\Controller;
|
||||
use App\Http\Requests\CopyTemplateRequest;
|
||||
use App\Models\Templates\Template;
|
||||
@@ -10,7 +11,6 @@ class CopyTemplate extends Controller
|
||||
{
|
||||
/**
|
||||
* Method for copying given template.
|
||||
*
|
||||
* This method is supposed to be called by POST method.
|
||||
*
|
||||
* @param CopyTemplateRequest $request
|
||||
@@ -32,15 +32,22 @@ class CopyTemplate extends Controller
|
||||
$namespace .= '::';
|
||||
}
|
||||
|
||||
$repository = app(TemplateRepository::class);
|
||||
$repository->setModel($template);
|
||||
|
||||
// get template absolute paths
|
||||
$realTemplatePath = $template->getPathToTemplate();
|
||||
$customTemplatePath = $template->getPathToTemplate(Template::CUSTOM_EDIT_DIRECTORY);
|
||||
$realTemplatePath = $repository->getPathToTemplate();
|
||||
$customTemplatePath = $repository->getPathToTemplate(TemplateRepository::CUSTOM_EDIT_DIRECTORY);
|
||||
$path = dirname($customTemplatePath);
|
||||
|
||||
// create file copy
|
||||
$data = file_get_contents($realTemplatePath);
|
||||
$written = file_put_contents($path . DIRECTORY_SEPARATOR . $newName . Template::TEMPLATE_SUFFIX, $data);
|
||||
|
||||
if (!is_dir($path)) {
|
||||
mkdir($path, 0777, true);
|
||||
}
|
||||
|
||||
$written = file_put_contents($path . DIRECTORY_SEPARATOR . $newName . TemplateRepository::TEMPLATE_SUFFIX, $data);
|
||||
// were data written?
|
||||
if ($written === false) {
|
||||
return $this->copyFailed($request, $template);
|
||||
@@ -67,7 +74,6 @@ class CopyTemplate extends Controller
|
||||
* @param Template $template
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
|
||||
*
|
||||
*/
|
||||
private function copyFailed(CopyTemplateRequest $request, Template $template)
|
||||
{
|
||||
|
||||
@@ -34,13 +34,8 @@ class EditTemplate extends Controller
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function getEdit($template)
|
||||
public function getEdit(Template $template)
|
||||
{
|
||||
/**
|
||||
* @var $template Template
|
||||
*/
|
||||
$template = Template::findOrFail($template);
|
||||
|
||||
$this->templateRepository->setModel($template);
|
||||
|
||||
// load template content
|
||||
@@ -59,15 +54,13 @@ class EditTemplate extends Controller
|
||||
* Save meta information about template and edited content
|
||||
*
|
||||
* @param EditTemplateRequest $request
|
||||
* @param $templateId
|
||||
* @param Template $template
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @internal param $templateId
|
||||
*/
|
||||
public function postEdit(EditTemplateRequest $request, $templateId)
|
||||
public function postEdit(EditTemplateRequest $request, Template $template)
|
||||
{
|
||||
// find template
|
||||
$template = Template::findOrFail($templateId);
|
||||
|
||||
// setup meta information
|
||||
$template->name = $request->name;
|
||||
|
||||
|
||||
@@ -7,16 +7,21 @@ use App\Models\Templates\TemplatePath;
|
||||
|
||||
class TemplateOverview extends Controller
|
||||
{
|
||||
public function getPath($path)
|
||||
/**
|
||||
* Display overview of all templates in given path
|
||||
*
|
||||
* @param TemplatePath $templatePath
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function getPath(TemplatePath $templatePath)
|
||||
{
|
||||
$path = TemplatePath::findOrFail($path);
|
||||
|
||||
return view('admin.templates.list', [
|
||||
'directory' => $path,
|
||||
'isWritable' => is_writable(base_path($path->path)),
|
||||
'templates' => $path->templates()
|
||||
'directory' => $templatePath,
|
||||
'isWritable' => is_writable(base_path($templatePath->path)),
|
||||
'templates' => $templatePath->templates()
|
||||
->get(),
|
||||
'subdirectories' => $path->subdirectories()
|
||||
'subdirectories' => $templatePath->subdirectories()
|
||||
->get()
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers\Admin\Users;
|
||||
|
||||
use App\CMS\Enumerations\UserRoles;
|
||||
use App\CMS\Repositories\Users\User as UserRepository;
|
||||
use App\Events\CreateNewUser as CreateNewUserEvent;
|
||||
use App\Http\Controllers\Admin\Controller;
|
||||
use App\Http\Requests\CreateNewUserRequest;
|
||||
@@ -28,28 +29,21 @@ class CreateNewUser extends Controller
|
||||
|
||||
/**
|
||||
* Create new user
|
||||
*
|
||||
* This method saves new user into database
|
||||
*
|
||||
* @param CreateNewUserRequest $request
|
||||
* @param UserRepository $userRepository
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
protected function postRegistration(CreateNewUserRequest $request)
|
||||
protected function postRegistration(CreateNewUserRequest $request, UserRepository $userRepository)
|
||||
{
|
||||
// when user did not provide any username, use his email
|
||||
$username = isset($request->username) && !empty($request->username) ? $request->username : $request->email;
|
||||
|
||||
// create new user
|
||||
$user = new User();
|
||||
$user->name = $request->name;
|
||||
$user->email = $request->email;
|
||||
$user->username = $username;
|
||||
$user->role = $request->role;
|
||||
$user->password = Hash::make($request->password);
|
||||
|
||||
// store user into database
|
||||
$user->save();
|
||||
$data = $request->all();
|
||||
$data['username'] = $username;
|
||||
$user = $userRepository->create($data);
|
||||
|
||||
// fire event
|
||||
Event::fire(new CreateNewUserEvent($user));
|
||||
|
||||
@@ -4,25 +4,44 @@ namespace App\Http\Controllers\Admin\Users;
|
||||
|
||||
use App\CMS\Enumerations\UserRoles;
|
||||
use App\CMS\Enumerations\UserStates;
|
||||
use App\CMS\Repositories\Users\User as UserRepository;
|
||||
use App\Events\EditUser as EditUserEvent;
|
||||
use App\Http\Controllers\Admin\Controller;
|
||||
use App\Http\Requests\EditUserRequest;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class EditUser extends Controller
|
||||
{
|
||||
public function getEditUser($id = null)
|
||||
/**
|
||||
* @var UserRepository
|
||||
*/
|
||||
private $userRepository;
|
||||
|
||||
/**
|
||||
* EditUser constructor.
|
||||
*
|
||||
* @param UserRepository $userRepository
|
||||
*/
|
||||
public function __construct(UserRepository $userRepository)
|
||||
{
|
||||
// when no user specified, lets assume we want to edit "me"
|
||||
if (!$id) {
|
||||
$id = Auth::user()->id;
|
||||
$this->userRepository = $userRepository;
|
||||
}
|
||||
|
||||
// try to find given user
|
||||
$user = User::findOrFail($id);
|
||||
/**
|
||||
* Display form for editing user
|
||||
*
|
||||
* @param User|null $user
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function getEditUser(User $user = null)
|
||||
{
|
||||
// when no user specified, lets assume we want to edit "me"
|
||||
if (!$user->exists()) {
|
||||
$user = Auth::user();
|
||||
}
|
||||
|
||||
$states = UserStates::getWithTranslations();
|
||||
$roles = UserRoles::getWithTranslations();
|
||||
@@ -35,49 +54,26 @@ class EditUser extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit user - store information
|
||||
*
|
||||
* @param EditUserRequest $request
|
||||
* @param $id
|
||||
* @param User $user
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @internal param $id
|
||||
*/
|
||||
public function postEdit(EditUserRequest $request, $id)
|
||||
public function postEdit(EditUserRequest $request, User $user)
|
||||
{
|
||||
$loggedUser = Auth::user();
|
||||
|
||||
$user = User::findOrFail($id);
|
||||
|
||||
// non-admin user is trying to edit someone else
|
||||
if ($loggedUser->role != User::ROLE_ADMIN && $id != $loggedUser->id) {
|
||||
if ($loggedUser->role != User::ROLE_ADMIN && $user->id != $loggedUser->id) {
|
||||
return redirect()
|
||||
->back()
|
||||
->with('error', trans('auth.accessDenied'));
|
||||
}
|
||||
|
||||
// update username if set
|
||||
if (isset($request->username)) {
|
||||
$user->username = $request->username;
|
||||
}
|
||||
|
||||
// change name (if set)
|
||||
if (isset($request->name)) {
|
||||
$user->name = $request->name;
|
||||
}
|
||||
|
||||
if (isset($request->role)) {
|
||||
$user->role = $request->role;
|
||||
}
|
||||
|
||||
if (isset($request->status)) {
|
||||
$user->status = $request->status;
|
||||
}
|
||||
|
||||
if (isset($request->password)) {
|
||||
$user->password = Hash::make($request->password);
|
||||
}
|
||||
|
||||
$user->email = $request->email;
|
||||
|
||||
$user->save();
|
||||
$this->userRepository->update($user, $request->all());
|
||||
|
||||
// fire event about editing user
|
||||
Event::fire(new EditUserEvent($user));
|
||||
|
||||
@@ -22,18 +22,14 @@ class UserDetail extends Controller
|
||||
$this->log = $log;
|
||||
}
|
||||
|
||||
public function getDetail($id = null)
|
||||
public function getDetail(User $user = null)
|
||||
{
|
||||
// when no user specified, lets assume we want to edit "me"
|
||||
if (!$id) {
|
||||
$id = Auth::user()->id;
|
||||
if (!$user->exists()) {
|
||||
$id = Auth::user();
|
||||
}
|
||||
|
||||
// try to find given user
|
||||
$user = User::findOrFail($id);
|
||||
|
||||
$actions = $this->log->getUserActions($id, 10);
|
||||
|
||||
$actions = $this->log->getUserActions($user->id, 10);
|
||||
$roles = UserRoles::getWithTranslations();
|
||||
$states = UserStates::getWithTranslations();
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers\Admin\Widgets\Areas;
|
||||
|
||||
use App\CMS\Repositories\Widgets\WidgetArea as WidgetAreaRepository;
|
||||
use App\Events\DeleteWidgetArea;
|
||||
use App\Http\Controllers\Admin\Controller;
|
||||
use App\Http\Requests\EditWidgetAreaRequest;
|
||||
use App\Models\Widgets\Widget;
|
||||
@@ -39,6 +40,7 @@ class EditWidgetArea extends Controller
|
||||
*/
|
||||
public function edit(WidgetArea $widgetArea)
|
||||
{
|
||||
return view("test");
|
||||
$associatedWidgetIds = WidgetInWidgetArea::getWidgetIdsFromArea($widgetArea->id);
|
||||
$widgets = Widget::where('language', LaravelLocalization::getCurrentLocale())
|
||||
->paginate(25);
|
||||
@@ -83,26 +85,14 @@ class EditWidgetArea extends Controller
|
||||
}
|
||||
|
||||
// delete area
|
||||
$area->delete();
|
||||
$widgetArea->delete();
|
||||
|
||||
// fire event with new widget area
|
||||
Event::fire(new \App\Events\DeleteWidgetArea($area));
|
||||
Event::fire(new DeleteWidgetArea($widgetArea));
|
||||
|
||||
// redirect and inform user
|
||||
return redirect()
|
||||
->route('widgetareas.overview')
|
||||
->with('success', trans('admin/widgetAreas.successfullyDeleted'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect user to overview with message about invalid widget area
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
private function invalidArea()
|
||||
{
|
||||
return redirect()
|
||||
->route('widgetareas.overview')
|
||||
->with('error', trans('admin/widgetAreas.invalidArea'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ class Controller extends BaseController
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public static function VisitorsView($template, $data = [], $mergeData = [])
|
||||
public static function visitorsView($template, $data = [], $mergeData = [])
|
||||
{
|
||||
$view = Template::name($template);
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ class ContentPage extends Controller
|
||||
$displayPipeline = app('displayPipeline');
|
||||
$page = $displayPipeline->run($page);
|
||||
|
||||
return Controller::VisitorsView($page->template, ['page' => $page]);
|
||||
return Controller::visitorsView($page->template, ['page' => $page]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+2
-6
@@ -18,9 +18,7 @@ class Kernel extends HttpKernel
|
||||
{
|
||||
/**
|
||||
* The application's global HTTP middleware stack.
|
||||
*
|
||||
* These middleware are run during every request to your application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $middleware = [
|
||||
@@ -33,7 +31,6 @@ class Kernel extends HttpKernel
|
||||
];
|
||||
/**
|
||||
* The application's route middleware groups.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $middlewareGroups = [
|
||||
@@ -53,9 +50,7 @@ class Kernel extends HttpKernel
|
||||
];
|
||||
/**
|
||||
* The application's route middleware.
|
||||
*
|
||||
* These middleware may be assigned to groups or used individually.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $routeMiddleware = [
|
||||
@@ -66,6 +61,7 @@ class Kernel extends HttpKernel
|
||||
'throttle' => ThrottleRequests::class,
|
||||
'localize' => LaravelLocalizationRoutes::class,
|
||||
'localizationRedirect' => LaravelLocalizationRedirectFilter::class,
|
||||
'localeSessionRedirect' => LocaleSessionRedirect::class
|
||||
'localeSessionRedirect' => LocaleSessionRedirect::class,
|
||||
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
];
|
||||
}
|
||||
|
||||
+2
-2
@@ -11,7 +11,7 @@ Route::pattern('url', '[0-9\-a-z]+');
|
||||
|
||||
/*******************************************************************************/
|
||||
|
||||
Route::group(['prefix' => LaravelLocalization::setLocale()], function () {
|
||||
Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => ['bindings']], function () {
|
||||
/**
|
||||
* This route group serves to handle request in admin
|
||||
*/
|
||||
@@ -65,7 +65,7 @@ Route::group(['prefix' => LaravelLocalization::setLocale()], function () {
|
||||
->name('login');
|
||||
|
||||
// route for sitemap
|
||||
Route::get('sitemap.xml', 'Sitemap@getMap')
|
||||
Route::get('sitemap.xml', 'Visitor\Sitemap@getMap')
|
||||
->name('sitemap');
|
||||
|
||||
// route for all content pages. This rule must be specified last (because it matches every route)
|
||||
|
||||
@@ -9,34 +9,34 @@ Route::group(['namespace' => 'Contents'], function () {
|
||||
->name('content.new');
|
||||
|
||||
// form for editing existing static page
|
||||
Route::get('content/edit/{id}', 'EditContent@edit')
|
||||
Route::get('content/edit/{page}', 'EditContent@edit')
|
||||
->name('content.edit');
|
||||
|
||||
// post method for creating new static page
|
||||
Route::post('content/new/{moduleId}', 'CreateNewContent@store')
|
||||
Route::post('content/new/{module}', 'CreateNewContent@store')
|
||||
->name('content.newPost');
|
||||
|
||||
// post method for creating new static page
|
||||
Route::post('content/edit/{id}', 'EditContent@update')
|
||||
Route::post('content/edit/{page}', 'EditContent@update')
|
||||
->name('content.editPost');
|
||||
|
||||
// change status of page (protected, public or draft)
|
||||
Route::get('content/status/{id}/{status}', 'ContentActions@changeStatus')
|
||||
Route::get('content/status/{page}/{status}', 'ContentActions@changeStatus')
|
||||
->name('content.changeStatus');
|
||||
|
||||
// set homepage
|
||||
Route::get('content/homepage/{id}', 'ContentActions@setHomepage')
|
||||
Route::get('content/homepage/{page}', 'ContentActions@setHomepage')
|
||||
->name('content.setHomepage');
|
||||
|
||||
// delete page
|
||||
Route::get('content/delete/{id}', 'ContentActions@delete')
|
||||
Route::get('content/delete/{page}', 'ContentActions@delete')
|
||||
->name('content.delete');
|
||||
|
||||
// history of changes for specified page
|
||||
Route::get('history/{id}', 'History@getOverview')
|
||||
Route::get('history/{page}', 'History@getOverview')
|
||||
->name('content.history');
|
||||
|
||||
// history of changes for specified page
|
||||
Route::get('history/{revision}/{id}', 'History@getDiff')
|
||||
Route::get('history/{revision}', 'History@getDiff')
|
||||
->name('history.diff');
|
||||
});
|
||||
@@ -5,9 +5,6 @@ Route::group(['namespace' => 'FileManager'], function () {
|
||||
->name('upload.overview');
|
||||
|
||||
// uploader methods
|
||||
Route::get('directories/new/{parentDirectory?}', 'CreateNewDirectory@create')
|
||||
->name('upload.newDirectory');
|
||||
|
||||
Route::get('directories/edit/{directory}', 'EditDirectory@edit')
|
||||
->name('upload.editDirectory');
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<?php
|
||||
// these routes are available only for user with role admin
|
||||
Route::group(['middleware' => 'onlyAdmin', 'namespace' => 'Templates'], function () {
|
||||
Route::get('templates/overview/path/{id}', 'TemplateOverview@getPath')
|
||||
Route::get('templates/overview/path/{templatePath}', 'TemplateOverview@getPath')
|
||||
->name('templates.overview');
|
||||
|
||||
Route::post('templates/copy', 'CopyTemplate@createCopy')
|
||||
->name('templates.postCopy');
|
||||
|
||||
Route::get('templates/edit/{id}', 'EditTemplate@getEdit')
|
||||
Route::get('templates/edit/{template}', 'EditTemplate@getEdit')
|
||||
->name('templates.edit');
|
||||
|
||||
Route::post('templates/edit/{id}', 'EditTemplate@postEdit')
|
||||
Route::post('templates/edit/{template}', 'EditTemplate@postEdit')
|
||||
->name('templates.postEdit');
|
||||
});
|
||||
@@ -10,15 +10,15 @@ Route::group(['namespace' => 'Users'], function () {
|
||||
->name('users.newPost');
|
||||
|
||||
// display form for edit of existing user
|
||||
Route::get('users/edit/{id}', 'EditUser@getEditUser')
|
||||
Route::get('users/edit/{user}', 'EditUser@getEditUser')
|
||||
->name('users.edit');
|
||||
|
||||
// display user detail in admin
|
||||
Route::get('users/detail/{id?}', 'UserDetail@getDetail')
|
||||
Route::get('users/detail/{user?}', 'UserDetail@getDetail')
|
||||
->name('users.detail');
|
||||
|
||||
// method for saving edited data of user
|
||||
Route::post('users/edit/{id}', 'EditUser@postEdit')
|
||||
Route::post('users/edit/{user}', 'EditUser@postEdit')
|
||||
->name('users.editPost');
|
||||
|
||||
// display list of all users registered into our system
|
||||
|
||||
+10
-1
@@ -9,7 +9,6 @@ use Illuminate\Database\Eloquent\Model;
|
||||
*/
|
||||
class Module extends Model
|
||||
{
|
||||
use ModelTraits\Module;
|
||||
public $timestamps = false;
|
||||
protected $fillable = [
|
||||
'handler',
|
||||
@@ -23,4 +22,14 @@ class Module extends Model
|
||||
'manages_content',
|
||||
'is_template'
|
||||
];
|
||||
protected $casts = [
|
||||
'module_settings' => 'array',
|
||||
'is_template' => 'boolean',
|
||||
'has_submodules' => 'boolean'
|
||||
];
|
||||
|
||||
public function getRouteKeyName()
|
||||
{
|
||||
return 'alias';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'namespace' => 'Modules',
|
||||
'paths' => [
|
||||
'modules' => base_path('modules'),
|
||||
'assets' => public_path('modules'),
|
||||
'stubs' => base_path('app/CMS/Modules/Stubs'),
|
||||
]
|
||||
];
|
||||
@@ -1,14 +1,12 @@
|
||||
<?php
|
||||
namespace App\Models\ModelTraits;
|
||||
namespace App\ModuleManager;
|
||||
|
||||
use App\CMS\Contracts\Modules\AppHandler;
|
||||
use App\CMS\Contracts\Modules\TemplateHandler;
|
||||
use App\Models\Module as ModuleModel;
|
||||
use App\Models\Templates\TemplatePath;
|
||||
use App\Models\Module;
|
||||
use Illuminate\Support\Facades\App;
|
||||
|
||||
trait Module
|
||||
{
|
||||
class Installer {
|
||||
/**
|
||||
* Create new module in database
|
||||
*
|
||||
@@ -34,20 +32,20 @@ trait Module
|
||||
$supportCategories = $managesContent ? call_user_func([$handler, 'supportCategories']) : false;
|
||||
|
||||
if ($parentModuleId) {
|
||||
$parentModule = ModuleModel::findOrFail($parentModuleId);
|
||||
$parentModule = Module::findOrFail($parentModuleId);
|
||||
$parentModule->has_submodules = true;
|
||||
$parentModule->save();
|
||||
}
|
||||
|
||||
// insert module into database
|
||||
$module = ModuleModel::create([
|
||||
$module = Module::create([
|
||||
'name' => $name,
|
||||
'description' => $description,
|
||||
'handler' => $handler,
|
||||
'manages_content' => $managesContent,
|
||||
'support_categories' => $supportCategories,
|
||||
'alias' => $alias,
|
||||
'module_settings' => json_encode($settings),
|
||||
'module_settings' => $settings,
|
||||
'parent_id' => $parentModuleId ? $parentModuleId : null,
|
||||
'enabled' => 1,
|
||||
'is_template' => $isTemplate
|
||||
@@ -60,54 +58,4 @@ trait 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(resource_path('views/modules'));
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\ModuleManager\Providers;
|
||||
|
||||
use App\Models\Module;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class ModuleManager extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap the application services.
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
// this service provider needs published config - config is merged right after this service provider
|
||||
$modules = Cache::rememberForever('enabled-modules', function () {
|
||||
return Module::where('enabled', true)
|
||||
->where('is_template', false)
|
||||
->get();
|
||||
});
|
||||
|
||||
// iterate over all modules and enable or disable them
|
||||
foreach ($modules as $module) {
|
||||
if (isset($module->module_settings['providers']) && !empty($module->module_settings['providers'])) {
|
||||
foreach ($module->module_settings['providers'] as $provider) {
|
||||
$this->app->register($provider);
|
||||
}
|
||||
}
|
||||
|
||||
// include files (if any)
|
||||
if (isset($module->module_settings['files']) && !empty($module->module_settings['files'])) {
|
||||
foreach ($module->module_settings['files'] as $file) {
|
||||
include config('modules.paths.modules') . '/' . $module->module_settings['staticName'] . '/' . $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the application services.
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
namespace App\ModuleManager;
|
||||
|
||||
use App\Models\Module;
|
||||
use App\Models\Templates\TemplatePath;
|
||||
use Illuminate\Support\Facades\App;
|
||||
|
||||
class Uninstaller {
|
||||
/**
|
||||
* Delete module from database and uninstall its dependencies
|
||||
*
|
||||
* @param Module $module
|
||||
*
|
||||
* @throws \ErrorException
|
||||
*/
|
||||
public static function uninstall(Module $module)
|
||||
{
|
||||
// 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 ($module->is_template) {
|
||||
self::deleteDirectory(resource_path('views/visitor'));
|
||||
self::deleteDirectory(resource_path('views/modules'));
|
||||
self::deleteDirectory(public_path('assets'));
|
||||
|
||||
// delete all template paths
|
||||
TemplatePath::getQuery()
|
||||
->delete();
|
||||
}
|
||||
|
||||
if ($module->handler && is_callable([$module->handler, 'uninstall'])) {
|
||||
call_user_func([$module->handler, 'uninstall'], $module);
|
||||
}
|
||||
|
||||
$module->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete directory when uninstalling module.
|
||||
*
|
||||
* @param $directory
|
||||
*
|
||||
* @throws \ErrorException
|
||||
*/
|
||||
private static function deleteDirectory($directory)
|
||||
{
|
||||
if (!is_dir($directory)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$success = \File::deleteDirectory($directory, true);
|
||||
|
||||
if (!$success) {
|
||||
throw new \ErrorException('Cannot delete ' . $directory);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,8 +28,6 @@ use App\CMS\Widgets\Menu\Menu;
|
||||
use Barryvdh\Debugbar\ServiceProvider as DebugBarServiceProvider;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Pingpong\Menus\MenusServiceProvider;
|
||||
use Pingpong\Modules\ModulesServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
@@ -64,13 +62,11 @@ class AppServiceProvider extends ServiceProvider
|
||||
}
|
||||
|
||||
// register PingPong module extension
|
||||
$this->app->register(ModulesServiceProvider::class);
|
||||
$this->app->register(MenusServiceProvider::class);
|
||||
$this->app->register(LaravelLocalizationServiceProvider::class);
|
||||
|
||||
// create singletons for registering widgets
|
||||
$this->app->singleton('registerWidget', function ($app) {
|
||||
return new WidgetRegistrator($app);
|
||||
return new WidgetRegistrator();
|
||||
});
|
||||
|
||||
// create singleton for display pipeline - pipeline used for displaying visitor pages
|
||||
@@ -85,7 +81,7 @@ class AppServiceProvider extends ServiceProvider
|
||||
|
||||
// create registrator for template directories
|
||||
$this->app->singleton('registerTemplateDir', function ($app) {
|
||||
return new TemplateRegistrator($app);
|
||||
return new TemplateRegistrator();
|
||||
});
|
||||
|
||||
$this->app->singleton('registerSettingsExtension', function ($app) {
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Models\Module;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class ModuleManager extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap the application services.
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
// this service provider needs published config - config is merged right after this service provider
|
||||
$modules = Cache::rememberForever('enabled-modules', function () {
|
||||
$modules = Module::where('enabled', true)
|
||||
->get();
|
||||
|
||||
foreach ($modules as $module) {
|
||||
$module->module_settings = json_decode($module->module_settings);
|
||||
}
|
||||
|
||||
return $modules;
|
||||
});
|
||||
|
||||
// iterate over all modules and enable or disable them
|
||||
foreach ($modules as $module) {
|
||||
if ($module->is_template) {
|
||||
if (isset($module->module_settings->providers) && !empty($module->module_settings->providers)) {
|
||||
foreach ($module->module_settings->providers as $provider) {
|
||||
$this->app->register($provider);
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->createModulesJson($module);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the application services.
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Read config file and merge it with module config in database.
|
||||
* This method REQUIRES published config of given module (otherwise config(modulename) is not available)!
|
||||
*
|
||||
* @param Module $module
|
||||
*
|
||||
* @throws \ErrorException when module.json is not writable
|
||||
*/
|
||||
private function createModulesJson(Module $module)
|
||||
{
|
||||
$config = $module->module_settings;
|
||||
|
||||
if (is_null($config)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// path to module.json
|
||||
$path = config('modules.paths.modules') . DIRECTORY_SEPARATOR . $config->staticName . DIRECTORY_SEPARATOR . 'module.json';
|
||||
|
||||
// check if module config is writable
|
||||
if (!is_writable(dirname($path))) {
|
||||
Log::warning('Cannot write to ' . $path);
|
||||
return;
|
||||
}
|
||||
|
||||
// set enabled/disabled status for this module
|
||||
$data = new \stdClass();
|
||||
$data->name = $config->staticName;
|
||||
$data->description = $module->description;
|
||||
$data->alias = $module->alias;
|
||||
$data->providers = $config->providers;
|
||||
$data->aliases = $config->aliases;
|
||||
$data->order = $config->order;
|
||||
$data->files = $config->files;
|
||||
$data->active = $module->enabled;
|
||||
|
||||
// create file
|
||||
file_put_contents($path, json_encode($data));
|
||||
}
|
||||
}
|
||||
@@ -2,43 +2,45 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Routing\Router;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* This namespace is applied to the controller routes in your routes file.
|
||||
*
|
||||
* This namespace is applied to your controller routes.
|
||||
* In addition, it is set as the URL generator's root namespace.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $namespace = 'App\Http\Controllers';
|
||||
|
||||
/**
|
||||
* Define your route model bindings, pattern filters, etc.
|
||||
*
|
||||
* @param \Illuminate\Routing\Router $router
|
||||
* @return void
|
||||
*/
|
||||
public function boot(Router $router)
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
|
||||
parent::boot($router);
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
*
|
||||
* @param \Illuminate\Routing\Router $router
|
||||
* @return void
|
||||
*/
|
||||
public function map(Router $router)
|
||||
public function map()
|
||||
{
|
||||
$router->group(['namespace' => $this->namespace], function ($router) {
|
||||
require app_path('Http/routes.php');
|
||||
});
|
||||
$this->mapWebRoutes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "web" routes for the application.
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
* @return void
|
||||
*/
|
||||
protected function mapWebRoutes()
|
||||
{
|
||||
Route::namespace($this->namespace)
|
||||
->middleware('web')
|
||||
->group(app_path('Http/routes.php'));
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Contracts\Filesystem\FileNotFoundException;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Pingpong\Modules\Json;
|
||||
|
||||
class SubmodulesManager extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Boot submodules
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$enabledModules = \Module::enabled();
|
||||
|
||||
foreach ($enabledModules as $module) {
|
||||
$modulePath = $module->getPath();
|
||||
$config = new Json($modulePath . DIRECTORY_SEPARATOR . 'module.json');
|
||||
|
||||
// Does this module specify any providers? If not, consider this module with submodules and register them
|
||||
if ($config->get('providers')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$submodules = \File::directories($modulePath);
|
||||
|
||||
foreach ($submodules as $submodulePath) {
|
||||
try {
|
||||
$config = new Json($submodulePath . DIRECTORY_SEPARATOR . 'module.json');
|
||||
|
||||
if (!$config->get('active')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$serviceProviders = $config->get('providers', []);
|
||||
foreach ($serviceProviders as $serviceProvider) {
|
||||
$this->app->register($serviceProvider);
|
||||
}
|
||||
|
||||
$initFiles = $config->get('files', []);
|
||||
|
||||
foreach ($initFiles as $file) {
|
||||
require $submodulePath . DIRECTORY_SEPARATOR . $file;
|
||||
}
|
||||
} catch (FileNotFoundException $e) {
|
||||
// ignore missing module and do not register this submodule
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -94,7 +94,7 @@ class TemplateServiceProvider extends ServiceProvider
|
||||
return;
|
||||
}
|
||||
|
||||
$templateDir = base_path('templates/' . $template->module_settings->staticName . '/Resources');
|
||||
$templateDir = base_path('templates/' . $template->module_settings['staticName']. '/Resources');
|
||||
$assetsDir = $templateDir . '/' . TemplateContract::ASSETS_DIRECTORY;
|
||||
$viewsDir = $templateDir . '/views';
|
||||
|
||||
|
||||
+2
-2
@@ -4,14 +4,14 @@
|
||||
"devDependencies": {},
|
||||
"dependencies": {
|
||||
"animate.css": "~3.4.0",
|
||||
"bootstrap": "v4.0.0-alpha.3",
|
||||
"bootstrap": "v4.0.0-alpha.5",
|
||||
"font-awesome": "~4.5.0",
|
||||
"jquery": "~2.1.4",
|
||||
"metisMenu": "~2.0.3",
|
||||
"nprogress": "~0.2.0",
|
||||
"responsive-bootstrap-toolkit": "~2.5.0",
|
||||
"Sortable": "~1.4.2",
|
||||
"tether": "~1.1.1",
|
||||
"tether": "~1.3.7",
|
||||
"tinycolor": "~1.2.1",
|
||||
"dropzone": "~4.2.0",
|
||||
"jquery.are-you-sure": "~1.9"
|
||||
|
||||
+4
-6
@@ -8,15 +8,14 @@
|
||||
"type": "project",
|
||||
"require": {
|
||||
"php": ">=5.5.9",
|
||||
"laravel/framework": "5.2.*",
|
||||
"pingpong/modules": "~2.0",
|
||||
"pingpong/menus": "^2.2",
|
||||
"laravel/framework": "5.4.*",
|
||||
"watson/sitemap": "^2.0",
|
||||
"mcamara/laravel-localization": "^1.1",
|
||||
"franzose/closure-table": "^4.1",
|
||||
"franzose/closure-table": "5.*",
|
||||
"intervention/image": "^2.3",
|
||||
"webwizo/laravel-shortcodes": "1.0.4",
|
||||
"greggilbert/recaptcha": "^2.2@dev"
|
||||
"greggilbert/recaptcha": "^2.2@dev",
|
||||
"nwidart/laravel-menus": "dev-master"
|
||||
},
|
||||
"require-dev": {
|
||||
"fzaninotto/faker": "~1.4",
|
||||
@@ -24,7 +23,6 @@
|
||||
"phpunit/phpunit": "~4.0",
|
||||
"symfony/css-selector": "2.8.*|3.0.*",
|
||||
"symfony/dom-crawler": "2.8.*|3.0.*",
|
||||
"ignasbernotas/laravel-model-generator": "^1.0",
|
||||
"barryvdh/laravel-debugbar": "^2.1"
|
||||
},
|
||||
"autoload": {
|
||||
|
||||
Generated
+614
-1512
File diff suppressed because it is too large
Load Diff
+4
-7
@@ -154,11 +154,9 @@ return [
|
||||
Illuminate\Validation\ValidationServiceProvider::class,
|
||||
Illuminate\View\ViewServiceProvider::class,
|
||||
Mcamara\LaravelLocalization\LaravelLocalizationServiceProvider::class,
|
||||
// this class must be before ModulesServiceProvider from PingPong, because it handles files module.json
|
||||
App\Providers\ModuleManager::class,
|
||||
Pingpong\Modules\ModulesServiceProvider::class,
|
||||
Pingpong\Menus\MenusServiceProvider::class,
|
||||
App\Providers\SubmodulesManager::class,
|
||||
\App\ModuleManager\Providers\ModuleManager::class,
|
||||
\Nwidart\Menus\MenusServiceProvider::class,
|
||||
// Pingpong\Menus\MenusServiceProvider::class,
|
||||
Franzose\ClosureTable\ClosureTableServiceProvider::class,
|
||||
\Watson\Sitemap\SitemapServiceProvider::class,
|
||||
Intervention\Image\ImageServiceProvider::class,
|
||||
@@ -205,8 +203,7 @@ return [
|
||||
'Lang' => Illuminate\Support\Facades\Lang::class,
|
||||
'Log' => Illuminate\Support\Facades\Log::class,
|
||||
'Mail' => Illuminate\Support\Facades\Mail::class,
|
||||
'Menu' => Pingpong\Menus\MenuFacade::class,
|
||||
'Module' => Pingpong\Modules\Facades\Module::class,
|
||||
'Menu' => Nwidart\Menus\Facades\Menu::class,
|
||||
'Password' => Illuminate\Support\Facades\Password::class,
|
||||
'Queue' => Illuminate\Support\Facades\Queue::class,
|
||||
'Redirect' => Illuminate\Support\Facades\Redirect::class,
|
||||
|
||||
@@ -3,12 +3,6 @@
|
||||
return [
|
||||
|
||||
'styles' => [
|
||||
'navbar' => 'Pingpong\Menus\Presenters\Bootstrap\NavbarPresenter',
|
||||
'navbar-right' => 'Pingpong\Menus\Presenters\Bootstrap\NavbarRightPresenter',
|
||||
'nav-pills' => 'Pingpong\Menus\Presenters\Bootstrap\NavPillsPresenter',
|
||||
'nav-tab' => 'Pingpong\Menus\Presenters\Bootstrap\NavTabPresenter',
|
||||
'sidebar' => 'Pingpong\Menus\Presenters\Bootstrap\SidebarMenuPresenter',
|
||||
'navmenu' => 'Pingpong\Menus\Presenters\Bootstrap\NavMenuPresenter',
|
||||
'foundation-drilldown' => App\CMS\MenuPresenters\FoundationDrilldownMenuPresenter::class,
|
||||
'foundation-dropdown' => App\CMS\MenuPresenters\FoundationDropdownMenuPresenter::class,
|
||||
'foundation-dropdown-initialized' => App\CMS\MenuPresenters\FoundationInitializedDropdownMenuPresenter::class,
|
||||
|
||||
+2
-152
@@ -1,160 +1,10 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Module Namespace
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Default module namespace.
|
||||
|
|
||||
*/
|
||||
|
||||
'namespace' => 'Modules',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Module Stubs
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Default module stubs.
|
||||
|
|
||||
*/
|
||||
|
||||
'stubs' => [
|
||||
'enabled' => false,
|
||||
'path' => base_path().'/vendor/pingpong/modules/src/Pingpong/Modules/Commands/stubs',
|
||||
'files' => [
|
||||
'start' => 'start.php',
|
||||
'routes' => 'Http/routes.php',
|
||||
'json' => 'module.json',
|
||||
'views/index' => 'Resources/views/index.blade.php',
|
||||
'views/master' => 'Resources/views/layouts/master.blade.php',
|
||||
'scaffold/config' => 'Config/config.php',
|
||||
'composer' => 'composer.json',
|
||||
],
|
||||
'replacements' => [
|
||||
'start' => ['LOWER_NAME'],
|
||||
'routes' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'],
|
||||
'json' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'],
|
||||
'views/index' => ['LOWER_NAME'],
|
||||
'views/master' => ['STUDLY_NAME'],
|
||||
'scaffold/config' => ['STUDLY_NAME'],
|
||||
'composer' => [
|
||||
'LOWER_NAME',
|
||||
'STUDLY_NAME',
|
||||
'VENDOR',
|
||||
'AUTHOR_NAME',
|
||||
'AUTHOR_EMAIL',
|
||||
'MODULE_NAMESPACE',
|
||||
],
|
||||
],
|
||||
],
|
||||
'paths' => [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Modules path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This path used for save the generated module. This path also will added
|
||||
| automatically to list of scanned folders.
|
||||
|
|
||||
*/
|
||||
|
||||
'modules' => base_path('modules'),
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Modules assets path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may update the modules assets path.
|
||||
|
|
||||
*/
|
||||
|
||||
'assets' => public_path('modules'),
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| The migrations path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Where you run 'module:publish-migration' command, where do you publish the
|
||||
| the migration files?
|
||||
|
|
||||
*/
|
||||
|
||||
'migration' => base_path('database/migrations'),
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Generator path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may update the modules generator path.
|
||||
|
|
||||
*/
|
||||
|
||||
'generator' => [
|
||||
'assets' => 'Assets',
|
||||
'config' => 'Config',
|
||||
'command' => 'Console',
|
||||
'migration' => 'Database/Migrations',
|
||||
'model' => 'Entities',
|
||||
'repository' => 'Repositories',
|
||||
'seeder' => 'Database/Seeders',
|
||||
'controller' => 'Http/Controllers',
|
||||
'filter' => 'Http/Middleware',
|
||||
'request' => 'Http/Requests',
|
||||
'provider' => 'Providers',
|
||||
'lang' => 'Resources/lang',
|
||||
'views' => 'Resources/views',
|
||||
'test' => 'Tests',
|
||||
],
|
||||
],
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Scan Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you define which folder will be scanned. By default will scan vendor
|
||||
| directory. This is useful if you host the package in packagist website.
|
||||
|
|
||||
*/
|
||||
|
||||
'scan' => [
|
||||
'enabled' => false,
|
||||
'paths' => [
|
||||
base_path('vendor/*/*'),
|
||||
],
|
||||
],
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Composer File Template
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is the config for composer.json file, generated by this package
|
||||
| in every module since version >= 1.2.0.
|
||||
|
|
||||
*/
|
||||
|
||||
'composer' => [
|
||||
'vendor' => 'pingpong-modules',
|
||||
'author' => [
|
||||
'name' => 'Pingpong Labs',
|
||||
'email' => 'pingpong.labs@gmail.com',
|
||||
],
|
||||
],
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Caching
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is the config for setting up caching feature.
|
||||
|
|
||||
*/
|
||||
'cache' => [
|
||||
'enabled' => false,
|
||||
'key' => 'pingpong-modules',
|
||||
'lifetime' => 60,
|
||||
],
|
||||
|
||||
'stubs' => base_path('app/ModuleManager/Stubs'),
|
||||
]
|
||||
];
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
namespace Modules\Blog\Article\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Admin\Controller;
|
||||
use Modules\Blog\Article\Entities\Comment;
|
||||
use Pingpong\Modules\Routing\Controller;
|
||||
|
||||
class CommentsOverview extends Controller
|
||||
{
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Blog\Article\Http\Controllers\Visitor;
|
||||
|
||||
use App\Models\Content\Content;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Modules\Blog\Article\Entities\Article;
|
||||
use Modules\Blog\Article\Entities\Comment;
|
||||
use Modules\Blog\Article\Events\CreatedComment;
|
||||
use Modules\Blog\Article\Handlers\Article;
|
||||
use Pingpong\Modules\Routing\Controller;
|
||||
use Modules\Blog\Article\Http\Requests\CreateNewComment as CreateNewCommentRequest;
|
||||
|
||||
class CreateNewComment extends Controller
|
||||
{
|
||||
public function store(\Modules\Blog\Article\Http\Requests\CreateNewComment $request, \Modules\Blog\Article\Entities\Article $article)
|
||||
public function store(CreateNewCommentRequest $request, Article $article)
|
||||
{
|
||||
if (!isset($article->moduleSettings['allowComments']) || !$article->moduleSettings['allowComments']) {
|
||||
return redirect()
|
||||
|
||||
@@ -23,14 +23,4 @@ class ArticleEventServiceProvider extends ServiceProvider
|
||||
DeletedComment::class => [LogDeletedComment::class],
|
||||
CreatedComment::class => [LogNewComment::class],
|
||||
];
|
||||
|
||||
public function boot(DispatcherContract $events)
|
||||
{
|
||||
parent::boot($events);
|
||||
}
|
||||
|
||||
protected function setModulePath()
|
||||
{
|
||||
$this->path = __DIR__;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,13 @@
|
||||
<?php namespace Modules\Blog\Article\Providers;
|
||||
|
||||
use App\Providers\ModuleServiceProvider;
|
||||
use App\CMS\Modules\ServiceProviders\ServiceProvider;
|
||||
use Modules\Blog\Article\Pipeline\DisplayContent\LoadCommentsForBlogpost;
|
||||
use Modules\Blog\Article\Pipeline\SaveContent\TurnCommentsOnOrOff;
|
||||
|
||||
class ArticleServiceProvider extends ModuleServiceProvider
|
||||
class ArticleServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Boot the application events.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php namespace Modules\Blog\ArticleList\Providers;
|
||||
|
||||
use App\Providers\ModuleServiceProvider;
|
||||
use App\CMS\Modules\ServiceProviders\ServiceProvider;
|
||||
use Modules\Blog\ArticleList\Pipeline\DisplayContent\LoadArticlesForList;
|
||||
|
||||
class ArticleListServiceProvider extends ModuleServiceProvider
|
||||
class ArticleListServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected function setModuleAlias()
|
||||
{
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
<?php namespace Modules\Categories\Http\Controllers;
|
||||
|
||||
use App\CMS\Enumerations\ModuleNamesWithIds;
|
||||
use App\Models\Module;
|
||||
use App\Http\Controllers\Admin\Controller;
|
||||
use Modules\Categories\Entities\Category;
|
||||
use Pingpong\Modules\Routing\Controller;
|
||||
|
||||
class CategoriesOverview extends Controller
|
||||
{
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
<?php namespace Modules\Categories\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Admin\Controller;
|
||||
use App\Http\Requests\Request;
|
||||
use App\Models\Module;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Str;
|
||||
use Modules\Categories\Entities\Category;
|
||||
use Pingpong\Modules\Routing\Controller;
|
||||
|
||||
class CreateNewCategory extends Controller
|
||||
{
|
||||
/**
|
||||
* Display form for new category
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function getNew()
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php namespace Modules\Categories\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Admin\Controller;
|
||||
use App\Http\Requests\Request;
|
||||
use App\Models\Module;
|
||||
use Illuminate\Support\Str;
|
||||
use Modules\Categories\Entities\Category;
|
||||
use Pingpong\Modules\Routing\Controller;
|
||||
|
||||
class EditCategory extends Controller
|
||||
{
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
namespace Modules\Categories\Providers;
|
||||
|
||||
use App\Providers\ModuleServiceProvider;
|
||||
use App\CMS\Modules\ServiceProviders\ServiceProvider;
|
||||
use Modules\Categories\Contracts\Repositories\Category as ICategory;
|
||||
use Modules\Categories\Repositories\Category as Category;
|
||||
|
||||
class CategoriesServiceProvider extends ModuleServiceProvider
|
||||
class CategoriesServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected function setModuleAlias()
|
||||
{
|
||||
|
||||
@@ -4,15 +4,14 @@ namespace Modules\Categories\Repositories;
|
||||
use App\Models\Module;
|
||||
use Modules\Categories\Entities\Category as CategoryModel;
|
||||
use Modules\Categories\Contracts\Repositories\Category as ICategory;
|
||||
use Pingpong\Modules\Facades\Module as ModuleInstance;
|
||||
|
||||
class Category implements ICategory
|
||||
{
|
||||
public function getForModule(Module $module)
|
||||
{
|
||||
$categoryModule = ModuleInstance::get('categories');
|
||||
$categoryModule = Module::where('alias', 'categories')->first();
|
||||
$categories = [];
|
||||
if ($module->support_categories && !is_null($categoryModule) && $categoryModule->enabled()) {
|
||||
if ($module->support_categories && !is_null($categoryModule) && $categoryModule->enabled) {
|
||||
$categories = CategoryModel::where('module_id', $module->id)
|
||||
->get();
|
||||
}
|
||||
|
||||
@@ -3,7 +3,13 @@
|
||||
@section('pageHeading', trans('categories::categories.overview'))
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="card items">
|
||||
<div class="card-block">
|
||||
|
||||
@if(count($categories))
|
||||
<div class="item-list striped rows-striped">
|
||||
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -18,9 +24,12 @@
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@else
|
||||
<div class="alert alert-info">
|
||||
@lang('categories::categories.noCategories')
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
@@ -1,11 +1,33 @@
|
||||
<tr>
|
||||
<td>
|
||||
{{str_repeat('-', $level)}} {{$currentCategory['name']}}
|
||||
{{str_repeat('-', $level)}} <a href="{{route('categories.edit', ['id' => $currentCategory['id']])}}">{{$currentCategory['name']}}</a>
|
||||
</td>
|
||||
<td>@lang($modules[$currentCategory['module_id']])</td>
|
||||
<td>
|
||||
<a href="{{route('categories.edit', ['id' => $currentCategory['id']])}}"><i class="fa fa-fw fa-edit"></i></a>
|
||||
<a class="confirm" href="{{route('categories.delete', ['id' => $currentCategory['id']])}}"><i class="fa fa-fw fa-remove"></i></a>
|
||||
<div class="item-actions-dropdown">
|
||||
<a class="item-actions-toggle-btn">
|
||||
<span class="inactive">
|
||||
<i class="fa fa-cog"></i>
|
||||
</span>
|
||||
<span class="active">
|
||||
<i class="fa fa-chevron-circle-right"></i>
|
||||
</span>
|
||||
</a>
|
||||
<div class="item-actions-block">
|
||||
<ul class="item-actions-list">
|
||||
|
||||
<li>
|
||||
<a href="{{route('categories.edit', ['id' => $currentCategory['id']])}}"><i
|
||||
class="fa fa-fw fa-pencil"></i></a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="confirm remove"
|
||||
href="{{route('categories.delete', ['id' => $currentCategory['id']])}}"><i
|
||||
class="fa fa-fw fa-trash"></i></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"name": "pingpong-modules/categories",
|
||||
"description": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Pingpong Labs",
|
||||
"email": "pingpong.labs@gmail.com"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\Categories\\": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php namespace Modules\ContactForm\Providers;
|
||||
|
||||
use App\Providers\ModuleServiceProvider;
|
||||
use App\CMS\Modules\ServiceProviders\ServiceProvider;
|
||||
use Modules\ContactForm\Handlers\ContactForm;
|
||||
use Modules\ContactForm\Pipeline\SavePipeline\SaveContactInformation;
|
||||
use Modules\ContactForm\Widgets\Address\Address;
|
||||
use Modules\ContactForm\Widgets\Form\Form;
|
||||
|
||||
class ContactFormServiceProvider extends ModuleServiceProvider
|
||||
class ContactFormServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Boot the application events.
|
||||
|
||||
@@ -37,7 +37,7 @@ class Gallery implements AppHandler
|
||||
->get();
|
||||
|
||||
// render content
|
||||
return Controller::VisitorsView($content->template, [
|
||||
return Controller::visitorsView($content->template, [
|
||||
'images' => $images,
|
||||
'page' => $content,
|
||||
'extra' => $parameters
|
||||
@@ -187,9 +187,8 @@ class Gallery implements AppHandler
|
||||
$menu = \Menu::instance('mainMenu');
|
||||
$submenu = $menu->whereTitle(trans('admin/mainMenu.contentPages'));
|
||||
$submenu->dropdown(trans('gallery::module.name'), function ($submenu) use ($user) {
|
||||
$submenu->route('content.new', trans('gallery::admin/adminMenu.new'), ['moduleId' => self::getModuleId()], 10, ['icon' => 'fa fa-plus']);
|
||||
$submenu->route('content.overview', trans('gallery::admin/adminMenu.overview'), ['moduleId' => self::getModuleId()], 20, ['icon' => 'fa fa-list']);
|
||||
// $submenu->route('emails.sent', trans('contactform::admin/adminMenu.sentMessages'), [], 30, ['icon' => 'fa fa-send']);
|
||||
$submenu->route('content.new', trans('gallery::admin/adminMenu.new'), ['module' => 'gallery'], 10, ['icon' => 'fa fa-plus']);
|
||||
$submenu->route('content.overview', trans('gallery::admin/adminMenu.overview'), ['module' => 'gallery'], 20, ['icon' => 'fa fa-list']);
|
||||
}, 25, ['icon' => 'fa fa-camera']);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php namespace Modules\Gallery\Providers;
|
||||
|
||||
use App\Providers\ModuleServiceProvider;
|
||||
use App\CMS\Modules\ServiceProviders\ServiceProvider;
|
||||
|
||||
class GalleryServiceProvider extends ModuleServiceProvider
|
||||
class GalleryServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected function setModuleAlias()
|
||||
{
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"name": "pingpong-modules/gallery",
|
||||
"description": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Pingpong Labs",
|
||||
"email": "pingpong.labs@gmail.com"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\Gallery\\": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,16 +54,6 @@ class StaticPage extends Handler implements ContentTitles
|
||||
return trans('staticpages::module.editPage');
|
||||
}
|
||||
|
||||
/**
|
||||
* Does given module manage content? Or is it just module with widgets/something internal/something absolutely else?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function managesContent()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does this module support categories?
|
||||
*
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php namespace Modules\Staticpages\Providers;
|
||||
|
||||
use App\Providers\ModuleServiceProvider;
|
||||
use App\CMS\Modules\ServiceProviders\ServiceProvider;
|
||||
|
||||
class StaticPagesServiceProvider extends ModuleServiceProvider
|
||||
class StaticPagesServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected function setModuleAlias()
|
||||
{
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"name": "pingpong-modules/staticpages",
|
||||
"description": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Pingpong Labs",
|
||||
"email": "pingpong.labs@gmail.com"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\StaticPages\\": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -82,25 +82,6 @@ $ (function () {
|
||||
});
|
||||
});
|
||||
|
||||
// /***********************************************
|
||||
// * NProgress Settings
|
||||
// ***********************************************/
|
||||
// var npSettings = {
|
||||
// easing: 'ease',
|
||||
// speed: 500
|
||||
// };
|
||||
//
|
||||
// NProgress.configure (npSettings);
|
||||
// $ (function () {
|
||||
// setSameHeights ();
|
||||
//
|
||||
// var resizeTimer;
|
||||
//
|
||||
// $ (window).resize (function () {
|
||||
// clearTimeout (resizeTimer);
|
||||
// resizeTimer = setTimeout (setSameHeights, 150);
|
||||
// });
|
||||
// });
|
||||
|
||||
function setSameHeights($container) {
|
||||
|
||||
@@ -183,38 +164,6 @@ $ (function () {
|
||||
|
||||
});
|
||||
|
||||
// $ (function () {
|
||||
|
||||
// // set sortable options
|
||||
// $ ('.images-container').sortable ({
|
||||
// animation: 150,
|
||||
// handle: ".control-btn.move",
|
||||
// draggable: ".image-container",
|
||||
// onMove: function (evt) {
|
||||
// var $relatedElem = $ (evt.related);
|
||||
//
|
||||
// if ($relatedElem.hasClass ('add-image')) {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// var $controlsButtons = $ ('.controls');
|
||||
//
|
||||
// var $controlsButtonsStar = $controlsButtons.find ('.star');
|
||||
//
|
||||
// $controlsButtonsStar.on ('click', function (e) {
|
||||
// e.preventDefault ();
|
||||
//
|
||||
// $controlsButtonsStar.removeClass ('active');
|
||||
// $controlsButtonsStar.parents ('.image-container').removeClass ('main');
|
||||
//
|
||||
// $ (this).addClass ('active');
|
||||
//
|
||||
// $ (this).parents ('.image-container').addClass ('main');
|
||||
// })
|
||||
// });
|
||||
|
||||
$ (function () {
|
||||
$ ('.nav-profile > li > a').on ('click', function () {
|
||||
var $el = $ (this).next ();
|
||||
@@ -242,22 +191,14 @@ $ (function () {
|
||||
// Position switchers
|
||||
var $customizeMenuRadioBtns = $customizeMenu.find ('.radio');
|
||||
|
||||
// /////////////////////////////////////////////////
|
||||
|
||||
// Initial state
|
||||
|
||||
// On setting event, set corresponding options
|
||||
|
||||
// Update customize view based on options
|
||||
|
||||
// Update theme based on options
|
||||
|
||||
/************************************************
|
||||
* Initial State
|
||||
*************************************************/
|
||||
|
||||
setThemeSettings ();
|
||||
|
||||
setSameHeights();
|
||||
|
||||
/************************************************
|
||||
* Events
|
||||
*************************************************/
|
||||
@@ -498,13 +439,3 @@ $ (document).ready (function () {
|
||||
|
||||
$('form').areYouSure();
|
||||
});
|
||||
|
||||
// /***********************************************
|
||||
// * NProgress Settings
|
||||
// ***********************************************/
|
||||
//
|
||||
// // start load bar
|
||||
// NProgress.start ();
|
||||
//
|
||||
// // end loading bar
|
||||
// NProgress.done ();
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
.row {
|
||||
.col {
|
||||
padding-left: $grid-gutter-width/2;
|
||||
padding-right: $grid-gutter-width/2;
|
||||
padding-left: $grid-gutter-width-base/2;
|
||||
padding-right: $grid-gutter-width-base/2;
|
||||
float: left;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ return [
|
||||
"noTemplates" => "Nelze vytvořit stránku. Pro tento modul neexistuje žádná šablona, která by šla použít pro vykreslení obsahu.",
|
||||
"nothingToEdit" => "Nebyly provedeny žádné změny, proto nedošlo k editaci.",
|
||||
"overview" => "Seznam všech obsahových stránek",
|
||||
"pageDeleted" => "Stránka :name (:url) úspěšně smazána.",
|
||||
"pageDeleted" => "Stránka :name úspěšně smazána.",
|
||||
"parentPage" => "Nadřazená stránka",
|
||||
"publicationOptions" => "Nastavení publikace",
|
||||
"save" => "Uložit",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
return [
|
||||
"copy" => 'Kopírovat šablonu',
|
||||
"cannotCopy" => "Adresář nemá potřebná práva k zápisu. Kopírování není dostupné.",
|
||||
"cannotWriteContent" => "Nelze uložit obsah šablony, adresář pro uložení souboru nemá dostatečná oprávnění pro zápis. Meta informace k šabloně však byly uloženy.",
|
||||
"copyFailed" => "Nelze zkopírovat šablonu do :name. Zkontrolujte prosím právo pro zápis do adresáře s šablonami.",
|
||||
@@ -20,4 +21,7 @@ return [
|
||||
"overview" => "Šablony",
|
||||
"parentDirectory" => "Rodičovský adresář",
|
||||
"subdirectories" => "Podadresáře",
|
||||
'widgets' => 'Widgety',
|
||||
'errors' => 'Chybové stránky',
|
||||
'contact' => 'Kontaktní formulář'
|
||||
];
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
@section('headerButtons')
|
||||
|
||||
@if($module->exists === true)
|
||||
<a href="{{route('content.new', ['moduleId' => $module->id])}}" class="btn btn-primary btn-sm rounded">
|
||||
<a href="{{route('content.new', ['module' => $module])}}" class="btn btn-primary btn-sm rounded">
|
||||
<i class="fa fa-plus"></i>
|
||||
</a>
|
||||
@endif
|
||||
@@ -36,7 +36,7 @@
|
||||
@foreach($pages as $page)
|
||||
<div class="row p-tb-15">
|
||||
<div class="col-md-1 hidden-sm-down text-center with-placeholder">
|
||||
<a href="{{route('content.edit', ['id' => $page->id])}}">
|
||||
<a href="{{route('content.edit', ['page' => $page])}}">
|
||||
@if(!view()->exists(template_name($page->template, false)))
|
||||
<i class="fa fa-2x text-warning fa-warning" data-toggle="tooltip"
|
||||
title="@lang('admin/contents.invalidTemplateSelected')"></i>
|
||||
@@ -53,7 +53,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-xs-10 col-md-3 col-lg-4">
|
||||
<a href="{{route('content.edit', ['id' => $page->id])}}">
|
||||
<a href="{{route('content.edit', ['page' => $page])}}">
|
||||
{{$page->title}}
|
||||
</a>
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
@else tag-warning @endif">{{$statuses[$page->status]}}</span>
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-3 hidden-sm-down">
|
||||
<a href="{{route('content.overview', ['moduleId' => $page->module_id])}}">
|
||||
<a href="{{route('content.overview', ['module' => $page->module->alias])}}">
|
||||
{{trans($page->module_name)}}
|
||||
</a>
|
||||
</div>
|
||||
@@ -87,7 +87,7 @@
|
||||
@if(!$page->isHomepage)
|
||||
<li>
|
||||
|
||||
<a href="{{route('content.setHomepage', ['id' => $page->id])}}"
|
||||
<a href="{{route('content.setHomepage', ['page' => $page])}}"
|
||||
data-toggle="tooltip"
|
||||
title="@lang('admin/contents.setHomepage')">
|
||||
<i class="fa fa-home"></i>
|
||||
@@ -96,7 +96,7 @@
|
||||
@endif
|
||||
|
||||
<li>
|
||||
<a class="edit" href="{{route('content.edit', ['id' => $page->id])}}"
|
||||
<a class="edit" href="{{route('content.edit', ['page' => $page])}}"
|
||||
data-toggle="tooltip" title="@lang('admin/contents.editPlain')">
|
||||
<i class="fa fa-pencil"></i>
|
||||
</a>
|
||||
@@ -104,14 +104,14 @@
|
||||
|
||||
@if($page->isDraft())
|
||||
<li>
|
||||
<a href="{{route('content.changeStatus', ['id' => $page->id, 'status' => 'public'])}}"
|
||||
<a href="{{route('content.changeStatus', ['page' => $page, 'status' => 'public'])}}"
|
||||
class="confirm" data-toggle="tooltip"
|
||||
title="@lang('admin/contents.makePublic')">
|
||||
<i class="fa fa-eye"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{route('content.changeStatus', ['id' => $page->id, 'status' => 'protected'])}}"
|
||||
<a href="{{route('content.changeStatus', ['page' => $page, 'status' => 'protected'])}}"
|
||||
class="confirm" data-toggle="tooltip"
|
||||
title="@lang('admin/contents.makeProtected')">
|
||||
<i class="fa fa-lock"></i>
|
||||
@@ -126,7 +126,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{route('content.changeStatus', ['id' => $page->id, 'status' => 'draft'])}}"
|
||||
<a href="{{route('content.changeStatus', ['page' => $page, 'status' => 'draft'])}}"
|
||||
class="button tiny warning confirm" data-toggle="tooltip"
|
||||
title="@lang('admin/contents.makeDraft')">
|
||||
<i class="fa fa-eye-slash"></i>
|
||||
@@ -135,7 +135,7 @@
|
||||
@endif
|
||||
|
||||
<li>
|
||||
<a href="{{route('content.delete', ['id' => $page->id])}}"
|
||||
<a href="{{route('content.delete', ['page' => $page])}}"
|
||||
class="button tiny alert remove confirm" data-toggle="tooltip"
|
||||
title="@lang('admin/contents.deletePage')"><i
|
||||
class="fa fa-trash-o"></i>
|
||||
|
||||
@@ -17,9 +17,11 @@
|
||||
|
||||
<h5>@lang('admin/templates.subdirectories')</h5>
|
||||
|
||||
<ul>
|
||||
@forelse($subdirectories as $subdirectory)
|
||||
<a href="{{route('templates.overview', ['path' => $subdirectory->id])}}">{{trans($subdirectory->name)}}</a>
|
||||
<li><a href="{{route('templates.overview', ['path' => $subdirectory->id])}}">{{trans($subdirectory->name)}}</a></li>
|
||||
@empty
|
||||
<em>@lang('admin/templates.noSubdirectories')</em>
|
||||
<li><em>@lang('admin/templates.noSubdirectories')</em></li>
|
||||
@endforelse
|
||||
</ul>
|
||||
</div>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user