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;
|
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
|
<?php
|
||||||
namespace App\Http\Controllers\Admin;
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Enumerations\ContentStatuses;
|
||||||
use App\Models\Content;
|
use App\Models\Content;
|
||||||
use App\Models\Module;
|
use App\Models\Module;
|
||||||
use Illuminate\Support\Facades\Input;
|
use Illuminate\Support\Facades\Input;
|
||||||
@@ -45,6 +46,11 @@ class ContentOverview extends Controller
|
|||||||
// get homepage - for checking if homepage is set and available
|
// get homepage - for checking if homepage is set and available
|
||||||
$homepage = $this->content->getHomepage();
|
$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)
|
public function getOverview($handler = false, $status = false, $joinAuthor = false, $joinParent = false)
|
||||||
{
|
{
|
||||||
$query = DB::table('contents')
|
$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.status', '<>', self::STATUS_DELETED)
|
||||||
->where('contents.language', LaravelLocalization::getCurrentLocale())
|
->where('contents.language', LaravelLocalization::getCurrentLocale())
|
||||||
->join('modules', 'modules.handler', '=', 'contents.module_handler')
|
->join('modules', 'modules.handler', '=', 'contents.module_handler')
|
||||||
|
|||||||
@@ -81,6 +81,13 @@ class GlobalViewDataProvider extends ServiceProvider
|
|||||||
return preg_replace($pattern, $code, $view);
|
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
|
// register extension for rendering widget areas
|
||||||
Blade::extend(function ($view) {
|
Blade::extend(function ($view) {
|
||||||
$pattern = $this->createPattern('widgetArea');
|
$pattern = $this->createPattern('widgetArea');
|
||||||
|
|||||||
@@ -98,6 +98,10 @@ return [
|
|||||||
'upload_url' => env('UPLOAD_URL', PHP_SAPI === 'cli' ? '' : url('uploads')),
|
'upload_url' => env('UPLOAD_URL', PHP_SAPI === 'cli' ? '' : url('uploads')),
|
||||||
'thumbnail_url' => env('THUMBNAIL_URL', PHP_SAPI === 'cli' ? '' : url('uploads/thumbnails')),
|
'thumbnail_url' => env('THUMBNAIL_URL', PHP_SAPI === 'cli' ? '' : url('uploads/thumbnails')),
|
||||||
'theme' => env('THEME'),
|
'theme' => env('THEME'),
|
||||||
|
'datetime_format' => 'd. m. Y G:i',
|
||||||
|
'date_format' => 'd. m. Y',
|
||||||
|
'datetime_format_js' => 'dd-mm-yyyy hh:ii',
|
||||||
|
'date_format_js' => 'dd-mm-yyyy',
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Logging Configuration
|
| Logging Configuration
|
||||||
|
|||||||
+33
@@ -13028,6 +13028,11 @@ a:focus {
|
|||||||
.form-control {
|
.form-control {
|
||||||
margin: .3em 0;
|
margin: .3em 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.text-center {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
.has-error {
|
.has-error {
|
||||||
color: #FF4444;
|
color: #FF4444;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
@@ -13038,3 +13043,31 @@ a:focus {
|
|||||||
color: red !important;
|
color: red !important;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.item-col-header {
|
||||||
|
outline: solid 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.full-width {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-overview.item-list {
|
||||||
|
display: table;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table.content-overview td{
|
||||||
|
vertical-align: middle !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-overview .with-placeholder {
|
||||||
|
max-width: 3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-overview .placeholder {
|
||||||
|
max-height: 3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-list .item-actions-dropdown.active .item-actions-block {
|
||||||
|
max-width: 300px !important;
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 4.3 KiB |
@@ -47,5 +47,10 @@ return [
|
|||||||
'files' => 'Files',
|
'files' => 'Files',
|
||||||
'lockUrl' => 'Keep URL',
|
'lockUrl' => 'Keep URL',
|
||||||
'noCategory' => ' -- No category -- ',
|
'noCategory' => ' -- No category -- ',
|
||||||
'noTemplates' => 'Cannot create content page. There are no available templates for this module.'
|
'noTemplates' => 'Cannot create content page. There are no available templates for this module.',
|
||||||
|
'title' => 'Title',
|
||||||
|
'createdAt' => 'Created at',
|
||||||
|
'status' => 'Status',
|
||||||
|
'moduleName' => 'Module',
|
||||||
|
'actions' => 'Actions'
|
||||||
];
|
];
|
||||||
@@ -1,6 +1,14 @@
|
|||||||
@extends('admin.layoutWithNavigation')
|
@extends('admin.layoutWithNavigation')
|
||||||
|
|
||||||
@section('pageHeading', @trans('admin/contents.overview'))
|
@section('pageHeading', @trans('admin/contents.overview'))
|
||||||
|
@section('headerButtons')
|
||||||
|
|
||||||
|
@if($module)
|
||||||
|
<a href="{{route('content.new', ['moduleId' => $module->id])}}" class="btn btn-primary btn-sm rounded-s">
|
||||||
|
<i class="fa fa-plus"></i>
|
||||||
|
</a>
|
||||||
|
@endif
|
||||||
|
@endsection
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
@if (!$homepage)
|
@if (!$homepage)
|
||||||
@@ -14,20 +22,130 @@
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@if (count($pages))
|
@if (count($pages))
|
||||||
<table>
|
<table class="table item-list full-width content-overview table-striped table-bordered table-hover">
|
||||||
<tr>
|
<tr>
|
||||||
<th></th>
|
<th></th>
|
||||||
<th></th>
|
<th>@lang('admin/contents.title')</th>
|
||||||
<th></th>
|
<th>@lang('admin/contents.status')</th>
|
||||||
<th></th>
|
<th>@lang('admin/contents.moduleName')</th>
|
||||||
|
<th>@lang('admin/contents.createdAt')</th>
|
||||||
|
<th>@lang('admin/contents.actions')</th>
|
||||||
</tr>
|
</tr>
|
||||||
@foreach($pages as $page)
|
@foreach($pages as $page)
|
||||||
<tr>
|
<tr>
|
||||||
<td></td>
|
<td class="text-center with-placeholder">
|
||||||
<td></td>
|
<a href="{{route('content.edit', ['id' => $page->id])}}">
|
||||||
<td></td>
|
@if(!empty($page->title_photo))
|
||||||
<td></td>
|
<img src="@upload($page->title_photo)" class="placeholder" alt="{{$page->title}}" />
|
||||||
|
@else
|
||||||
|
<img src="{{asset('resources/assets/admin/img/placeholder.png')}}" class="placeholder"
|
||||||
|
alt="{{$page->title}}" />
|
||||||
|
@endif
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="{{route('content.edit', ['id' => $page->id])}}">
|
||||||
|
{{$page->title}}
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>{{$statuses[$page->status]}}</td>
|
||||||
|
<td>
|
||||||
|
<a href="{{route('content.overview', ['moduleId' => $page->module_id])}}">
|
||||||
|
{{trans($page->module_name)}}
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>@date($page->created_at)</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<div class="item-actions-dropdown">
|
||||||
|
<a class="item-actions-toggle-btn">
|
||||||
|
<span class="inactive">
|
||||||
|
<i class="fa fa-cog"></i>
|
||||||
|
</span>
|
||||||
|
<span class="active">
|
||||||
|
<i class="fa fa-chevron-circle-right"></i>
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
<div class="item-actions-block">
|
||||||
|
<ul class="item-actions-list">
|
||||||
|
|
||||||
|
@if(!$page->is_homepage)
|
||||||
|
|
||||||
|
<li>
|
||||||
|
|
||||||
|
<a href="{{route('content.setHomepage', ['id' => $page->id])}}"
|
||||||
|
class="button tiny success">
|
||||||
|
<i class="fa fa-home"></i>
|
||||||
|
{{--@lang('admin/contents.setHomepage')--}}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a class="edit" href="{{route('content.edit', ['id' => $page->id])}}"
|
||||||
|
class="button tiny success">
|
||||||
|
<i class="fa fa-pencil"></i>
|
||||||
|
{{-- @lang('admin/contents.editPlain')--}}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
@if($page->status == \App\Models\Content::STATUS_DRAFT)
|
||||||
|
<li>
|
||||||
|
<a href="{{route('content.changeStatus', ['id' => $page->id, 'status' => \App\Models\Content::STATUS_PUBLIC])}}"
|
||||||
|
class="button tiny success">
|
||||||
|
<i class="fa fa-eye"></i>
|
||||||
|
{{-- @lang('admin/contents.makePublic')--}}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="{{route('content.changeStatus', ['id' => $page->id, 'status' => \App\Models\Content::STATUS_PROTECTED])}}"
|
||||||
|
class="button tiny warning" data-toggle="modal"
|
||||||
|
data-target="#confirm-modal">
|
||||||
|
<i class="fa fa-lock"></i>
|
||||||
|
{{-- @lang('admin/contents.makeProtected')--}}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
@else
|
||||||
|
<li>
|
||||||
|
<a href="{{route('page.content', ['url' => $page->url])}}" target="_blank"
|
||||||
|
class="button tiny secondary"><i class="fa fa-desktop"></i>
|
||||||
|
{{--@lang('admin/contents.viewPage')--}}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="{{route('content.changeStatus', ['id' => $page->id, 'status' => \App\Models\Content::STATUS_DRAFT])}}"
|
||||||
|
class="button tiny warning confirm"><i
|
||||||
|
class="fa fa-eye-slash"></i>
|
||||||
|
{{--@lang('admin/contents.makeDraft')--}}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a class="remove" data-toggle="modal" data-target="#confirm-modal"
|
||||||
|
href="{{route('content.delete', ['id' => $page->id])}}"
|
||||||
|
class="button tiny alert confirm"><i
|
||||||
|
class="fa fa-trash-o"></i>
|
||||||
|
{{--@lang('admin/contents.deletePage')--}}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
{{--<li>--}}
|
||||||
|
{{--<a class="remove" href="#" data-toggle="modal" data-target="#confirm-modal"> <i--}}
|
||||||
|
{{--class="fa fa-trash-o "></i> </a>--}}
|
||||||
|
{{--</li>--}}
|
||||||
|
{{--<li>--}}
|
||||||
|
{{--<a class="edit" href="item-editor.html"> <i class="fa fa-pencil"></i> </a>--}}
|
||||||
|
{{--</li>--}}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</table>
|
</table>
|
||||||
@@ -42,3 +160,21 @@
|
|||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,24 @@
|
|||||||
|
|
||||||
@yield('page')
|
@yield('page')
|
||||||
|
|
||||||
|
<!-- /.modal -->
|
||||||
|
<div class="modal fade" id="confirm-modal">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
<h4 class="modal-title"><i class="fa fa-warning"></i> Alert</h4> </div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<p>Are you sure want to do this?</p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer"> <button type="button" class="btn btn-primary" data-dismiss="modal">Yes</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">No</button> </div>
|
||||||
|
</div>
|
||||||
|
<!-- /.modal-content -->
|
||||||
|
</div>
|
||||||
|
<!-- /.modal-dialog -->
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="ref" id="ref">
|
<div class="ref" id="ref">
|
||||||
<div class="color-primary"></div>
|
<div class="color-primary"></div>
|
||||||
<div class="chart">
|
<div class="chart">
|
||||||
|
|||||||
@@ -146,7 +146,7 @@
|
|||||||
<article class="content charts-flot-page">
|
<article class="content charts-flot-page">
|
||||||
<div class="title-block">
|
<div class="title-block">
|
||||||
<h3 class="title">
|
<h3 class="title">
|
||||||
@yield('pageHeading')
|
@yield('pageHeading') @yield('headerButtons')
|
||||||
</h3>
|
</h3>
|
||||||
<p class="title-description">@yield('pageDescription')</p>
|
<p class="title-description">@yield('pageDescription')</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user