FEATURE: add info about not-set homepage into contents overview
This commit is contained in:
@@ -7,6 +7,18 @@ use Illuminate\Support\Facades\Input;
|
|||||||
|
|
||||||
class ContentOverview extends Controller
|
class ContentOverview extends Controller
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var Content
|
||||||
|
*/
|
||||||
|
private $content;
|
||||||
|
|
||||||
|
public function __construct(Content $content)
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
|
$this->content = $content;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overview for all content pages.
|
* Overview for all content pages.
|
||||||
*
|
*
|
||||||
@@ -27,10 +39,12 @@ class ContentOverview extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get pages for overview
|
// get pages for overview
|
||||||
$model = new Content();
|
$pages = $this->content->getOverview($moduleFilterHandler, $status, true)
|
||||||
$pages = $model->getOverview($moduleFilterHandler, $status, true)
|
->paginate($perPage);
|
||||||
->paginate($perPage);
|
|
||||||
|
|
||||||
return view('admin.content.overview', ['pages' => $pages]);
|
// get homepage - for checking if homepage is set and available
|
||||||
|
$homepage = $this->content->getHomepage();
|
||||||
|
|
||||||
|
return view('admin.content.overview', ['pages' => $pages, 'homepage' => $homepage]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,6 +88,42 @@ class Content extends Model
|
|||||||
return $this->subpages;
|
return $this->subpages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is current content draft?
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isDraft() {
|
||||||
|
return $this->status == self::STATUS_DRAFT;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is current content visible for all visitors?
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isPublic() {
|
||||||
|
return $this->status == self::STATUS_PUBLIC;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is current content visible only for logged users?
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isProtected() {
|
||||||
|
return $this->status == self::STATUS_PROTECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is current content visible for logged user OR for everyone?
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isVisible() {
|
||||||
|
return $this->isPublic() || $this->isProtected();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns list of all root pages - those pages, which parent_id is null
|
* Returns list of all root pages - those pages, which parent_id is null
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -37,5 +37,7 @@ return [
|
|||||||
'homepageSetup' => 'Homepage successfully set up.',
|
'homepageSetup' => 'Homepage successfully set up.',
|
||||||
'setHomepage' => 'Set page as homepage',
|
'setHomepage' => 'Set page as homepage',
|
||||||
'noParentPage' => ' -- No parent page -- ',
|
'noParentPage' => ' -- No parent page -- ',
|
||||||
'uploadTitleImage' => 'Upload title image'
|
'uploadTitleImage' => 'Upload title image',
|
||||||
|
'noHomepage' => 'You have not set up your homepage yet, or your current homepage is draft! Try to select another one.',
|
||||||
|
'homepageProtected' => 'Your homepage is displayed only for logged in users. This may or may not be an error.'
|
||||||
];
|
];
|
||||||
@@ -17,6 +17,22 @@
|
|||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@if (!$homepage)
|
||||||
|
<div class="row">
|
||||||
|
<div class="callout alert">
|
||||||
|
<strong>@lang('admin/contents.noHomepage')</strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@elseif(!$homepage->isPublic())
|
||||||
|
<div class="row">
|
||||||
|
<div class="callout warning">
|
||||||
|
<strong>@lang('admin/contents.homepageProtected')</strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@include('admin.content.overviewTiles')
|
@include('admin.content.overviewTiles')
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|||||||
Reference in New Issue
Block a user