FEATURE: add content page overview
This commit is contained in:
@@ -74,4 +74,17 @@ class Template
|
||||
|
||||
return config('app.url') . '/assets/' . config('app.theme') . '/' . $path;
|
||||
}
|
||||
|
||||
public static function date($datestamp, $withTime = true)
|
||||
{
|
||||
$timestamp = strtotime($datestamp);
|
||||
|
||||
if ($timestamp <= 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$format = $withTime ? config('app.datetime_format') : config('app.date_format');
|
||||
|
||||
return date($format, $timestamp);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Enumerations\ContentStatuses;
|
||||
use App\Models\Content;
|
||||
use App\Models\Module;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
@@ -45,6 +46,11 @@ class ContentOverview extends Controller
|
||||
// get homepage - for checking if homepage is set and available
|
||||
$homepage = $this->content->getHomepage();
|
||||
|
||||
return view('admin.content.overview', ['pages' => $pages, 'homepage' => $homepage]);
|
||||
return view('admin.content.overview', [
|
||||
'pages' => $pages,
|
||||
'homepage' => $homepage,
|
||||
'statuses' => ContentStatuses::getWithTranslations(),
|
||||
'module' => isset($module) ? $module : null
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -185,7 +185,7 @@ class Content extends Model
|
||||
public function getOverview($handler = false, $status = false, $joinAuthor = false, $joinParent = false)
|
||||
{
|
||||
$query = DB::table('contents')
|
||||
->select('contents.*', 'modules.name AS module_name')
|
||||
->select('contents.*', 'modules.name AS module_name', 'modules.id AS module_id')
|
||||
->where('contents.status', '<>', self::STATUS_DELETED)
|
||||
->where('contents.language', LaravelLocalization::getCurrentLocale())
|
||||
->join('modules', 'modules.handler', '=', 'contents.module_handler')
|
||||
|
||||
@@ -80,7 +80,14 @@ class GlobalViewDataProvider extends ServiceProvider
|
||||
|
||||
return preg_replace($pattern, $code, $view);
|
||||
});
|
||||
|
||||
|
||||
Blade::extend(function ($view) {
|
||||
$pattern = $this->createPattern('date');
|
||||
$code = '<?php echo \App\Helpers\Template::date($2); ?>';
|
||||
|
||||
return preg_replace($pattern, $code, $view);
|
||||
});
|
||||
|
||||
// register extension for rendering widget areas
|
||||
Blade::extend(function ($view) {
|
||||
$pattern = $this->createPattern('widgetArea');
|
||||
|
||||
Reference in New Issue
Block a user