Merge branch 'dev' into module_profiler
This commit is contained in:
+1
-1
@@ -16,4 +16,4 @@ MAIL_PASSWORD=
|
||||
|
||||
SITE_URL=/
|
||||
UPLOAD_URL=/public/uploads
|
||||
THUMBNAILS_URL=/uploads/thumbnails
|
||||
THUMBNAIL_URL=/public/uploads/thumbnails
|
||||
@@ -5,27 +5,6 @@ use App\Http\Requests\Request;
|
||||
use App\Models\Content\Content;
|
||||
|
||||
interface AdvancedContentModifier {
|
||||
/**
|
||||
* Save module-specific values into database
|
||||
*
|
||||
* @param Content $content
|
||||
* @param array $inputData
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function createNew(Content &$content, array $inputData);
|
||||
|
||||
/**
|
||||
* Method used for editing existing content page.
|
||||
*
|
||||
* Reason why it is separated from createNew() method is simple - we need to save history of changes.
|
||||
*
|
||||
* @param Content $content
|
||||
* @param $request
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function edit(Content $content, $request);
|
||||
/**
|
||||
* Method called right after content page is marked as deleted
|
||||
*
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
namespace App\CMS\Contracts\Content\DisplayPipeline;
|
||||
|
||||
use App\Models\Content\Content;
|
||||
|
||||
interface Pipeline {
|
||||
/**
|
||||
* Add new process into pipeline
|
||||
*
|
||||
* @param string $process
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function add($process);
|
||||
function run(Content $page);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
namespace App\CMS\Contracts\Content\DisplayPipeline;
|
||||
|
||||
use App\Models\Content\Content;
|
||||
|
||||
interface Process {
|
||||
/**
|
||||
* Process and modify given page
|
||||
*
|
||||
* @param Content $page
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function handle(Content & $page);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace App\CMS\Contracts\Content\SavePipeline;
|
||||
|
||||
use App\Models\Content\Content;
|
||||
|
||||
interface Pipeline {
|
||||
/**
|
||||
* Add new process into pipeline
|
||||
*
|
||||
* @param string $process
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function add($process);
|
||||
|
||||
/**
|
||||
* Save content page
|
||||
*
|
||||
* @param Content $page
|
||||
* @param array $input
|
||||
*
|
||||
* @return Content
|
||||
*/
|
||||
function run(Content & $page, array $input);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
namespace App\CMS\Contracts\Content\SavePipeline;
|
||||
|
||||
use App\Models\Content\Content;
|
||||
|
||||
interface Process {
|
||||
/**
|
||||
* Process and modify given page
|
||||
*
|
||||
* @param Content $page
|
||||
* @param array $input
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function handle(Content & $page, array & $input);
|
||||
}
|
||||
@@ -6,16 +6,6 @@ use App\Models\Content\Content;
|
||||
|
||||
interface AppHandler extends BaseModuleHandler
|
||||
{
|
||||
/**
|
||||
* Render given module into visitor area.
|
||||
*
|
||||
* @param Content $content DB model from table contents
|
||||
* @param array $parameters parameters used for modifications/custom settings of given model
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function render(Content $content, $parameters);
|
||||
|
||||
public static function getHistoryHandler();
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,28 +27,4 @@ interface TemplateHandler extends BaseModuleHandler
|
||||
* @return array
|
||||
*/
|
||||
public static function getPublicTemplatePaths();
|
||||
|
||||
/**
|
||||
* Prepare Content object to be rendered using Blade template
|
||||
*
|
||||
* @param Content $content
|
||||
*/
|
||||
public static function beforeRender(Content & $content);
|
||||
|
||||
/**
|
||||
* Modify input data into format which can be understood by edit template
|
||||
*
|
||||
* @param Content $content
|
||||
*/
|
||||
public static function beforePopulatingEditForm(Content & $content);
|
||||
|
||||
/**
|
||||
* Slightly modify Content object before saving into database.
|
||||
*
|
||||
* This way we can do almost whatever we want - even in template
|
||||
*
|
||||
* @param Content $content
|
||||
* @param $request
|
||||
*/
|
||||
public static function beforeSave(Content & $content, $request);
|
||||
}
|
||||
@@ -15,7 +15,7 @@ interface Template
|
||||
|
||||
public function setModel(TemplateModel $model);
|
||||
|
||||
public function getPathToTemplate();
|
||||
public function getPathToTemplate($mode = null);
|
||||
|
||||
public function getForModule(ModuleModel $module);
|
||||
}
|
||||
@@ -20,19 +20,6 @@ abstract class Handler extends BaseHandler implements AppHandler
|
||||
return History::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render given module into visitor area.
|
||||
*
|
||||
* @param Content $content DB model from table contents
|
||||
* @param array $parameters parameters used for modifications/custom settings of given model
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function render(Content $content, $parameters)
|
||||
{
|
||||
return Controller::VisitorsView($content->template, ['page' => $content, 'extra' => $parameters]);
|
||||
}
|
||||
|
||||
public static function getExtendedFormSections()
|
||||
{
|
||||
return [
|
||||
|
||||
@@ -96,37 +96,4 @@ class CurrentTemplate implements TemplateHandler
|
||||
{
|
||||
return call_user_func([self::handler(), 'getPublicTemplatePaths']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare Content object to be rendered using Blade template
|
||||
*
|
||||
* @param Content $content
|
||||
*/
|
||||
public static function beforeRender(Content & $content)
|
||||
{
|
||||
call_user_func_array([self::handler(), 'beforeRender'], [&$content]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify input data into format which can be understood by edit template
|
||||
*
|
||||
* @param Content $content
|
||||
*/
|
||||
public static function beforePopulatingEditForm(Content & $content)
|
||||
{
|
||||
call_user_func_array([self::handler(), 'beforePopulatingEditForm'], [&$content]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Slightly modify Content object before saving into database.
|
||||
*
|
||||
* This way we can do almost whatever we want - even in template
|
||||
*
|
||||
* @param Content $content
|
||||
* @param $request
|
||||
*/
|
||||
public static function beforeSave(Content & $content, $request)
|
||||
{
|
||||
call_user_func_array([self::handler(), 'beforeSave'], [&$content, $request]);
|
||||
}
|
||||
}
|
||||
@@ -29,11 +29,8 @@ class PageRenderer
|
||||
/**
|
||||
* @var $handler AppHandler
|
||||
*/
|
||||
// get handler
|
||||
$handler = new $page->moduleHandler;
|
||||
|
||||
$page->content = Shortcode::compile($page->content);
|
||||
|
||||
// render page
|
||||
return $handler->render($page, $parameters);
|
||||
}
|
||||
|
||||
@@ -37,32 +37,18 @@ class EditContent implements Interaction
|
||||
* @param array $data
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return mixed|void
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($data, $parameters)
|
||||
{
|
||||
/**
|
||||
* @var $page Content
|
||||
*/
|
||||
list($page, $titlePhoto, $relatedFiles) = $parameters;
|
||||
list($page) = $parameters;
|
||||
|
||||
// let template to modify request and content page
|
||||
CurrentTemplate::beforeSave($page, $data);
|
||||
app('saveContentPipeline')->run($page, $data);
|
||||
|
||||
// upload file - if provided
|
||||
$data['titlePhoto'] = isset($data['existingTitlePhoto']) ? $data['existingTitlePhoto'] : null;
|
||||
|
||||
if (!is_null($titlePhoto)) {
|
||||
$file = $this->file->upload($titlePhoto);
|
||||
$data['titlePhoto'] = $file ? $file['filename'] : null;
|
||||
}
|
||||
|
||||
$page->update($data);
|
||||
$this->module->callOnString($page->moduleHandler, 'edit', [$page, $data]);
|
||||
|
||||
// move to interaction
|
||||
$keepAssigned = isset($data['keepAssigned']) ? $data['keepAssigned'] : [];
|
||||
$page->uploadRelatedFiles($relatedFiles, $keepAssigned);
|
||||
return $page;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,29 +43,14 @@ class NewContent implements Interaction
|
||||
*/
|
||||
public function handle($data, $parameters)
|
||||
{
|
||||
list($moduleHandler, $titlePhoto, $relatedFiles) = $parameters;
|
||||
|
||||
// upload file - if provided
|
||||
$file = !is_null($titlePhoto) ? $this->file->upload($titlePhoto) : null;
|
||||
list($moduleHandler) = $parameters;
|
||||
|
||||
$data['userId'] = \Auth::user()->id;
|
||||
$data['language'] = LaravelLocalization::getCurrentLocale();
|
||||
$data['titlePhoto'] = $file ? $file['filename'] : null;
|
||||
$data['moduleHandler'] = $moduleHandler;
|
||||
|
||||
$page = Content::create($data);
|
||||
|
||||
// save module-specific stuff
|
||||
$this->module->callOnString($moduleHandler, 'createNew', [&$page, $data]);
|
||||
|
||||
// let template to modify data and content page
|
||||
CurrentTemplate::beforeSave($page, $data);
|
||||
|
||||
// save content of page before (possible) uploading related files
|
||||
$page->save();
|
||||
|
||||
// upload files assigned to content page
|
||||
$page->uploadRelatedFiles($relatedFiles);
|
||||
$page = new Content();
|
||||
app('saveContentPipeline')->run($page, $data);
|
||||
|
||||
return $page;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
namespace App\CMS\Pipeline;
|
||||
|
||||
use App\CMS\Pipeline\Exceptions\InvalidProcessType;
|
||||
|
||||
abstract class AbstractPipeline {
|
||||
protected $processes = [];
|
||||
protected $beforeStart = null;
|
||||
protected $beforeRender = null;
|
||||
protected $acceptedProcessInterface = null;
|
||||
|
||||
/**
|
||||
* check if given classname implements valid Process interface
|
||||
*
|
||||
* @param $classname
|
||||
*
|
||||
* @throws InvalidProcessType
|
||||
*/
|
||||
protected function checkValidProcess($classname)
|
||||
{
|
||||
if (is_null($this->acceptedProcessInterface))
|
||||
return;
|
||||
|
||||
if (!in_array($this->acceptedProcessInterface, class_implements($classname))) {
|
||||
throw new InvalidProcessType($classname);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new process into pipeline
|
||||
*
|
||||
* @param $process
|
||||
*
|
||||
* @return void
|
||||
* @throws InvalidProcessType
|
||||
*/
|
||||
function add($process)
|
||||
{
|
||||
$this->checkValidProcess($process);
|
||||
|
||||
$this->processes[] = $process;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $beforeStart
|
||||
*/
|
||||
public function setBeforeStart($beforeStart)
|
||||
{
|
||||
$this->checkValidProcess($beforeStart);
|
||||
|
||||
if (!is_null($this->beforeStart)) {
|
||||
array_unshift($this->processes, $this->beforeStart);
|
||||
}
|
||||
|
||||
$this->beforeStart = $beforeStart;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $beforeRender
|
||||
*/
|
||||
public function setBeforeRender($beforeRender)
|
||||
{
|
||||
$this->checkValidProcess($beforeRender);
|
||||
|
||||
if (!is_null($this->beforeRender)) {
|
||||
array_push($this->processes, $this->beforeRender);
|
||||
}
|
||||
|
||||
$this->beforeRender = $beforeRender;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
namespace App\CMS\Pipeline\DisplayPipeline;
|
||||
|
||||
use App\CMS\Contracts\Content\DisplayPipeline\Pipeline;
|
||||
use App\CMS\Contracts\Content\DisplayPipeline\Process;
|
||||
use App\CMS\Pipeline\AbstractPipeline;
|
||||
use App\Models\Content\Content;
|
||||
|
||||
class DisplayPipeline extends AbstractPipeline implements Pipeline
|
||||
{
|
||||
/**
|
||||
* DisplayPipeline constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->acceptedProcessInterface = Process::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run pipeline
|
||||
*
|
||||
* @param Content $page
|
||||
*
|
||||
* @return Content
|
||||
*/
|
||||
function run(Content $page)
|
||||
{
|
||||
$this->runBeforeStart($page);
|
||||
|
||||
foreach ($this->processes as $process) {
|
||||
/**
|
||||
* @var $run Process
|
||||
*/
|
||||
$run = new $process;
|
||||
$run->handle($page);
|
||||
}
|
||||
|
||||
$this->runBeforeRender($page);
|
||||
|
||||
return $page;
|
||||
}
|
||||
|
||||
protected function runBeforeStart($page)
|
||||
{
|
||||
if (!is_null($this->beforeStart)) {
|
||||
$process = new $this->beforeStart;
|
||||
$process->handle($page);
|
||||
}
|
||||
}
|
||||
|
||||
protected function runBeforeRender($page)
|
||||
{
|
||||
if (!is_null($this->beforeRender)) {
|
||||
$process = new $this->beforeRender;
|
||||
$process->handle($page);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
namespace App\CMS\Pipeline\DisplayPipeline\Process;
|
||||
|
||||
use App\CMS\Contracts\Content\DisplayPipeline\Process;
|
||||
use App\Models\Content\Content;
|
||||
|
||||
class AddViewedToPage implements Process {
|
||||
/**
|
||||
* Process and modify given page
|
||||
*
|
||||
* @param Content $page
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function handle(Content & $page)
|
||||
{
|
||||
$page->view();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
namespace App\CMS\Pipeline\DisplayPipeline\Process;
|
||||
|
||||
use App\CMS\Contracts\Content\DisplayPipeline\Process;
|
||||
use App\Models\Content\Content;
|
||||
use Webwizo\Shortcodes\Facades\Shortcode;
|
||||
|
||||
class CompileShortcodes implements Process {
|
||||
/**
|
||||
* Process and modify given page
|
||||
*
|
||||
* @param Content $page
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function handle(Content & $page)
|
||||
{
|
||||
$page->pageContent = Shortcode::compile($page->pageContent);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
namespace App\CMS\Pipeline\Exceptions;
|
||||
|
||||
class InvalidProcessType extends \Exception
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
namespace App\CMS\Pipeline\SavePipeline\Process;
|
||||
|
||||
use App\CMS\Contracts\Content\SavePipeline\Process;
|
||||
use App\Models\Content\Content;
|
||||
|
||||
class SaveCommonFields implements Process {
|
||||
/**
|
||||
* Process and modify given page
|
||||
*
|
||||
* @param Content $page
|
||||
* @param array $input
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function handle(Content & $page, array &$input)
|
||||
{
|
||||
($page->exists == false) ? $page = Content::create($input): $page->update($input);
|
||||
}
|
||||
}
|
||||
+21
-31
@@ -1,32 +1,33 @@
|
||||
<?php
|
||||
namespace App\Models\Content\ModelTraits;
|
||||
namespace App\CMS\Pipeline\SavePipeline\Process;
|
||||
|
||||
use App\CMS\Contracts\Content\SavePipeline\Process;
|
||||
use App\Models\Content\Content;
|
||||
use App\Models\Content\ContentHasFile;
|
||||
use App\Models\FileManager\Directory;
|
||||
use App\Models\FileManager\File;
|
||||
use Illuminate\Support\Facades\App;
|
||||
|
||||
trait Content
|
||||
class UploadRelatedFiles implements Process
|
||||
{
|
||||
/**
|
||||
* Upload and assign files to newly created content page
|
||||
* Process and modify given page
|
||||
*
|
||||
* @param $files
|
||||
* @param $assignedFiles
|
||||
* @param null $revisionId
|
||||
* @param Content $page
|
||||
* @param array $input
|
||||
*
|
||||
* @return int
|
||||
* @return void
|
||||
*/
|
||||
public function uploadRelatedFiles($files, $assignedFiles = [], $revisionId = null)
|
||||
function handle(Content & $page, array & $input)
|
||||
{
|
||||
$changed = 0;
|
||||
$files = $input['files'];
|
||||
$assignedFiles = isset($input['keepAssigned']) ? $input['keepAssigned'] : [];
|
||||
|
||||
// check if any file was removed
|
||||
$changed += $this->removeRelatedFiles($revisionId, $assignedFiles);
|
||||
$this->removeRelatedFiles($page, $assignedFiles);
|
||||
|
||||
// allow uploading only on created pages
|
||||
if (!$this->id || !$files[0]) {
|
||||
return $changed;
|
||||
if (!$page->id || !$files[0]) {
|
||||
return;
|
||||
}
|
||||
|
||||
// find or create new directory for files assigned to content
|
||||
@@ -37,7 +38,7 @@ trait Content
|
||||
$data = new \stdClass();
|
||||
$data->directoryId = $directory->id;
|
||||
|
||||
$fileModel = App::make(File::class);
|
||||
$fileModel = app(File::class);
|
||||
|
||||
foreach ($files as $file) {
|
||||
if (!$file) {
|
||||
@@ -48,38 +49,27 @@ trait Content
|
||||
// add assignement
|
||||
ContentHasFile::create([
|
||||
'file_id' => $uploaded['id'],
|
||||
'content_id' => $this->id
|
||||
'content_id' => $page->id
|
||||
]);
|
||||
|
||||
if ($revisionId) {
|
||||
$this->saveHistory($revisionId, 'file', null, ['file' => $uploaded['file']->getClientOriginalName()]);
|
||||
}
|
||||
|
||||
$changed++;
|
||||
}
|
||||
|
||||
return $changed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete files from association
|
||||
*
|
||||
* @param $revisionId
|
||||
*
|
||||
* @return int
|
||||
* @param Content $page
|
||||
* @param $assignedFiles
|
||||
*/
|
||||
private function removeRelatedFiles($revisionId, $assignedFiles)
|
||||
private function removeRelatedFiles(Content $page, $assignedFiles)
|
||||
{
|
||||
$allFiles = $this->files()
|
||||
$allFiles = $page->files()
|
||||
->whereNotIn('id', array_keys($assignedFiles))
|
||||
->get();
|
||||
|
||||
foreach ($allFiles as $file) {
|
||||
ContentHasFile::where('content_id', $this->id)
|
||||
ContentHasFile::where('content_id', $page->id)
|
||||
->where('file_id', $file->id)
|
||||
->delete();
|
||||
}
|
||||
|
||||
return count($allFiles);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
namespace App\CMS\Pipeline\SavePipeline\Process;
|
||||
|
||||
use App\CMS\Contracts\Content\SavePipeline\Process;
|
||||
use App\Models\Content\Content;
|
||||
use App\Models\FileManager\File;
|
||||
|
||||
class UploadTitlePhoto implements Process {
|
||||
/**
|
||||
* Process and modify given page
|
||||
*
|
||||
* @param Content $page
|
||||
* @param array $input
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function handle(Content & $page, array & $input)
|
||||
{
|
||||
$fileModel = app(File::class);
|
||||
$titlePhoto = isset($input['titlePhotoFile']) ? $input['titlePhotoFile'] : null;
|
||||
|
||||
// upload file - if provided
|
||||
$page->titlePhoto = isset($input['existingTitlePhoto']) ? $input['existingTitlePhoto'] : null;
|
||||
|
||||
if (!is_null($titlePhoto)) {
|
||||
$file = $fileModel->upload($titlePhoto);
|
||||
|
||||
$page->titlePhoto = $file ? $file['filename'] : null;
|
||||
}
|
||||
|
||||
$page->save();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
namespace App\CMS\Pipeline\SavePipeline;
|
||||
|
||||
use App\CMS\Contracts\Content\SavePipeline\Pipeline;
|
||||
use App\CMS\Contracts\Content\SavePipeline\Process;
|
||||
use App\CMS\Pipeline\AbstractPipeline;
|
||||
use App\Models\Content\Content;
|
||||
|
||||
class SavePipeline extends AbstractPipeline implements Pipeline
|
||||
{
|
||||
/**
|
||||
* SavePipeline constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->acceptedProcessInterface = Process::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save content page
|
||||
*
|
||||
* @param Content $page
|
||||
* @param array $input
|
||||
*
|
||||
* @return Content
|
||||
*/
|
||||
function run(Content & $page, array $input)
|
||||
{
|
||||
$this->runBeforeStart($page, $input);
|
||||
|
||||
foreach ($this->processes as $process) {
|
||||
/**
|
||||
* @var $run Process
|
||||
*/
|
||||
$run = new $process;
|
||||
$run->handle($page, $input);
|
||||
}
|
||||
|
||||
$this->runAfter($page, $input);
|
||||
|
||||
return $page;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run process as first - if specified
|
||||
*
|
||||
* @param Content $page
|
||||
* @param array $input
|
||||
*/
|
||||
protected function runBeforeStart(Content $page, array $input)
|
||||
{
|
||||
if (!is_null($this->beforeStart)) {
|
||||
app($this->beforeStart)->handle($page, $input);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Run some process in the end - if exists
|
||||
*
|
||||
* @param Content $page
|
||||
* @param array $input
|
||||
*/
|
||||
protected function runAfter(Content $page, array $input)
|
||||
{
|
||||
if (!is_null($this->beforeRender)) {
|
||||
app($this->beforeRender)->handle($page, $input);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,7 +46,7 @@ class Content extends Repository implements IContent
|
||||
public function all()
|
||||
{
|
||||
return $this->getPageQuery()
|
||||
->get();
|
||||
->get();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,7 +63,7 @@ class Content extends Repository implements IContent
|
||||
$page->status = IContent::STATUS_DRAFT;
|
||||
$page->moduleSettings = [];
|
||||
} else {
|
||||
$page = $this->model->findOrFail($id);
|
||||
$page = $this->model->findOrFail($id);
|
||||
}
|
||||
|
||||
return $page;
|
||||
@@ -76,9 +76,8 @@ class Content extends Repository implements IContent
|
||||
public function getHomepage()
|
||||
{
|
||||
return $this->getPageQuery()
|
||||
->where('isHomepage', 1)
|
||||
->first();
|
||||
|
||||
->where('isHomepage', 1)
|
||||
->first();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,8 +90,8 @@ class Content extends Repository implements IContent
|
||||
public function getByURL($url)
|
||||
{
|
||||
return $this->getPageQuery()
|
||||
->where('url', $url)
|
||||
->first();
|
||||
->where('url', $url)
|
||||
->first();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -126,8 +125,6 @@ class Content extends Repository implements IContent
|
||||
$query = $query->whereIn('contents.status', $statuses);
|
||||
}
|
||||
|
||||
$pages = $query->paginate(setting('paginatedResults', 20));
|
||||
|
||||
return $pages;
|
||||
return $query;
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ class Widget
|
||||
$widget->name = $data['name'];
|
||||
$widget->description = $data['description'];
|
||||
$widget->container_class = $data['containerClass'];
|
||||
$widget->container_id = $data['containerId'];
|
||||
$widget->container_id = empty($data['containerId']) ? null : $data['containerId'];
|
||||
$widget->settings = json_encode(call_user_func([$widgetType->handler, 'save'], $request));
|
||||
|
||||
// save into database
|
||||
|
||||
@@ -107,7 +107,8 @@ class Menu implements WidgetRenderer
|
||||
$content = App::make(ContentContract::class);
|
||||
|
||||
// get list of all pages
|
||||
$pages = $content->getOverview();
|
||||
$pages = $content->getOverview()
|
||||
->get();
|
||||
|
||||
// make object from JSON
|
||||
if (!isset($widget->settings->links)) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use App\Models\WidgetArea;
|
||||
use App\Models\Widgets\WidgetArea;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class DeleteWidgetArea extends Event
|
||||
@@ -20,7 +20,6 @@ class DeleteWidgetArea extends Event
|
||||
*/
|
||||
public function __construct(WidgetArea $widgetArea)
|
||||
{
|
||||
//
|
||||
$this->widgetArea = $widgetArea;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,8 @@ class ContentOverview extends Controller
|
||||
|
||||
// get pages for overview
|
||||
$handler = $module !== null ? $module->handler : null;
|
||||
$pages = $this->content->getOverview($handler, [$status]);
|
||||
$pages = $this->content->getOverview($handler, [$status])
|
||||
->paginate(setting('paginatedResults', 20));
|
||||
|
||||
// get homepage - for checking if homepage is set and available
|
||||
$homepage = $this->content->getHomepage();
|
||||
|
||||
@@ -4,13 +4,13 @@ namespace App\Http\Controllers\Admin\Contents;
|
||||
use App\CMS\Contracts\Repositories\Content as IContent;
|
||||
use App\CMS\Contracts\Repositories\Module as IModuleRepository;
|
||||
use App\CMS\Contracts\Repositories\Template as ITemplate;
|
||||
use Modules\Categories\Contracts\Repositories\Category as ICategory;
|
||||
use App\CMS\Enumerations\ContentStatuses;
|
||||
use App\Cms\Handlers\Interactions\Interaction;
|
||||
use App\Cms\Interactions\Admin\Content\NewContent;
|
||||
use App\Http\Controllers\Admin\Controller;
|
||||
use App\Http\Requests\CreateNewContentRequest;
|
||||
use App\Http\Requests\Request;
|
||||
use Modules\Categories\Contracts\Repositories\Category as ICategory;
|
||||
|
||||
/**
|
||||
* Class CreateNewContent
|
||||
@@ -85,7 +85,8 @@ class CreateNewContent extends Controller
|
||||
'module' => $module,
|
||||
'categories' => $categories,
|
||||
'page' => $page,
|
||||
'rootPages' => $this->content->getOverview(),
|
||||
'rootPages' => $this->content->getOverview()
|
||||
->get(),
|
||||
'formSectionNames' => call_user_func([$module->handler, 'getExtendedFormSections']),
|
||||
'formSections' => call_user_func([$module->handler, 'getExtendedFormInputsCreate']),
|
||||
]);
|
||||
@@ -103,11 +104,8 @@ class CreateNewContent extends Controller
|
||||
{
|
||||
$module = $this->module->getOne($moduleId);
|
||||
|
||||
$titlePhoto = $request->file('titlePhoto');
|
||||
$relatedFiles = $request->all()['files'];
|
||||
|
||||
// create new page
|
||||
Interaction::handle(NewContent::class, $request->all(), $module->handler, $titlePhoto, $relatedFiles);
|
||||
Interaction::handle(NewContent::class, $request->all(), $module->handler);
|
||||
|
||||
return redirect()
|
||||
->route('content.overview')
|
||||
|
||||
@@ -87,9 +87,6 @@ class EditContent extends Controller
|
||||
$categories = $this->category->getForModule($module);
|
||||
$history = $this->history->getStructuredHistoryOf($page);
|
||||
|
||||
// modify data for edit form according to installed template
|
||||
CurrentTemplate::beforePopulatingEditForm($page);
|
||||
|
||||
// render view
|
||||
return view('admin.content.edit', [
|
||||
'pageHeading' => $pageHeading,
|
||||
@@ -97,7 +94,7 @@ class EditContent extends Controller
|
||||
'page' => $page,
|
||||
'module' => $module,
|
||||
'categories' => $categories,
|
||||
'rootPages' => $this->content->getOverview(),
|
||||
'rootPages' => $this->content->getOverview()->get(),
|
||||
'templates' => $templates,
|
||||
'formSectionNames' => $this->module->call($module, 'getExtendedFormSections'),
|
||||
'formSections' => $this->module->call($module, 'getExtendedFormInputsEdit'),
|
||||
@@ -132,10 +129,7 @@ class EditContent extends Controller
|
||||
}
|
||||
|
||||
// edit page
|
||||
$titlePhoto = $request->file('titlePhoto');
|
||||
$relatedFiles = $request->all()['files'];
|
||||
|
||||
Interaction::handle(EditContentInteraction::class, $request->all(), $page, $titlePhoto, $relatedFiles);
|
||||
Interaction::handle(EditContentInteraction::class, $request->all(), $page);
|
||||
|
||||
// something was changed, inform user
|
||||
return redirect()
|
||||
|
||||
@@ -12,6 +12,21 @@ use Illuminate\Support\Facades\File;
|
||||
|
||||
class EditTemplate extends Controller
|
||||
{
|
||||
/**
|
||||
* @var TemplateRepositoryContract
|
||||
*/
|
||||
private $templateRepository;
|
||||
|
||||
/**
|
||||
* EditTemplate constructor.
|
||||
*
|
||||
* @param TemplateRepositoryContract $templateRepository
|
||||
*/
|
||||
public function __construct(TemplateRepositoryContract $templateRepository)
|
||||
{
|
||||
$this->templateRepository = $templateRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render form for editing template
|
||||
*
|
||||
@@ -26,11 +41,10 @@ class EditTemplate extends Controller
|
||||
*/
|
||||
$template = Template::findOrFail($template);
|
||||
|
||||
$repo = app(TemplateRepositoryContract::class);
|
||||
$repo->setModel($template);
|
||||
$this->templateRepository->setModel($template);
|
||||
|
||||
// load template content
|
||||
$absolutePath = $repo->getPathToTemplate();
|
||||
$absolutePath = $this->templateRepository->getPathToTemplate();
|
||||
$content = @file_get_contents($absolutePath);
|
||||
|
||||
return view('admin.templates.edit', [
|
||||
@@ -78,9 +92,11 @@ class EditTemplate extends Controller
|
||||
*/
|
||||
private function saveContent(Template $template, EditTemplateRequest $request)
|
||||
{
|
||||
$this->templateRepository->setModel($template);
|
||||
|
||||
// get templates with paths
|
||||
$originalTemplate = $template->getPathToTemplate();
|
||||
$customTemplate = $template->getPathToTemplate(Template::CUSTOM_EDIT_DIRECTORY);
|
||||
$originalTemplate = $this->templateRepository->getPathToTemplate();
|
||||
$customTemplate = $this->templateRepository->getPathToTemplate(TemplateRepositoryContract::CUSTOM_EDIT_DIRECTORY);
|
||||
|
||||
// get paths
|
||||
$originalDir = dirname($originalTemplate);
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Http\Controllers\Visitor;
|
||||
|
||||
use App\CMS\Contracts\Repositories\Content;
|
||||
use App\CMS\Helpers\PageRenderer;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Content\Content as ContentModel;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
@@ -24,11 +23,20 @@ class ContentPage extends Controller
|
||||
$this->content = $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load page by URL
|
||||
*
|
||||
* This method also caches content
|
||||
*
|
||||
* @param $url
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getPage($url)
|
||||
{
|
||||
$contentModel = $this->content;
|
||||
$page = Cache::remember('content-' . $url, setting('contentCacheLifetime', 5), function () use ($contentModel, $url) {
|
||||
return $contentModel->getByURL($url);
|
||||
$contentRepository = $this->content;
|
||||
$page = Cache::remember('content-' . $url, setting('contentCacheLifetime', 5), function () use ($contentRepository, $url) {
|
||||
return $contentRepository->getByURL($url);
|
||||
});
|
||||
|
||||
// no page available
|
||||
@@ -54,9 +62,10 @@ class ContentPage extends Controller
|
||||
abort(404);
|
||||
}
|
||||
|
||||
// add one new "view" for page
|
||||
$page->view();
|
||||
$displayPipeline = app('displayPipeline');
|
||||
$page = $displayPipeline->run($page);
|
||||
|
||||
return Controller::VisitorsView($page->template, ['page' => $page]);
|
||||
|
||||
return PageRenderer::render($page);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ use Modules\Categories\Entities\Category;
|
||||
*/
|
||||
class Content extends Model
|
||||
{
|
||||
use SoftDeletes, ModelTraits\Content, Nullable;
|
||||
use SoftDeletes, Nullable;
|
||||
public $timestamps = true;
|
||||
protected $fillable = [
|
||||
'userId',
|
||||
|
||||
@@ -10,7 +10,7 @@ trait ContentHistory
|
||||
/**
|
||||
* Returns history grouped by revisions (edit_batches)
|
||||
*
|
||||
* @param Content $content
|
||||
* @param ContentModel $content
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
||||
@@ -13,6 +13,13 @@ use App\CMS\Handlers\Search\Content;
|
||||
use App\CMS\Handlers\Search\Files;
|
||||
use App\CMS\Handlers\Search\Presenters\AdminContent as AdminContentPresenter;
|
||||
use App\CMS\Handlers\Search\Presenters\AdminFiles;
|
||||
use App\CMS\Pipeline\DisplayPipeline\DisplayPipeline;
|
||||
use App\CMS\Pipeline\DisplayPipeline\Process\AddViewedToPage;
|
||||
use App\CMS\Pipeline\DisplayPipeline\Process\CompileShortcodes;
|
||||
use App\CMS\Pipeline\SavePipeline\Process\SaveCommonFields;
|
||||
use App\CMS\Pipeline\SavePipeline\Process\UploadRelatedFiles;
|
||||
use App\CMS\Pipeline\SavePipeline\Process\UploadTitlePhoto;
|
||||
use App\CMS\Pipeline\SavePipeline\SavePipeline;
|
||||
use App\CMS\Repositories\Content\Content as ContentRepository;
|
||||
use App\CMS\Repositories\Module as ModuleRepository;
|
||||
use App\CMS\Repositories\Templates\Template as TemplateRepository;
|
||||
@@ -41,6 +48,8 @@ class AppServiceProvider extends ServiceProvider
|
||||
$this->registerWidgets();
|
||||
$this->registerSettings();
|
||||
$this->registerSearch();
|
||||
$this->registerDisplayPipeline();
|
||||
$this->registerSavePipeline();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +73,16 @@ class AppServiceProvider extends ServiceProvider
|
||||
return new WidgetRegistrator($app);
|
||||
});
|
||||
|
||||
// create singleton for display pipeline - pipeline used for displaying visitor pages
|
||||
$this->app->singleton('displayPipeline', function ($app) {
|
||||
return new DisplayPipeline();
|
||||
});
|
||||
|
||||
// create singleton for display pipeline - pipeline used for displaying visitor pages
|
||||
$this->app->singleton('saveContentPipeline', function ($app) {
|
||||
return new SavePipeline();
|
||||
});
|
||||
|
||||
// create registrator for template directories
|
||||
$this->app->singleton('registerTemplateDir', function ($app) {
|
||||
return new TemplateRegistrator($app);
|
||||
@@ -115,4 +134,21 @@ class AppServiceProvider extends ServiceProvider
|
||||
$registrator->register(new Content(), new AdminContentPresenter(), SearchEngineRegistrator::ADMIN);
|
||||
$registrator->register(new Files(), new AdminFiles(), SearchEngineRegistrator::ADMIN);
|
||||
}
|
||||
|
||||
private function registerDisplayPipeline()
|
||||
{
|
||||
$registrator = $this->app->make('displayPipeline');
|
||||
|
||||
$registrator->add(AddViewedToPage::class);
|
||||
$registrator->add(CompileShortcodes::class);
|
||||
}
|
||||
|
||||
private function registerSavePipeline()
|
||||
{
|
||||
$pipeline = $this->app->make('saveContentPipeline');
|
||||
|
||||
$pipeline->add(SaveCommonFields::class);
|
||||
$pipeline->add(UploadTitlePhoto::class);
|
||||
$pipeline->add(UploadRelatedFiles::class);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-1
@@ -54,7 +54,10 @@ return [
|
||||
|
|
||||
*/
|
||||
|
||||
'from' => ['address' => null, 'name' => null],
|
||||
'from' => [
|
||||
'address' => env('MAIL_FROM_ADDRESS', env('MAIL_USERNAME')),
|
||||
'name' => env('MAIL_FROM_NAME', '')
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
||||
@@ -16,28 +16,6 @@ use Modules\Blog\Article\Entities\Comment;
|
||||
|
||||
class Article extends Handler implements ContentTitles, AdvancedContentModifier, InstallableModule
|
||||
{
|
||||
/**
|
||||
* Render given module into visitor area.
|
||||
*
|
||||
* @param Content $content DB model from table contents
|
||||
* @param array $parameters parameters used for modifications/custom settings of given model
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function render(Content $content, $parameters)
|
||||
{
|
||||
$content->comments = new Collection();
|
||||
if (isset($content->moduleSettings['allowComments']) && $content->moduleSettings['allowComments']) {
|
||||
$content->comments = Comment::where('content_id', $content->id)
|
||||
->with('author')
|
||||
->where('approved', 1)
|
||||
->orderBy('created_at')
|
||||
->get();
|
||||
}
|
||||
|
||||
return Controller::VisitorsView($content->template, ['page' => $content, 'extra' => $parameters]);
|
||||
}
|
||||
|
||||
public static function getExtendedFormInputsCreate()
|
||||
{
|
||||
$sections = parent::getExtendedFormInputsCreate();
|
||||
@@ -52,41 +30,6 @@ class Article extends Handler implements ContentTitles, AdvancedContentModifier,
|
||||
return self::getExtendedFormInputsCreate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save module-specific values into database
|
||||
*
|
||||
* @param Content $content
|
||||
* @param Request $request
|
||||
*
|
||||
* @return mixed|void
|
||||
*/
|
||||
public static function createNew(Content &$content, array $inputData)
|
||||
{
|
||||
$content->moduleSettings = ['allowComments' => (int)isset($inputData['allowComments'])];
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used for editing existing content page.
|
||||
*
|
||||
* Reason why it is separated from createNew() method is simple - we need to save history of changes.
|
||||
*
|
||||
* @param Content $content
|
||||
* @param Request $request
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function edit(Content $content, $request)
|
||||
{
|
||||
$settings = $content->moduleSettings;
|
||||
if (!is_object($settings))
|
||||
$settings = new \stdClass();
|
||||
|
||||
$settings->allowComments = isset($request['allowComments']) ? (int)$request['allowComments'] : 0;
|
||||
|
||||
$content->moduleSettings = $settings;
|
||||
$content->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register admin menu
|
||||
*
|
||||
@@ -198,17 +141,6 @@ class Article extends Handler implements ContentTitles, AdvancedContentModifier,
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Load some extra data for content management form?
|
||||
*
|
||||
* @param Content $content
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function loadExtraData(Content $content)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Does this module support categories?
|
||||
*
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
namespace Modules\Blog\Article\Pipeline\DisplayContent;
|
||||
|
||||
use App\CMS\Contracts\Content\DisplayPipeline\Process;
|
||||
use App\Models\Content\Content;
|
||||
use Illuminate\Support\Collection;
|
||||
use Modules\Blog\Article\Entities\Comment;
|
||||
use Modules\Blog\Article\Handlers\Article;
|
||||
|
||||
class LoadCommentsForBlogpost implements Process
|
||||
{
|
||||
/**
|
||||
* Process and modify given page
|
||||
*
|
||||
* @param Content $content
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function handle(Content & $content)
|
||||
{
|
||||
if ($content->moduleHandler != Article::class)
|
||||
return;
|
||||
|
||||
$content->comments = new Collection();
|
||||
if (isset($content->moduleSettings['allowComments']) && $content->moduleSettings['allowComments']) {
|
||||
$content->comments = Comment::where('content_id', $content->id)
|
||||
->with('author')
|
||||
->where('approved', 1)
|
||||
->orderBy('created_at')
|
||||
->get();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
namespace Modules\Blog\Article\Pipeline\SaveContent;
|
||||
|
||||
use App\CMS\Contracts\Content\SavePipeline\Process;
|
||||
use App\Models\Content\Content;
|
||||
use Modules\Blog\Article\Handlers\Article;
|
||||
|
||||
class TurnCommentsOnOrOff implements Process
|
||||
{
|
||||
/**
|
||||
* Process and modify given page
|
||||
*
|
||||
* @param Content $content
|
||||
* @param array $input
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function handle(Content & $content, array & $input)
|
||||
{
|
||||
if (trim($content->moduleHandler, '\\') !== Article::class) {
|
||||
return;
|
||||
}
|
||||
|
||||
$settings = $content->moduleSettings;
|
||||
$settings['allowComments'] = isset($input['allowComments']) ? (int)$input['allowComments'] : 0;
|
||||
$content->moduleSettings = $settings;
|
||||
$content->save();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
<?php namespace Modules\Blog\Article\Providers;
|
||||
|
||||
use App\Providers\ModuleServiceProvider;
|
||||
use Modules\Blog\Article\Pipeline\DisplayContent\LoadCommentsForBlogpost;
|
||||
use Modules\Blog\Article\Pipeline\SaveContent\TurnCommentsOnOrOff;
|
||||
|
||||
class ArticleServiceProvider extends ModuleServiceProvider
|
||||
{
|
||||
@@ -14,6 +16,11 @@ class ArticleServiceProvider extends ModuleServiceProvider
|
||||
parent::boot();
|
||||
|
||||
$this->app->register(ArticleEventServiceProvider::class);
|
||||
|
||||
// load comments for blogpost
|
||||
app('displayPipeline')->add(LoadCommentsForBlogpost::class);
|
||||
|
||||
app('saveContentPipeline')->add(TurnCommentsOnOrOff::class);
|
||||
}
|
||||
|
||||
protected function setModuleAlias()
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
<div class="card-header">
|
||||
<div class="header-block">
|
||||
<p class="title">
|
||||
<img src="@gravatar($comment->author->email, 25)" class="img-rounded" alt="">
|
||||
{{$comment->author->name}} ({{$comment->author->email}})
|
||||
<img src="@gravatar($comment->email, 25)" class="img-rounded" alt="">
|
||||
{{$comment->name}} ({{$comment->email}})
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -21,12 +21,12 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
@lang('article::comments.createdAt', ['date' => \App\CMS\Helpers\Template::date($comment->created_at)])
|
||||
@lang('article::comments.createdAt', ['date' => \App\CMS\Helpers\Date::date($comment->created_at)])
|
||||
|
|
||||
|
||||
@lang('article::comments.commentedArticle'):
|
||||
|
||||
@if($comment->article)
|
||||
@if(!is_null($comment->article))
|
||||
<a href="{{route('page.content', ['url' => $comment->article->url])}}" target="_blank">
|
||||
{{$comment->article->title}}
|
||||
</a>
|
||||
|
||||
@@ -1,18 +1,8 @@
|
||||
<?php
|
||||
namespace Modules\Blog\ArticleList\Handlers;
|
||||
|
||||
use App\CMS\Contracts\Repositories\Content as IContent;
|
||||
use App\CMS\Handlers\Handler;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Content\Content;
|
||||
use App\Models\User;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Modules\Blog\Article\Entities\Article as ArticleModel;
|
||||
use Modules\Blog\Article\Handlers\Article;
|
||||
use Modules\Categories\Entities\Category;
|
||||
|
||||
class ArticleList extends Handler
|
||||
{
|
||||
@@ -28,114 +18,7 @@ class ArticleList extends Handler
|
||||
}, 20, ['icon' => 'fa fa-fw fa-book']);
|
||||
}
|
||||
|
||||
$blogSubmenu->route('content.new', trans('articlelist::module.name'), ['id' => 'blog-articlelist'], 100, ['icon' => 'fa fa-fw fa-list-alt']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter articles on article list using archive
|
||||
*
|
||||
* @param $articles
|
||||
*/
|
||||
protected static function archive(&$articles)
|
||||
{
|
||||
$year = Input::get('y');
|
||||
$month = Input::get('m');
|
||||
$day = Input::get('d');
|
||||
|
||||
if ($year) {
|
||||
$articles = $articles->where(DB::raw('YEAR(created_at)'), $year);
|
||||
}
|
||||
|
||||
if ($month) {
|
||||
$articles = $articles->where(DB::raw('MONTH(created_at)'), $month);
|
||||
}
|
||||
|
||||
if ($day) {
|
||||
$articles = $articles->where(DB::raw('DAY(created_at)'), $day);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter article list to some specified category
|
||||
*
|
||||
* Category URL is specified as GET attribute "category"
|
||||
*
|
||||
* @param $articles
|
||||
*/
|
||||
protected static function category(&$articles)
|
||||
{
|
||||
$categoryUrl = Input::get('category');
|
||||
|
||||
$categoriesEnabled = \Module::get('Categories')
|
||||
->enabled();
|
||||
|
||||
if ($categoryUrl && $categoriesEnabled) {
|
||||
$category = Category::where('url', $categoryUrl)
|
||||
->firstOrFail();
|
||||
|
||||
$subcategories = $category->getChildren()
|
||||
->toArray();
|
||||
|
||||
$categories = [$category->id];
|
||||
$categories = array_merge($categories, array_map(function ($cat) {
|
||||
return $cat['id'];
|
||||
}, $subcategories));
|
||||
|
||||
$articles = $articles->whereIn('category_id', $categories);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render given module into visitor area.
|
||||
*
|
||||
* @param Content $content DB model from table contents
|
||||
* @param array $parameters parameters used for modifications/custom settings of given model
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function render(Content $content, $parameters)
|
||||
{
|
||||
$articles = ArticleModel::where('moduleHandler', Article::class)
|
||||
->with('comments')
|
||||
->with('category')
|
||||
->where(function ($query) {
|
||||
$query->where('publishedFrom', '<', Carbon::now())
|
||||
->orWhereNull('publishedFrom');
|
||||
})
|
||||
->where(function ($query) {
|
||||
$query->where('publishedTo', '>', Carbon::now())
|
||||
->orWhereNull('publishedTo');
|
||||
})
|
||||
->orderBy('publishedFrom', 'DESC')
|
||||
->orderBy('created_at', 'DESC');
|
||||
|
||||
// show articles for not-logged users of even for logged onew?
|
||||
$articles = !Auth::user() ? $articles->where('status', IContent::STATUS_PUBLIC) : $articles->whereIn('status', [
|
||||
IContent::STATUS_PUBLIC,
|
||||
IContent::STATUS_PROTECTED
|
||||
]);
|
||||
|
||||
// selected articles from archive?
|
||||
self::archive($articles);
|
||||
|
||||
// is given any category?
|
||||
self::category($articles);
|
||||
|
||||
// show articles only from specified user
|
||||
$author = Input::get('author');
|
||||
if ($author) {
|
||||
$user = User::findOrFail($author);
|
||||
|
||||
$articles = $articles->where('user_id', $user->id);
|
||||
}
|
||||
|
||||
$articles = $articles->paginate(setting('articlesPerPage', 20));
|
||||
|
||||
return Controller::VisitorsView($content->template, [
|
||||
'page' => $content,
|
||||
'articles' => $articles,
|
||||
'extra' => $parameters
|
||||
]);
|
||||
$blogSubmenu->route('content.new', trans('articlelist::module.name'), ['id' => config('articlelist.alias')], 100, ['icon' => 'fa fa-fw fa-list-alt']);
|
||||
}
|
||||
|
||||
public static function supportCategories()
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
namespace Modules\Blog\ArticleList\Pipeline\DisplayContent;
|
||||
|
||||
use App\CMS\Contracts\Content\DisplayPipeline\Process;
|
||||
use App\CMS\Contracts\Repositories\Content as IContent;
|
||||
use App\Models\Content\Content;
|
||||
use App\Models\User;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Modules\Blog\Article\Entities\Article as ArticleModel;
|
||||
use Modules\Blog\Article\Handlers\Article;
|
||||
use Modules\Blog\ArticleList\Handlers\ArticleList;
|
||||
|
||||
class LoadArticlesForList implements Process
|
||||
{
|
||||
/**
|
||||
* Process and modify given page
|
||||
*
|
||||
* @param Content $page
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function handle(Content & $page)
|
||||
{
|
||||
// load articles only for article list
|
||||
if ($page->moduleHandler != ArticleList::class)
|
||||
return;
|
||||
|
||||
$articles = ArticleModel::where('moduleHandler', Article::class)
|
||||
->with('comments')
|
||||
->with('category')
|
||||
->where(function ($query) {
|
||||
$query->where('publishedFrom', '<', Carbon::now())
|
||||
->orWhereNull('publishedFrom');
|
||||
})
|
||||
->where(function ($query) {
|
||||
$query->where('publishedTo', '>', Carbon::now())
|
||||
->orWhereNull('publishedTo');
|
||||
})
|
||||
->orderBy('publishedFrom', 'DESC')
|
||||
->orderBy('created_at', 'DESC');
|
||||
|
||||
// show articles for not-logged users of even for logged onew?
|
||||
$articles = !Auth::user() ? $articles->where('status', IContent::STATUS_PUBLIC) : $articles->whereIn('status', [
|
||||
IContent::STATUS_PUBLIC,
|
||||
IContent::STATUS_PROTECTED
|
||||
]);
|
||||
|
||||
// selected articles from archive?
|
||||
$this->archive($articles);
|
||||
|
||||
// is given any category?
|
||||
$this->category($articles);
|
||||
|
||||
// show articles only from specified user
|
||||
$author = Input::get('author');
|
||||
if ($author) {
|
||||
$user = User::findOrFail($author);
|
||||
|
||||
$articles = $articles->where('user_id', $user->id);
|
||||
}
|
||||
|
||||
$page->articles = $articles->paginate(setting('articlesPerPage', 20));
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter articles on article list using archive
|
||||
*
|
||||
* @param $articles
|
||||
*/
|
||||
protected function archive(&$articles)
|
||||
{
|
||||
$year = Input::get('y');
|
||||
$month = Input::get('m');
|
||||
$day = Input::get('d');
|
||||
|
||||
if ($year) {
|
||||
$articles = $articles->where(DB::raw('YEAR(created_at)'), $year);
|
||||
}
|
||||
|
||||
if ($month) {
|
||||
$articles = $articles->where(DB::raw('MONTH(created_at)'), $month);
|
||||
}
|
||||
|
||||
if ($day) {
|
||||
$articles = $articles->where(DB::raw('DAY(created_at)'), $day);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter article list to some specified category
|
||||
*
|
||||
* Category URL is specified as GET attribute "category"
|
||||
*
|
||||
* @param $articles
|
||||
*/
|
||||
protected function category(&$articles)
|
||||
{
|
||||
$categoryUrl = Input::get('category');
|
||||
|
||||
$categoriesEnabled = \Module::get('Categories')
|
||||
->enabled();
|
||||
|
||||
if ($categoryUrl && $categoriesEnabled) {
|
||||
$category = Category::where('url', $categoryUrl)
|
||||
->firstOrFail();
|
||||
|
||||
$subcategories = $category->getChildren()
|
||||
->toArray();
|
||||
|
||||
$categories = [$category->id];
|
||||
$categories = array_merge($categories, array_map(function ($cat) {
|
||||
return $cat['id'];
|
||||
}, $subcategories));
|
||||
|
||||
$articles = $articles->whereIn('category_id', $categories);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php namespace Modules\Blog\ArticleList\Providers;
|
||||
|
||||
use App\Providers\ModuleServiceProvider;
|
||||
use Modules\Blog\ArticleList\Pipeline\DisplayContent\LoadArticlesForList;
|
||||
|
||||
class ArticleListServiceProvider extends ModuleServiceProvider
|
||||
{
|
||||
@@ -13,4 +14,11 @@ class ArticleListServiceProvider extends ModuleServiceProvider
|
||||
{
|
||||
$this->path = __DIR__;
|
||||
}
|
||||
|
||||
public function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
app('displayPipeline')->add(LoadArticlesForList::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,47 +16,6 @@ class ContactForm extends Handler implements ContentTitles, AdvancedContentModif
|
||||
return ContactFormHistory::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save module-specific values into database
|
||||
*
|
||||
* @param Content $content
|
||||
* @param array $inputData
|
||||
*
|
||||
* @return mixed|void
|
||||
*/
|
||||
public static function createNew(Content &$content, array $inputData)
|
||||
{
|
||||
$settings = [
|
||||
'phone' => $inputData['phone'],
|
||||
'email' => $inputData['email'],
|
||||
'contactEmail' => $inputData['contactEmail'],
|
||||
'subject' => $inputData['subject'],
|
||||
'companyName' => $inputData['companyName'],
|
||||
'address' => $inputData['address'],
|
||||
'gpsLat' => $inputData['gpsLat'],
|
||||
'gpsLng' => $inputData['gpsLng'],
|
||||
];
|
||||
|
||||
// save settings
|
||||
$content->moduleSettings = $settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used for editing existing content page.
|
||||
*
|
||||
* Reason why it is separated from createNew() method is simple - we need to save history of changes.
|
||||
*
|
||||
* @param Content $content
|
||||
* @param $request
|
||||
*
|
||||
* @return mixed|void
|
||||
*/
|
||||
public static function edit(Content $content, $request)
|
||||
{
|
||||
self::createNew($content, $request);
|
||||
$content->save();
|
||||
}
|
||||
|
||||
public static function getModuleId()
|
||||
{
|
||||
$handler = config('contactform.handler');
|
||||
@@ -190,15 +149,4 @@ class ContactForm extends Handler implements ContentTitles, AdvancedContentModif
|
||||
public static function delete(Content $content)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Load some extra data for content management form?
|
||||
*
|
||||
* @param Content $content
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function loadExtraData(Content $content)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
namespace Modules\ContactForm\Pipeline\SavePipeline;
|
||||
|
||||
use App\CMS\Contracts\Content\SavePipeline\Process;
|
||||
use App\Models\Content\Content;
|
||||
use Modules\ContactForm\Handlers\ContactForm;
|
||||
|
||||
class SaveContactInformation implements Process
|
||||
{
|
||||
/**
|
||||
* Process and modify given page
|
||||
*
|
||||
* @param Content $page
|
||||
* @param array $input
|
||||
*
|
||||
* @return void>
|
||||
*/
|
||||
function handle(Content & $page, array & $input)
|
||||
{
|
||||
if (trim($page->moduleHandler, '\\') != ContactForm::class) {
|
||||
return;
|
||||
}
|
||||
|
||||
$settings = [
|
||||
'phone' => $input['phone'],
|
||||
'email' => $input['email'],
|
||||
'contactEmail' => $input['contactEmail'],
|
||||
'subject' => $input['subject'],
|
||||
'companyName' => $input['companyName'],
|
||||
'address' => $input['address'],
|
||||
'gpsLat' => $input['gpsLat'],
|
||||
'gpsLng' => $input['gpsLng'],
|
||||
];
|
||||
|
||||
// save settings
|
||||
$page->moduleSettings = $settings;
|
||||
$page->save();
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
use App\Providers\ModuleServiceProvider;
|
||||
use Modules\ContactForm\Handlers\ContactForm;
|
||||
use Modules\ContactForm\Pipeline\SavePipeline\SaveContactInformation;
|
||||
use Modules\ContactForm\Widgets\Address\Address;
|
||||
use Modules\ContactForm\Widgets\Form\Form;
|
||||
|
||||
@@ -16,6 +17,8 @@ class ContactFormServiceProvider extends ModuleServiceProvider
|
||||
{
|
||||
parent::boot();
|
||||
$this->registerWidgets();
|
||||
|
||||
app('saveContentPipeline')->add(SaveContactInformation::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -77,26 +77,26 @@
|
||||
@lang('contactform::admin/content.email')
|
||||
</label>
|
||||
|
||||
<input class="form-control" type="email" name="email" value="{{$page->moduleSettings->email or ""}}" />
|
||||
<input class="form-control" type="email" name="email" value="{{$page->moduleSettings['email'] or ''}}" />
|
||||
|
||||
<label class="label-control">
|
||||
@lang('contactform::admin/content.phone')
|
||||
</label>
|
||||
|
||||
<input class="form-control" type="tel" name="phone" value="{{$page->moduleSettings->phone or ""}}" />
|
||||
<input class="form-control" type="tel" name="phone" value="{{$page->moduleSettings['phone'] or ''}}" />
|
||||
|
||||
<label class="label-control">
|
||||
@lang('contactform::admin/content.compName')
|
||||
</label>
|
||||
|
||||
<input class="form-control" type="text" name="companyName"
|
||||
value="{{$page->moduleSettings->companyName or ""}}" />
|
||||
value="{{$page->moduleSettings['companyName'] or ''}}" />
|
||||
|
||||
<label class="label-control">
|
||||
@lang('contactform::admin/content.address')
|
||||
</label>
|
||||
|
||||
<textarea rows="3" class="form-control" name="address">{{$page->moduleSettings->address or ""}}</textarea>
|
||||
<textarea rows="3" class="form-control" name="address">{{$page->moduleSettings['address'] or ''}}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="column col-lg-6">
|
||||
@@ -105,14 +105,14 @@
|
||||
</label>
|
||||
|
||||
<input class="form-control" type="email" name="contactEmail"
|
||||
value="{{$page->moduleSettings->contactEmail or \Auth::user()->email}}" />
|
||||
value="{{$page->moduleSettings['contactEmail'] or \Auth::user()->email}}" />
|
||||
|
||||
<label class="label-control">
|
||||
@lang('contactform::admin/content.subject')
|
||||
</label>
|
||||
|
||||
<input class="form-control" type="text" name="subject"
|
||||
value="{{$page->moduleSettings->subject or trans('contactform::admin/content.defaultSubject')}}" />
|
||||
value="{{$page->moduleSettings['subject'] or trans('contactform::admin/content.defaultSubject')}}" />
|
||||
|
||||
<div class="row">
|
||||
<div class="column col-lg-6">
|
||||
@@ -120,7 +120,7 @@
|
||||
@lang('contactform::admin/content.gpsLat')
|
||||
</label>
|
||||
|
||||
<input class="form-control" type="text" value="{{$page->moduleSettings->gpsLat or ""}}"
|
||||
<input class="form-control" type="text" value="{{$page->moduleSettings['gpsLat'] or ''}}"
|
||||
name="gpsLat" />
|
||||
</div>
|
||||
<div class="column col-lg-6">
|
||||
@@ -128,7 +128,7 @@
|
||||
@lang('contactform::admin/content.gpsLng')
|
||||
</label>
|
||||
|
||||
<input class="form-control" type="text" value="{{$page->moduleSettings->gpsLng or ""}}"
|
||||
<input class="form-control" type="text" value="{{$page->moduleSettings['gpsLng'] or ''}}"
|
||||
name="gpsLng" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
<p>
|
||||
<strong>Ahoj {{$data->name}}</strong>
|
||||
</p>
|
||||
{{$data->message}}
|
||||
@@ -24,15 +24,15 @@ class Presenter implements WidgetRenderer
|
||||
if (!$form)
|
||||
return null;
|
||||
|
||||
$formData = json_decode($form->moduleSettings);
|
||||
$formData = $form->moduleSettings;
|
||||
|
||||
$code = '<div class="address-widget ' . e($widget->container_class) . '"';
|
||||
if ($widget->container_id) {
|
||||
$code .= ' id="' . e($widget->container_id).'"';
|
||||
}
|
||||
$code .= '>';
|
||||
$code .= "<p class='name'>".e($formData->companyName).'</p>';
|
||||
$code .= nl2br($formData->address);
|
||||
$code .= "<p class='name'>".e($formData['companyName']).'</p>';
|
||||
$code .= nl2br($formData['address']);
|
||||
$code .= "</div>";
|
||||
|
||||
return $code;
|
||||
|
||||
@@ -1,59 +1,59 @@
|
||||
<?php
|
||||
return [
|
||||
"actions" => "Akce",
|
||||
"alreadyHomepage" => "Domovská stránka",
|
||||
"appearance" => "Vzhled",
|
||||
"basicInfo" => "Základní informace",
|
||||
"category" => "Kategorie",
|
||||
"content" => "Obsah stránky",
|
||||
"createdAt" => "Vytvořeno",
|
||||
"deletePage" => "Smazat",
|
||||
"deleteTitlePhoto" => "Smazat titulní obrázek",
|
||||
"edit" => "Editace :name",
|
||||
"editPlain" => "Editace",
|
||||
"field_meta_description" => "Popis stránky",
|
||||
"field_meta_keywords" => "Klíčová slova",
|
||||
"field_published_from" => "Publikováno od",
|
||||
"field_published_to" => "Publikováno do",
|
||||
"field_title" => "Titulek stránky",
|
||||
"field_url" => "URL",
|
||||
"files" => "Soubory",
|
||||
"homepage" => "Domovská stránka",
|
||||
"homepageProtected" => "Domovská stránka je zobrazena jen pro přihlášené uživatele. Toto může i nemusí být chyba.",
|
||||
"homepageSetup" => "Domovská stránka úspěšně nastavena.",
|
||||
"invalidPage" => "Požadovaná stránka neexistuje.",
|
||||
"invalidStatus" => "Nelze změnit stav stránky na něco nedefinovaného.",
|
||||
"invalidTemplateSelected" => "Není zvolena šablona pro vykreslení stránky! Stránka nebude pro návštěvníky vykreslena!",
|
||||
"lockUrl" => "Zamknout URL?",
|
||||
"makeDraft" => "Převést na koncept",
|
||||
"makeProtected" => "Zobrazit jen pro přihlášené",
|
||||
"makePublic" => "Publikovat",
|
||||
"metaOptions" => "Meta informace",
|
||||
"moduleName" => "Modul",
|
||||
"new" => "Vytvořit nový :name",
|
||||
"noCategory" => "-- Žádná kategorie --",
|
||||
"noHomepage" => "Domovská stránka není nastavena (a nebo je nastavena jako Koncept)! Vyberte prosím jinou stránku, nebo stávající publikujte.",
|
||||
"noPagesAvailable" => "Nejsou dostupné žádné stránky. Pro zobrazení přehledu nejprve nějakou vytvořte.",
|
||||
"noParentPage" => "-- Nadřazená stránka nevybrána --",
|
||||
"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.",
|
||||
"parentPage" => "Nadřazená stránka",
|
||||
"publicationOptions" => "Nastavení publikace",
|
||||
"save" => "Uložit",
|
||||
"setHomepage" => "Nastavit jako domovskou stránku",
|
||||
"showHistory" => "Historie (:count)",
|
||||
"status" => "Stav",
|
||||
"statusChanged" => "Stav úspěšně změněn.",
|
||||
"status_deleted" => "Smazáno",
|
||||
"status_draft" => "Koncept",
|
||||
"status_protected" => "Jen pro přihlášené",
|
||||
"status_public" => "Veřejné",
|
||||
"successfullyCreated" => "Stránka úspěšně vytvořena",
|
||||
"successfullyEdited" => "Úprava úspěšně uložena.",
|
||||
"template" => "Šablona pro tuto stránku",
|
||||
"title" => "Titulek",
|
||||
"uploadTitleImage" => "Nahrát titulní obrázek",
|
||||
"viewPage" => "Zobrazit",
|
||||
"actions" => "Akce",
|
||||
"alreadyHomepage" => "Domovská stránka",
|
||||
"appearance" => "Vzhled",
|
||||
"basicInfo" => "Základní informace",
|
||||
"category" => "Kategorie",
|
||||
"content" => "Obsah stránky",
|
||||
"createdAt" => "Vytvořeno",
|
||||
"deletePage" => "Smazat",
|
||||
"deleteTitlePhoto" => "Smazat titulní obrázek",
|
||||
"edit" => "Editace :name",
|
||||
"editPlain" => "Editace",
|
||||
"field_meta_description" => "Popis stránky",
|
||||
"field_meta_keywords" => "Klíčová slova",
|
||||
"field_published_from" => "Publikováno od",
|
||||
"field_published_to" => "Publikováno do",
|
||||
"field_title" => "Titulek stránky",
|
||||
"field_url" => "URL",
|
||||
"files" => "Soubory",
|
||||
"homepage" => "Domovská stránka",
|
||||
"homepageProtected" => "Domovská stránka je zobrazena jen pro přihlášené uživatele. Toto může i nemusí být chyba.",
|
||||
"homepageSetup" => "Domovská stránka úspěšně nastavena.",
|
||||
"invalidPage" => "Požadovaná stránka neexistuje.",
|
||||
"invalidStatus" => "Nelze změnit stav stránky na něco nedefinovaného.",
|
||||
"invalidTemplateSelected" => "Není zvolena šablona pro vykreslení stránky! Stránka nebude pro návštěvníky vykreslena!",
|
||||
"lockUrl" => "Zamknout URL?",
|
||||
"makeDraft" => "Převést na koncept",
|
||||
"makeProtected" => "Zobrazit jen pro přihlášené",
|
||||
"makePublic" => "Publikovat",
|
||||
"metaOptions" => "Meta informace",
|
||||
"moduleName" => "Modul",
|
||||
"new" => "Vytvořit nový :name",
|
||||
"noCategory" => "-- Žádná kategorie --",
|
||||
"noHomepage" => "Domovská stránka není nastavena (a nebo je nastavena jako Koncept)! Vyberte prosím jinou stránku, nebo stávající publikujte.",
|
||||
"noPagesAvailable" => "Nejsou dostupné žádné stránky. Pro zobrazení přehledu nejprve nějakou vytvořte.",
|
||||
"noParentPage" => "-- Nadřazená stránka nevybrána --",
|
||||
"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.",
|
||||
"parentPage" => "Nadřazená stránka",
|
||||
"publicationOptions" => "Nastavení publikace",
|
||||
"save" => "Uložit",
|
||||
"setHomepage" => "Nastavit jako domovskou stránku",
|
||||
"showHistory" => "Historie (:count)",
|
||||
"status" => "Stav",
|
||||
"statusChanged" => "Stav úspěšně změněn.",
|
||||
"status_deleted" => "Smazáno",
|
||||
"status_draft" => "Koncept",
|
||||
"status_protected" => "Jen pro přihlášené",
|
||||
"status_public" => "Veřejné",
|
||||
"successfullyCreated" => "Stránka úspěšně vytvořena",
|
||||
"successfullyEdited" => "Úprava úspěšně uložena.",
|
||||
"template" => "Šablona pro tuto stránku",
|
||||
"title" => "Titulek",
|
||||
"uploadTitleImage" => "Nahrát titulní obrázek",
|
||||
"viewPage" => "Zobrazit",
|
||||
];
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
<label class="control-label">
|
||||
@lang('admin/contents.uploadTitleImage')
|
||||
</label>
|
||||
<input type="file" id="titlePhoto" accept=".jpg,.jpeg,.png" name="titlePhoto" class="form-control" />
|
||||
<input type="file" id="titlePhotoFile" accept=".jpg,.jpeg,.png" name="titlePhotoFile" class="form-control" />
|
||||
|
||||
@include('admin.snippets.hasError', ['field' => 'titlePhoto'])
|
||||
@include('admin.snippets.hasError', ['field' => 'titlePhotoFile'])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -34,6 +34,10 @@
|
||||
|
||||
<select class="form-control" name="template">
|
||||
@foreach($templates as $template)
|
||||
@if(\Illuminate\Support\Str::contains($template->template_name, '_partials' ))
|
||||
@continue
|
||||
@endif
|
||||
|
||||
<option value="{{$template->template_name}}"
|
||||
@if(old('template', $page->template) == $template->template_name) selected @endif>
|
||||
{{$template->name}}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<label class="control-label">
|
||||
@lang('admin/contents.field_publishedFrom')
|
||||
@lang('admin/contents.field_published_from')
|
||||
</label>
|
||||
|
||||
<input type="datetime" class="form-control" name="publishedFrom" value="{{old('publishedFrom', $page->publishedFrom)}}"
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
<div class="col-lg-6">
|
||||
<label class="control-label">
|
||||
@lang('admin/contents.field_publishedTo')
|
||||
@lang('admin/contents.field_published_to')
|
||||
</label>
|
||||
|
||||
<input type="datetime" class="form-control" name="publishedTo" value="{{old('publishedTo', $page->publishedTo)}}"
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
height: 550,
|
||||
removePlugins: 'about,scayt', //elementspath
|
||||
extraPlugins: 'justify',
|
||||
enterMode: CKEDITOR.ENTER_DIV,
|
||||
enterMode: CKEDITOR.ENTER_P,
|
||||
toolbarGroups: [
|
||||
{name: 'undo', groups: ['undo']},
|
||||
{name: 'styles'},
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
namespace Templates\Base\OnePage\Http\Controllers\Admin;
|
||||
|
||||
use App\CMS\Contracts\Repositories\Content as IContent;
|
||||
use App\CMS\Helpers\Settings;
|
||||
use App\Http\Controllers\Admin\Controller;
|
||||
use App\CMS\Contracts\Repositories\Content as IContent;
|
||||
use App\Models\Settings as SettingsModel;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
|
||||
@@ -41,7 +41,8 @@ class SetHomepage extends Controller
|
||||
$usedPagesIds = (array)Settings::getJson(OnePage::HOMEPAGE_PAGES_SETTINGS_KEY);
|
||||
|
||||
// get all pages - they will be separated for used and not used on next lines
|
||||
$allPages = $this->content->getOverview();
|
||||
$allPages = $this->content->getOverview()
|
||||
->get();
|
||||
|
||||
// separate pages to used and not used - with help of $usedPAgesIds array defined above
|
||||
$pages = $used = $notUsed = [];
|
||||
|
||||
@@ -6,10 +6,7 @@ use App\Models\Content\Content;
|
||||
use App\Models\Module;
|
||||
use App\Models\User;
|
||||
use App\Models\Widgets\WidgetArea;
|
||||
use Templates\Binarity\Shortcodes\DarkBlock;
|
||||
use Templates\Binarity\Shortcodes\TechnologiesWrapper;
|
||||
use Templates\Binarity\Shortcodes\Technology;
|
||||
use Webwizo\Shortcodes\Facades\Shortcode;
|
||||
|
||||
|
||||
class Handler implements TemplateHandler
|
||||
{
|
||||
@@ -85,37 +82,4 @@ class Handler implements TemplateHandler
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare Content object to be rendered using Blade template
|
||||
*
|
||||
* @param Content $content
|
||||
*/
|
||||
public static function beforeRender(Content & $content)
|
||||
{
|
||||
Shortcode::register('technologies', TechnologiesWrapper::class);
|
||||
Shortcode::register('tech', Technology::class);
|
||||
Shortcode::register('dark', DarkBlock::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify input data into format which can be understood by edit template
|
||||
*
|
||||
* @param Content $content
|
||||
*/
|
||||
public static function beforePopulatingEditForm(Content & $content)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Slightly modify Content object before saving into database.
|
||||
*
|
||||
* This way we can do almost whatever we want - even in template
|
||||
*
|
||||
* @param Content $content
|
||||
* @param $request
|
||||
*/
|
||||
public static function beforeSave(Content & $content, $inputData)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
namespace Templates\Binarity\Providers;
|
||||
|
||||
use Templates\Binarity\Shortcodes\DarkBlock;
|
||||
use Templates\Binarity\Shortcodes\TechnologiesWrapper;
|
||||
use Templates\Binarity\Shortcodes\Technology;
|
||||
use Webwizo\Shortcodes\Facades\Shortcode;
|
||||
|
||||
class ServiceProvider extends \Illuminate\Support\ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
Shortcode::register('technologies', TechnologiesWrapper::class);
|
||||
Shortcode::register('tech', Technology::class);
|
||||
Shortcode::register('dark', DarkBlock::class);
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
{{--{!! $page->content !!}--}}
|
||||
{{--</div>--}}
|
||||
|
||||
@foreach($articles as $article)
|
||||
@foreach($page->articles as $article)
|
||||
<div class="column large-6 article-list-item">
|
||||
<div class="row">
|
||||
<aside class="column text-right large-3">
|
||||
@@ -41,8 +41,8 @@
|
||||
<footer class="text-right">
|
||||
|
||||
@if($article->category)
|
||||
<a href="./blog?category={{$article->category->url}}"><i
|
||||
class="fa fa-tag"></i> {{$article->category->name}}</a>
|
||||
<a href="./blog?category={{$article->category->url}}"><i
|
||||
class="fa fa-tag"></i> {{$article->category->name}}</a>
|
||||
@endif
|
||||
|
||||
<a href="{{route('page.content', ['url' => $article->url])}}#comments">
|
||||
@@ -53,8 +53,10 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="paginate">
|
||||
{{$articles->render()}}
|
||||
</div>
|
||||
@if (!is_null($page->articles))
|
||||
<div class="paginate">
|
||||
{{$page->articles->render()}}
|
||||
</div>
|
||||
@endif
|
||||
@endforeach
|
||||
@endsection
|
||||
@@ -12,7 +12,7 @@
|
||||
<div class="row nochange small-up-2 medium-up-3 large-up-3 xlarge-up-4" data-equalizer>
|
||||
<?php
|
||||
$counter = 0;
|
||||
$subpages = $page->subpages('contents.created_at', 'DESC');
|
||||
$subpages = $page->subpages()->orderBy('created_at', 'DESC')->get();
|
||||
?>
|
||||
@foreach($subpages as $reference)
|
||||
<?php $counter++; ?>
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
.cz</a></li>
|
||||
<li class="phone-li"><a href="tel:00420775553552">+420 775 553 552</a></li>
|
||||
<li><br></li>
|
||||
<li>© 2016 binarity s.r.o.</li>
|
||||
<li>© {{date('Y')}} binarity s.r.o.</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -140,7 +140,7 @@
|
||||
.cz</a></li>
|
||||
<li class="phone-li"><a href="tel:00420775323455">+420 775 323 455</a></li>
|
||||
<li><br></li>
|
||||
<li>© 2016 binarity s.r.o.</li>
|
||||
<li>© {{date('Y')}} binarity s.r.o.</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</footer>
|
||||
@@ -149,7 +149,7 @@
|
||||
</div>
|
||||
<script src="{{asset_path('visitor/js/jquery.min.js')}}" type="text/javascript"></script>
|
||||
<script src="{{asset_path('visitor/js/foundation.min.js')}}" type="text/javascript"></script>
|
||||
<script src="{{asset_path('visitor/js/cookie.policy.js')}}" type="text/javascript"></script>
|
||||
<script src="{{asset_path('visitor/js/cookies.js')}}" type="text/javascript"></script>
|
||||
<script src="{{asset_path('visitor/js/BLightBox.js')}}" type="text/javascript"></script>
|
||||
<script src="{{asset_path('visitor/js/app.js')}}" type="text/javascript"></script>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
return [
|
||||
'providers' => [],
|
||||
'providers' => [\Templates\Binarity\Providers\ServiceProvider::class],
|
||||
'files' => [],
|
||||
'handler' => \Templates\Binarity\Handler::class,
|
||||
'name' => 'binarity s.r.o.',
|
||||
|
||||
@@ -66,46 +66,22 @@ class Handler implements TemplateHandler
|
||||
'module' => 'StaticPages',
|
||||
'templateName' => 'staticpages::admin.templatePath'
|
||||
],
|
||||
|
||||
[
|
||||
'module' => 'ArticleList',
|
||||
'alias' => config('articlelist.alias'),
|
||||
'templateName' => 'articlelist::module.templatePath'
|
||||
],
|
||||
[
|
||||
'module' => 'Article',
|
||||
'alias' => config('articleias'),
|
||||
'templateName' => 'article::module.templatePath'
|
||||
],
|
||||
|
||||
[
|
||||
'module' => 'ContactForm',
|
||||
'templateName' => 'contactform::admin/adminMenu.templatePath'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare Content object to be rendered using Blade template
|
||||
*
|
||||
* @param Content $content
|
||||
*/
|
||||
public static function beforeRender(Content & $content)
|
||||
{
|
||||
if ($content->isHomepage) {
|
||||
$category = Category::where('url', 'trenersky-tym')
|
||||
->first();
|
||||
|
||||
$content->traineeTeamCategory = $category;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify input data into format which can be understood by edit template
|
||||
*
|
||||
* @param Content $content
|
||||
*/
|
||||
public static function beforePopulatingEditForm(Content & $content)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Slightly modify Content object before saving into database.
|
||||
*
|
||||
* This way we can do almost whatever we want - even in template
|
||||
*
|
||||
* @param Content $content
|
||||
* @param $request
|
||||
*/
|
||||
public static function beforeSave(Content & $content, $inputData)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
namespace Templates\PragueTennisCamp\Pipeline;
|
||||
|
||||
use App\CMS\Contracts\Content\DisplayPipeline\Process;
|
||||
use App\Models\Content\Content;
|
||||
use Modules\Categories\Entities\Category;
|
||||
|
||||
class AddHotelsCategory implements Process
|
||||
{
|
||||
/**
|
||||
* Process and modify given page
|
||||
*
|
||||
* @param Content $page
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function handle(Content & $page)
|
||||
{
|
||||
if ($page->template == 'staticpages::pageWithHotels') {
|
||||
$category = Category::where('url', 'hotely')
|
||||
->first();
|
||||
|
||||
$page->hotelsCategory = $category;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
namespace Templates\PragueTennisCamp\Pipeline;
|
||||
|
||||
use App\CMS\Contracts\Content\DisplayPipeline\Process;
|
||||
use App\Models\Content\Content;
|
||||
use Modules\Categories\Entities\Category;
|
||||
|
||||
class AddTraineeTeamCategory implements Process
|
||||
{
|
||||
/**
|
||||
* Process and modify given page
|
||||
*
|
||||
* @param Content $page
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function handle(Content & $page)
|
||||
{
|
||||
if ($page->template == 'staticpages::traineeTeam' || $page->isHomepage == true) {
|
||||
$category = Category::where('url', 'trenersky-tym')
|
||||
->first();
|
||||
|
||||
$page->traineeTeamCategory = $category;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,8 @@ namespace Templates\PragueTennisCamp\Providers;
|
||||
|
||||
use App\CMS\Helpers\Template;
|
||||
use Modules\ContactForm\Widgets\Form\Presenter;
|
||||
use Templates\PragueTennisCamp\Pipeline\AddHotelsCategory;
|
||||
use Templates\PragueTennisCamp\Pipeline\AddTraineeTeamCategory;
|
||||
|
||||
class ServiceProvider extends \Illuminate\Support\ServiceProvider
|
||||
{
|
||||
@@ -22,5 +24,9 @@ class ServiceProvider extends \Illuminate\Support\ServiceProvider
|
||||
}
|
||||
|
||||
Presenter::$template = Template::name('widgets.contact.form');
|
||||
|
||||
$pipeline = app('displayPipeline');
|
||||
$pipeline->add(AddTraineeTeamCategory::class);
|
||||
$pipeline->add(AddHotelsCategory::class);
|
||||
}
|
||||
}
|
||||
+117
-30
@@ -3,16 +3,44 @@
|
||||
body {
|
||||
font-family: Ubuntu;
|
||||
text-align: justify;
|
||||
background: #eef4d4 url("./images/bg.png");
|
||||
background: #EEF4D4 url("./images/bg.png");
|
||||
}
|
||||
|
||||
body.photo-bg {
|
||||
background: url("./images/clay-bg.jpg") no-repeat fixed;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4 {
|
||||
font-family: Comfortaa;
|
||||
color: #FF7F11;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #FF7F11;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #983628;
|
||||
}
|
||||
|
||||
/** HEADER **/
|
||||
header.top-bar {
|
||||
background: #3f3f37;
|
||||
background: #3F3F37;
|
||||
padding: 0;
|
||||
border-bottom: solid 1px #FF7F11;
|
||||
}
|
||||
|
||||
header.top-bar h1 {
|
||||
font-size: 100%;
|
||||
font-size: 130%;
|
||||
line-height: 38px;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
header.top-bar.centered .menu li {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
header.top-bar ul {
|
||||
@@ -23,59 +51,62 @@ header.top-bar a {
|
||||
color: white;
|
||||
}
|
||||
|
||||
header.top-bar h1 a {
|
||||
color: #FF7F11;
|
||||
}
|
||||
|
||||
.menu .active > a {
|
||||
background: #ff7f11;
|
||||
background: #FF7F11;
|
||||
}
|
||||
|
||||
.menu a:hover {
|
||||
background: #983628;
|
||||
transition: background 400ms linear;
|
||||
}
|
||||
|
||||
.logo {
|
||||
max-height: 35px;
|
||||
max-height: 25px;
|
||||
margin: 0 15px;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4 {
|
||||
font-family: Comfortaa;
|
||||
color: #ff7f11;
|
||||
}
|
||||
|
||||
|
||||
/** END HEADER **/
|
||||
|
||||
.stripe {
|
||||
padding: 50px;
|
||||
margin: 50px 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.stripe.light {
|
||||
background: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.stripe h1 {
|
||||
color: white;
|
||||
font-size: 270%;
|
||||
}
|
||||
|
||||
.stripe p {
|
||||
padding-left: 150px;
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.content-container.row {
|
||||
margin-top: 1em;
|
||||
line-height: 170%;
|
||||
padding: 1em;
|
||||
background: #FFFEF0;
|
||||
background: #F8FEF0;
|
||||
box-shadow: 0 0 10px #CBCBCB;
|
||||
border-radius: 5px 5px 0 0;
|
||||
width: 98%;
|
||||
}
|
||||
|
||||
.content-container h1 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.orbit {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
background: silver;
|
||||
}
|
||||
|
||||
.orbit-bullets {
|
||||
margin-top: -54px;
|
||||
padding-bottom: 11px;
|
||||
margin-top: -100px;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
.orbit .stripe {
|
||||
height: 20px;
|
||||
background: rgba(255,255,255, 0.2);
|
||||
background: rgba(255, 127, 17, 0.3);
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
@@ -89,26 +120,82 @@ h1, h2, h3, h4 {
|
||||
|
||||
.orbit-bottom {
|
||||
bottom: 0;
|
||||
border-bottom: solid 1px #3F3F37;
|
||||
}
|
||||
|
||||
.slow {
|
||||
transition-duration: 4500ms !important;
|
||||
transition-duration: 3500ms !important;
|
||||
}
|
||||
|
||||
.trainee-team {
|
||||
margin-top: 2em;
|
||||
}
|
||||
|
||||
.trainee-team .thumbnail {
|
||||
max-height: 150px;
|
||||
}
|
||||
|
||||
#footer {
|
||||
margin-top: 10em;
|
||||
.trainee-team p {
|
||||
line-height: 20%;
|
||||
}
|
||||
|
||||
.trainee-team ul {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.trainee-team h2, .trainee-team h3, .trainee-team h4 {
|
||||
font-size: 130%;
|
||||
}
|
||||
|
||||
.rounded {
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.title-photo img {
|
||||
border-radius: 0 0 5px 5px;
|
||||
}
|
||||
|
||||
.trainer {
|
||||
max-width: 25%;
|
||||
padding: 3px;
|
||||
border: solid 1px #CCC;
|
||||
}
|
||||
|
||||
.hotel {
|
||||
margin-top: 2em;
|
||||
}
|
||||
|
||||
.required input, .required textarea {
|
||||
float: left;
|
||||
width: calc(100% - 13px);
|
||||
}
|
||||
.required:after {
|
||||
color: red;
|
||||
content: ' *';
|
||||
float: right;
|
||||
margin-top: 4%;
|
||||
}
|
||||
|
||||
.green {
|
||||
color: #00A000;
|
||||
}
|
||||
|
||||
#footer {
|
||||
margin-bottom: 50px;
|
||||
width: 98%;
|
||||
border-top: solid 2px #FF7F11;
|
||||
background: #3F3F37;
|
||||
padding: 1em;
|
||||
border-radius: 0 0 5px 5px;
|
||||
color: #EEF4D4;
|
||||
}
|
||||
|
||||
#binarity, #binarity a {
|
||||
color: #ABA48E;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 639px) {
|
||||
.menu > li {
|
||||
display: block !important;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 616 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 115 KiB After Width: | Height: | Size: 4.3 KiB |
@@ -1,7 +1,7 @@
|
||||
$(document).foundation()
|
||||
|
||||
$ ('#formSend').click (function () {
|
||||
$ (this).value = 'Odesílám...';
|
||||
$ (this).value = '...';
|
||||
|
||||
var form = $(this).closest('form');
|
||||
|
||||
@@ -16,6 +16,6 @@ $ ('#formSend').click (function () {
|
||||
} else {
|
||||
alert (resp.message);
|
||||
}
|
||||
$ (this).value = "ODESLAT";
|
||||
$ (this).value = "Senden";
|
||||
});
|
||||
});
|
||||
+27
-8
@@ -1,16 +1,35 @@
|
||||
@if(session('success'))
|
||||
<div class="green text-center">E-mail war gesendet.</div>
|
||||
@endif
|
||||
|
||||
<form action="{{route('email.send', ['formId' => $page->id])}}" method="post">
|
||||
{!! csrf_field() !!}
|
||||
<div class="column medium-6">
|
||||
<input class="large" placeholder="jméno a příjmení" name="name" type="text">
|
||||
<div class="column required medium-4">
|
||||
<input required class="large" placeholder="Nachname" name="name" type="text">
|
||||
</div>
|
||||
<div class="column medium-6">
|
||||
<input class="large" placeholder="telefon" name="phone" type="text">
|
||||
<div class="column required medium-4">
|
||||
<input required class="large" placeholder="Vorname" name="surname" type="text">
|
||||
</div>
|
||||
<div class="column medium-12">
|
||||
<input class="large" placeholder="e-mail" name="email" type="text">
|
||||
<textarea class="large" placeholder="zpráva" name="message"></textarea>
|
||||
<div class="column required medium-4">
|
||||
<input required class="large" placeholder="E-mail" name="email" type="email">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="column required medium-4">
|
||||
<input required class="large" placeholder="Anzahl Personen" name="personCount" type="text">
|
||||
</div>
|
||||
<div class="column required medium-4">
|
||||
<input required class="large" placeholder="Anreise" name="from" type="text">
|
||||
</div>
|
||||
|
||||
<div class="column required medium-4">
|
||||
<input required class="large" placeholder="Abreise" name="to" type="text">
|
||||
</div>
|
||||
|
||||
<div class="column required medium-12">
|
||||
<textarea required class="large" placeholder="Nachricht" name="message"></textarea>
|
||||
</div>
|
||||
<div class="column medium-6 right">
|
||||
<a href="#" class="button expanded long secondary" id="formSend">ODESLAT</a>
|
||||
<button type="submit" class="button expanded long secondary" id="formSend">Senden</button>
|
||||
</div>
|
||||
</form>
|
||||
+25
-49
@@ -1,61 +1,37 @@
|
||||
@extendVisitor('defaultLayout')
|
||||
|
||||
@section('topMenu')
|
||||
@include(\App\CMS\Helpers\Template::name('commonHeader'))
|
||||
@endsection
|
||||
|
||||
@section('bodyClass', 'photo-bg')
|
||||
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="content-container">
|
||||
<div class="row content-container">
|
||||
|
||||
<div class="column text-center m-b-25 show-for-large">
|
||||
<h2>Kontakt</h2>
|
||||
<h2>{{$page->title}}</h2>
|
||||
</div>
|
||||
|
||||
<div class="large-12 column columns p-lr-0 contact-detail">
|
||||
<div class="column text-right large-4">
|
||||
<h2 class="hide-for-large">Kontakt</h2>
|
||||
<p class="contact-p green-text"><b>{{$page->moduleSettings['companyName']}}</b></p>
|
||||
<p class="contact-p">
|
||||
{!! nl2br($page->moduleSettings['address']) !!}
|
||||
<br>
|
||||
-<br>
|
||||
tel.: {{$page->moduleSettings['phone']}}<br>
|
||||
e-mail: <a href="mailto:{{$page->moduleSettings['email']}}">{{$page->moduleSettings['email']}}</a>
|
||||
</p>
|
||||
<br>
|
||||
</div>
|
||||
<div id="map" class="column large-8" style="height: 250px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column text-center large-4">
|
||||
<h2 class="hide-for-large">{{$page->title}}</h2>
|
||||
|
||||
<div class="large-12 column stripe light" id="contact-form">
|
||||
<div class="column large-12 medium-8 small-12 medium-centered p-lr-0 p-lr-15-sm">
|
||||
<h4 class="text-center uppercase m-b-25 bold">Napište nám</h4>
|
||||
<h4>{{$page->moduleSettings['companyName']}}</h4>
|
||||
|
||||
<p>
|
||||
{!! nl2br($page->moduleSettings['address']) !!}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
tel.: {{$page->moduleSettings['phone']}}<br>
|
||||
e-mail: <a href="mailto:{{$page->moduleSettings['email']}}">{{$page->moduleSettings['email']}}</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="column large-8" id="contact-form">
|
||||
@include('modules.contactform._partials.form')
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('javascripts')
|
||||
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCjADMGOysqt0ibo9mD5Cr8rs47ZQF8rKQ&callback=initMap"
|
||||
async defer></script>
|
||||
<script type="text/javascript">
|
||||
function initMap() {
|
||||
var myLatLng = {
|
||||
lat: parseFloat ('{{$page->moduleSettings['gpsLat']}}'),
|
||||
lng: parseFloat ('{{$page->moduleSettings['gpsLng']}}')
|
||||
};
|
||||
|
||||
// Create a map object and specify the DOM element for display.
|
||||
var map = new google.maps.Map (document.getElementById ('map'), {
|
||||
center: myLatLng,
|
||||
scrollwheel: false,
|
||||
zoom: 18
|
||||
});
|
||||
|
||||
// Create a marker and set its position.
|
||||
var marker = new google.maps.Marker ({
|
||||
map: map,
|
||||
position: myLatLng,
|
||||
title: '{{$page->moduleSettings['companyName']}}'
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@endsection
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
<p>Nová zpráva od {{$data->name}} {{$data->surname}}</p>
|
||||
<p>E-mail: {{$data->email}}</p>
|
||||
<p>Od: {{$data->from}}</p>
|
||||
<p>Do: {{$data->to}}</p>
|
||||
<p>Osob: {{$data->personCount}}</p>
|
||||
|
||||
<p>
|
||||
{{$data->message}}
|
||||
</p>
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
@if (isset($page->hotelsCategory))
|
||||
<div class="hotels">
|
||||
@foreach($page->hotelsCategory->content as $i => $subpage)
|
||||
<div class="row hotel">
|
||||
<div class="column large-3 medium-4">
|
||||
@if(!empty($subpage->titlePhoto))
|
||||
<img class="thumbnail" src="@thumbnail($subpage->titlePhoto)" alt="{{$subpage->title}}">
|
||||
@endif
|
||||
</div>
|
||||
<div class="column large-9 medium-8">
|
||||
<h4>
|
||||
<a href="{{route('page.content', ['url' => $subpage->url])}}">{{$subpage->title}}</a>
|
||||
</h4>
|
||||
|
||||
{!! $subpage->pageContent !!}
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
@php $images = $page->files()->where('mime_type', 'like', 'image%')->get(); @endphp
|
||||
@if(count($images) > 0)
|
||||
<div class="orbit" role="region" data-orbit
|
||||
data-options="animationDuration:3000; animInFromLeft:fade-in; animInFromRight:fade-in; animOutToLeft:fade-out; animOutToRight:fade-out;">
|
||||
<ul class="orbit-container">
|
||||
@foreach($images as $i => $image)
|
||||
<li class="orbit-slide {{$slideClass or ''}} @if($i == 0) is-active @endif">
|
||||
<img class="orbit-image" src="@upload($image->filename)" alt="" />
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
|
||||
@if(!isset($hideBullets))
|
||||
<nav class="orbit-bullets">
|
||||
@foreach($images as $i => $image)
|
||||
<button @if($i == 0) class="is-active" @endif data-slide="{{$i}}"></button>
|
||||
@endforeach
|
||||
</nav>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
@if (isset($page->traineeTeamCategory))
|
||||
<div class="text-center trainee-team">
|
||||
<h2>{{$page->traineeTeamCategory->name}}</h2>
|
||||
|
||||
@foreach($page->traineeTeamCategory->content as $i => $subpage)
|
||||
<div class="column text-center small-12 medium-{{ceil(12/count($page->traineeTeamCategory->content))}}"
|
||||
data-equalizer-watch>
|
||||
@if(empty($subpage->titlePhoto))
|
||||
<img class="thumbnail" src="@asset('visitor/images/avatar.png')" alt="{{$subpage->title}}">
|
||||
@else
|
||||
<img class="thumbnail" src="@upload($subpage->titlePhoto)" alt="{{$subpage->title}}">
|
||||
@endif
|
||||
<h4>{{$subpage->title}}</h4>
|
||||
|
||||
{!! $subpage->pageContent !!}
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
+11
-4
@@ -1,14 +1,21 @@
|
||||
@extendVisitor('defaultLayout')
|
||||
|
||||
@section('bodyClass', 'photo-bg')
|
||||
|
||||
@section('topMenu')
|
||||
@include(\App\CMS\Helpers\Template::name('commonHeader'))
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
|
||||
@if (!empty($page->titlePhoto))
|
||||
<div class="row title-photo">
|
||||
<img src="@upload($page->titlePhoto)" alt="">
|
||||
</div>
|
||||
@endif
|
||||
<div class="row content-container">
|
||||
<h1>{{$page->title}}</h1>
|
||||
|
||||
{!! $page->pageContent !!}
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@endsection
|
||||
+25
-40
@@ -1,50 +1,35 @@
|
||||
@extendVisitor('defaultLayout')
|
||||
|
||||
@section('content')
|
||||
@php $images = $page->files()->where('mime_type', 'like', 'image%')->get(); @endphp
|
||||
@if(count($images) > 0)
|
||||
<div class="orbit" role="region" data-orbit
|
||||
data-options="animationDuration:3000; animInFromLeft:fade-in; animInFromRight:fade-in; animOutToLeft:fade-out; animOutToRight:fade-out;">
|
||||
<ul class="orbit-container">
|
||||
@foreach($images as $i => $image)
|
||||
<li class="orbit-slide slow @if($i == 0) is-active @endif">
|
||||
<img class="orbit-image" src="@upload($image->filename)" alt="" />
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@section('bodyClass', 'photo-bg')
|
||||
|
||||
<nav class="orbit-bullets">
|
||||
@foreach($images as $i => $image)
|
||||
<button @if($i == 0) class="is-active" @endif data-slide="{{$i}}"></button>
|
||||
@endforeach
|
||||
</nav>
|
||||
@section('topMenu')
|
||||
<h1 class="text-center">
|
||||
<a href="{{route('page.index')}}">
|
||||
<img class="logo" src="@asset('visitor/images/logo.png')" alt="">
|
||||
{{setting('pageName')}}
|
||||
</a>
|
||||
</h1>
|
||||
|
||||
<div class="stripe orbit-top"></div>
|
||||
<div class="stripe orbit-bottom"></div>
|
||||
<div class="title-bar text-right" data-responsive-toggle="main-menu" data-hide-for="medium">
|
||||
<button class="menu-icon" type="button" data-toggle></button>
|
||||
</div>
|
||||
|
||||
<header class="hide-for-small hide-for-medium hide-for-large top-bar centered text-center">
|
||||
<div id="main-menu">
|
||||
@widgetArea('mainMenu')
|
||||
</div>
|
||||
@endif
|
||||
</header>
|
||||
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
@include('modules.staticpages.visitor._partials.slider', ['slideClass' => 'slow'])
|
||||
<header class="hide-for-small-only top-bar centered text-center">
|
||||
@widgetArea('mainMenu')
|
||||
</header>
|
||||
|
||||
|
||||
<div class="row content-container">
|
||||
{!! $page->pageContent !!}
|
||||
|
||||
<div class="text-center stripe light trainee-team">
|
||||
|
||||
<h2>{{$page->traineeTeamCategory->name}}</h2>
|
||||
|
||||
@foreach($page->traineeTeamCategory->content as $i => $subpage)
|
||||
<div class="column text-center small-6 medium-{{ceil(12/count($page->traineeTeamCategory->content))}}"
|
||||
data-equalizer-watch>
|
||||
<a href="{{route('page.content', ['url' => $subpage->url])}}">
|
||||
@if(empty($subpage->titlePhoto))
|
||||
<img class="thumbnail" src="@asset('visitor/images/avatar.png')" alt="{{$subpage->title}}">
|
||||
@else
|
||||
<img class="thumbnail" src="@upload($subpage->titlePhoto)" alt="{{$subpage->title}}">
|
||||
@endif
|
||||
<h4>{{$subpage->title}}</h4>
|
||||
</a>
|
||||
</div>
|
||||
@endforeach
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
@extendVisitor('defaultLayout')
|
||||
|
||||
@section('bodyClass', 'photo-bg')
|
||||
|
||||
@section('topMenu')
|
||||
@include(\App\CMS\Helpers\Template::name('commonHeader'))
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="row content-container">
|
||||
<h1>{{$page->title}}</h1>
|
||||
{!! $page->pageContent !!}
|
||||
|
||||
@include('modules.staticpages.visitor._partials.slider')
|
||||
</div>
|
||||
@endsection
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
@extendVisitor('defaultLayout')
|
||||
|
||||
@section('bodyClass', 'photo-bg')
|
||||
|
||||
@section('topMenu')
|
||||
@include(\App\CMS\Helpers\Template::name('commonHeader'))
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
|
||||
@if (!empty($page->titlePhoto))
|
||||
<div class="row title-photo">
|
||||
<img src="@upload($page->titlePhoto)" alt="">
|
||||
</div>
|
||||
@endif
|
||||
<div class="row content-container">
|
||||
<h1>{{$page->title}}</h1>
|
||||
|
||||
{!! $page->pageContent !!}
|
||||
|
||||
@include('modules.staticpages.visitor._partials.hotelList')
|
||||
</div>
|
||||
@endsection
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
@extendVisitor('defaultLayout')
|
||||
|
||||
@section('bodyClass', 'photo-bg')
|
||||
|
||||
@section('topMenu')
|
||||
@include(\App\CMS\Helpers\Template::name('commonHeader'))
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
|
||||
@if (!empty($page->titlePhoto))
|
||||
<div class="row title-photo">
|
||||
<img src="@upload($page->titlePhoto)" alt="">
|
||||
</div>
|
||||
@endif
|
||||
<div class="row content-container">
|
||||
<h1>{{$page->title}}</h1>
|
||||
|
||||
{!! $page->pageContent !!}
|
||||
|
||||
@include('modules.staticpages.visitor._partials.traineeTeamList')
|
||||
</div>
|
||||
@endsection
|
||||
+6
-6
@@ -1,19 +1,19 @@
|
||||
@extendVisitor('defaultLayout')
|
||||
|
||||
@section('bodyClass', 'photo-bg')
|
||||
|
||||
@section('topMenu')
|
||||
@include(\App\CMS\Helpers\Template::name('commonHeader'))
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="row content-container">
|
||||
|
||||
<div class="text-center">
|
||||
<img src="@upload($page->titlePhoto)" class="rounded trainer" alt="">
|
||||
<h2>{{$page->title}}</h2>
|
||||
</div>
|
||||
|
||||
|
||||
{!! $page->pageContent !!}
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@endsection
|
||||
@@ -0,0 +1,19 @@
|
||||
<div class="title-bar text-right" data-responsive-toggle="main-menu" data-hide-for="medium">
|
||||
<button class="menu-icon" type="button" data-toggle></button>
|
||||
</div>
|
||||
|
||||
<div id="main-menu">
|
||||
<div class="top-bar-left hide-for-medium-only hide-for-small-only">
|
||||
<h1 class="text-center">
|
||||
<a href="{{route('page.index')}}">
|
||||
<img class="logo" src="@asset('visitor/images/logo.png')" alt="">
|
||||
{{setting('pageName')}}
|
||||
</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div class="top-bar-right">
|
||||
@widgetArea('mainMenu')
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -12,51 +12,45 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/motion-ui/1.1.1/motion-ui.min.css" />
|
||||
<link rel="stylesheet" href="@asset('visitor/css/app.css')" />
|
||||
|
||||
@if (!empty($googleAnalyticsCode))
|
||||
<script>
|
||||
(function (i, s, o, g, r, a, m) {
|
||||
i['GoogleAnalyticsObject'] = r;
|
||||
i[r] = i[r] || function () {
|
||||
(i[r].q = i[r].q || []).push (arguments)
|
||||
}, i[r].l = 1 * new Date ();
|
||||
a = s.createElement (o),
|
||||
m = s.getElementsByTagName (o)[0];
|
||||
a.async = 1;
|
||||
a.src = g;
|
||||
m.parentNode.insertBefore (a, m)
|
||||
}) (window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
|
||||
|
||||
ga ('create', '{{$googleAnalyticsCode}}', 'auto');
|
||||
ga ('send', 'pageview');
|
||||
|
||||
</script>
|
||||
@endif
|
||||
|
||||
@include('visitor.metaInformation')
|
||||
</head>
|
||||
<body>
|
||||
@if (!empty($googleAnalyticsCode))
|
||||
<script>
|
||||
(function (i, s, o, g, r, a, m) {
|
||||
i['GoogleAnalyticsObject'] = r;
|
||||
i[r] = i[r] || function () {
|
||||
(i[r].q = i[r].q || []).push (arguments)
|
||||
}, i[r].l = 1 * new Date ();
|
||||
a = s.createElement (o),
|
||||
m = s.getElementsByTagName (o)[0];
|
||||
a.async = 1;
|
||||
a.src = g;
|
||||
m.parentNode.insertBefore (a, m)
|
||||
}) (window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
|
||||
<body class="@yield('bodyClass')">
|
||||
|
||||
ga ('create', '{{$googleAnalyticsCode}}', 'auto');
|
||||
ga ('send', 'pageview');
|
||||
|
||||
</script>
|
||||
@endif
|
||||
<header class="top-bar">
|
||||
<div class="top-bar-left hide-for-small-only">
|
||||
<h1>
|
||||
<a href="{{route('page.index')}}">
|
||||
{{setting('pageName')}}
|
||||
</a>
|
||||
</h1>
|
||||
</div>
|
||||
<div class="top-bar-right">
|
||||
@widgetArea('mainMenu')
|
||||
</div>
|
||||
@yield('topMenu')
|
||||
</header>
|
||||
|
||||
@yield('content')
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<footer id="footer" class="stripe light">
|
||||
<div id="footer-widgets">
|
||||
@widgetArea('footer')
|
||||
</div>
|
||||
|
||||
<footer class="row" id="footer">
|
||||
<div id="footer-widgets" class=" text-center">
|
||||
@widgetArea('footer')
|
||||
</div>
|
||||
<div id="binarity" class="text-right">
|
||||
<a target="_blank" href="https://www.binarity.cz/"> binarity s.r.o.</a>
|
||||
<a target="_blank" href="https://www.binarity.cz/">binarity s.r.o.</a>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
<meta charset="utf-8" />
|
||||
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
|
||||
<link href='https://fonts.googleapis.com/css?family=Hind+Siliguri:400,500,700,300&subset=latin,latin-ext'
|
||||
rel='stylesheet' type='text/css'>
|
||||
<link href='https://fonts.googleapis.com/css?family=Ubuntu:400,300,500,700&subset=latin-ext,latin' rel='stylesheet'
|
||||
type='text/css'>
|
||||
<link href="https://fonts.googleapis.com/css?family=Comfortaa&subset=latin-ext" rel="stylesheet">
|
||||
<link rel="stylesheet" href="{{asset_path('visitor/css/app.css')}}">
|
||||
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
@@ -13,88 +14,19 @@
|
||||
<title>@yield('pageTitle') | {{setting('pageName')}}</title>
|
||||
|
||||
<style>
|
||||
|
||||
body {
|
||||
font-size: 150%;
|
||||
line-height: 150%;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 4em;
|
||||
font-weight: 100;
|
||||
padding-top: 30px;
|
||||
}
|
||||
|
||||
header {
|
||||
background: #7cad2a;
|
||||
padding: 30px 0;
|
||||
}
|
||||
|
||||
footer {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
padding: 5px 0;
|
||||
}
|
||||
|
||||
footer a {
|
||||
color: white;
|
||||
.content-container {
|
||||
width: 75%;
|
||||
margin: auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="text-center">
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<a href="{{route('page.index')}}">
|
||||
<img src="{{asset_path('visitor/images/menu_logo.png')}}" class="PragueTennisCamp-logo-menu" alt="PragueTennisCamp s.r.o.">
|
||||
</a>
|
||||
</header>
|
||||
<div class="row content-container">
|
||||
<h1>@yield('pageTitle')</h1>
|
||||
|
||||
<h1>@yield('pageTitle')</h1>
|
||||
|
||||
<div class="row">
|
||||
@yield('content')
|
||||
</div>
|
||||
|
||||
<footer id="footer">
|
||||
@if (!empty(setting('facebookProfile')))
|
||||
|
||||
<a href="{{setting('facebookProfile')}}" target="_blank">
|
||||
<i class="fa fa-fw fa-facebook-official fb-color"></i>
|
||||
</a>
|
||||
@endif
|
||||
|
||||
@if (!empty(setting('linkedInProfile')))
|
||||
<a href="{{setting('linkedInProfile')}}" target="_blank">
|
||||
<i class="fa fa-fw fa-linkedin in-color"></i>
|
||||
</a>
|
||||
@endif
|
||||
|
||||
@if(!empty(setting('gplusProfile')))
|
||||
<a href="{{setting('gplusProfile')}}" target="_blank">
|
||||
<i class="fa fa-fw fa-google-plus gp-color"></i>
|
||||
</a>
|
||||
@endif
|
||||
|
||||
</footer>
|
||||
|
||||
{{--<ul class="social-icons menu">--}}
|
||||
{{--<a href="{{setting('facebookProfile')}}" target="_blank">--}}
|
||||
{{--<i class="fa fa-fw fa-2x fa-facebook-official fb-color"></i>--}}
|
||||
{{--</a>--}}
|
||||
|
||||
{{--<li>--}}
|
||||
{{--<a href="{{setting('linkedInProfile')}}" target="_blank">--}}
|
||||
{{--<i class="fa fa-fw fa-2x fa-linkedin in-color"></i>--}}
|
||||
{{--</a>--}}
|
||||
{{--</li>--}}
|
||||
|
||||
{{--<li>--}}
|
||||
{{--<a href="{{setting('gplusProfile')}}" target="_blank">--}}
|
||||
{{--<i class="fa fa-fw fa-2x fa-google-plus gp-color"></i>--}}
|
||||
{{--</a>--}}
|
||||
{{--</li>--}}
|
||||
{{--</ul>--}}
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user