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
|
||||
{
|
||||
/**
|
||||
* @var Content
|
||||
*/
|
||||
private $content;
|
||||
|
||||
public function __construct(Content $content)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->content = $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overview for all content pages.
|
||||
*
|
||||
@@ -27,10 +39,12 @@ class ContentOverview extends Controller
|
||||
}
|
||||
|
||||
// get pages for overview
|
||||
$model = new Content();
|
||||
$pages = $model->getOverview($moduleFilterHandler, $status, true)
|
||||
->paginate($perPage);
|
||||
$pages = $this->content->getOverview($moduleFilterHandler, $status, true)
|
||||
->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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user