FEATURE #1455: add template path overview
This commit is contained in:
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Http\Requests;
|
||||||
|
use App\Models\TemplatePath;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class TemplateOverview extends Controller
|
||||||
|
{
|
||||||
|
public function getPath($path)
|
||||||
|
{
|
||||||
|
$path = TemplatePath::findOrFail($path);
|
||||||
|
|
||||||
|
return view('admin.templates.list', [
|
||||||
|
'directory' => $path,
|
||||||
|
'isWritable' => is_writable(base_path($path->path)),
|
||||||
|
'templates' => $path->templates()
|
||||||
|
->get(),
|
||||||
|
'subdirectories' => $path->subdirectories()
|
||||||
|
->get()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -51,6 +51,21 @@ Route::group([
|
|||||||
|
|
||||||
Route::get('customfields/delete/{id}', 'EditCustomField@deleteCustomField')
|
Route::get('customfields/delete/{id}', 'EditCustomField@deleteCustomField')
|
||||||
->name('customfields.delete');
|
->name('customfields.delete');
|
||||||
|
|
||||||
|
Route::get('templates/overview/path/{id}', 'TemplateOverview@getPath')
|
||||||
|
->name('templates.overview');
|
||||||
|
|
||||||
|
Route::get('templates/copy/{id}', 'TemplateOverview@getPath')
|
||||||
|
->name('templates.copy');
|
||||||
|
|
||||||
|
Route::get('templates/new/{pathId}', 'TemplateOverview@getPath')
|
||||||
|
->name('templates.new');
|
||||||
|
|
||||||
|
Route::get('templates/edit/{id}', 'TemplateOverview@getPath')
|
||||||
|
->name('templates.edit');
|
||||||
|
|
||||||
|
Route::post('templates/edit/{id}', 'TemplateOverview@getPath')
|
||||||
|
->name('templates.postEdit');
|
||||||
});
|
});
|
||||||
|
|
||||||
// these routes are available for all logged (authenticated) users
|
// these routes are available for all logged (authenticated) users
|
||||||
|
|||||||
@@ -18,7 +18,18 @@ class TemplatePath extends Model
|
|||||||
*
|
*
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||||
*/
|
*/
|
||||||
public function templates() {
|
public function templates()
|
||||||
|
{
|
||||||
return $this->hasMany('App\Models\Template', 'path');
|
return $this->hasMany('App\Models\Template', 'path');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of all subdirectories of given path
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||||
|
*/
|
||||||
|
public function subdirectories()
|
||||||
|
{
|
||||||
|
return $this->hasMany('App\Models\TemplatePath', 'parent_id');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use App\Enumerations\TemplatePathsHumanReadable;
|
||||||
|
use App\Enumerations\TemplatePathsHumanReadableRootOnly;
|
||||||
use App\Enumerations\WidgetTypes;
|
use App\Enumerations\WidgetTypes;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
@@ -54,6 +56,13 @@ class AdminMenusProvider extends ServiceProvider
|
|||||||
$sub->route('widgetareas.overview', trans('admin/mainMenu.widgetAreaOverview'), [], 2, ['icon' => 'fa fa-list']);
|
$sub->route('widgetareas.overview', trans('admin/mainMenu.widgetAreaOverview'), [], 2, ['icon' => 'fa fa-list']);
|
||||||
}, 50, ['icon' => 'fa fa-object-group']);
|
}, 50, ['icon' => 'fa fa-object-group']);
|
||||||
}, 28, ['icon' => 'fa fa-gears']);
|
}, 28, ['icon' => 'fa fa-gears']);
|
||||||
|
$menu->dropdown(trans('admin/mainMenu.templates'), function ($sub) {
|
||||||
|
$i = 1;
|
||||||
|
$templatePaths = TemplatePathsHumanReadableRootOnly::getWithTranslations();
|
||||||
|
foreach ($templatePaths as $id => $name) {
|
||||||
|
$sub->route('templates.overview', $name, ['id' => $id], $i++);
|
||||||
|
}
|
||||||
|
}, 29, ['icon' => 'fa fa-folder-open']);
|
||||||
$menu->dropdown(trans('admin/mainMenu.customFields'), function ($sub) {
|
$menu->dropdown(trans('admin/mainMenu.customFields'), function ($sub) {
|
||||||
$sub->route('customfields.new', trans('admin/mainMenu.customFieldsNew'), [], 10, ['icon' => 'fa fa-code']);
|
$sub->route('customfields.new', trans('admin/mainMenu.customFieldsNew'), [], 10, ['icon' => 'fa fa-code']);
|
||||||
$sub->route('customfields.overview', trans('admin/mainMenu.customFieldsOverview'), [], 50, ['icon' => 'fa fa-code-fork']);
|
$sub->route('customfields.overview', trans('admin/mainMenu.customFieldsOverview'), [], 50, ['icon' => 'fa fa-code-fork']);
|
||||||
|
|||||||
@@ -21,5 +21,6 @@ return [
|
|||||||
'newWidget' => 'New widget',
|
'newWidget' => 'New widget',
|
||||||
'widgetAreas' => 'Widget areas',
|
'widgetAreas' => 'Widget areas',
|
||||||
'widgetsOverview' => 'All widgets',
|
'widgetsOverview' => 'All widgets',
|
||||||
'assignWidgets' => 'Assign widgets'
|
'assignWidgets' => 'Assign widgets',
|
||||||
|
'templates' => 'Templates'
|
||||||
];
|
];
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
return [
|
||||||
|
'core' => 'Core templates',
|
||||||
|
'homepage' => 'Home page',
|
||||||
|
'overview' => 'Templates',
|
||||||
|
'noSubdirectories' => 'No directories available',
|
||||||
|
'parentDirectory' => 'Parent directory',
|
||||||
|
'noTemplates' => 'No templates available',
|
||||||
|
'new' => 'New template',
|
||||||
|
'subdirectories' => 'Subdirectories'
|
||||||
|
];
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
@if($directory->parent_id)
|
||||||
|
<a href="{{route('templates.overview', ['path' => $directory->parent_id])}}" class="button full-width secondary">
|
||||||
|
@lang('admin/templates.parentDirectory') <i class="fa fa-level-up"></i>
|
||||||
|
</a>
|
||||||
|
<br />
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<h4>@lang($directory->name)</h4>
|
||||||
|
|
||||||
|
@if (true || isset($isWritable) && $isWritable)
|
||||||
|
<div class="text-right">
|
||||||
|
<a href="{{route('templates.new', ['pathId' => $directory->id])}}"><i class="fa fa-plus"></i> @lang('admin/templates.new')</a> <br />
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div>
|
||||||
|
|
||||||
|
<h5>@lang('admin/templates.subdirectories')</h5>
|
||||||
|
|
||||||
|
@forelse($subdirectories as $subdirectory)
|
||||||
|
<a href="{{route('templates.overview', ['path' => $subdirectory->id])}}">{{trans($subdirectory->name)}}</a>
|
||||||
|
@empty
|
||||||
|
<em>@lang('admin/templates.noSubdirectories')</em>
|
||||||
|
@endforelse
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
@extends('admin.layout')
|
||||||
|
|
||||||
|
@section('pageName', @trans('admin/templates.overview'))
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<h1>@lang('admin/templates.overview')</h1>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="column large-9">
|
||||||
|
@include('admin.templates.templatesTiles')
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="column large-3">
|
||||||
|
<div class="callout">
|
||||||
|
@include('admin.templates.directoriesList')
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@stop
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<div class="tile-overview" data-equalizer>
|
||||||
|
@forelse($templates as $template)
|
||||||
|
<div class="columns large-3">
|
||||||
|
<div class="item" data-equalizer-watch>
|
||||||
|
<div class="detail row text-center">
|
||||||
|
<div class="highlight">
|
||||||
|
{{str_limit($template->name, 15)}}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{{str_limit($template->description, 150)}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="controls row">
|
||||||
|
<a href="{{route('templates.copy', ['id' => $template->id])}}" class="button text-center primary column large-6" title="@lang('admin/templates.copy')">
|
||||||
|
<i class="fa fa-copy"></i>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
@if ($template->editable)
|
||||||
|
<a href="{{route('templates.edit', ['id' => $template->id])}}" class="button text-center success column large-6" title="@lang('admin/templates.edit')">
|
||||||
|
<i class="fa fa-edit"></i>
|
||||||
|
</a>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@empty
|
||||||
|
<em>@lang('admin/templates.noTemplates')</em>
|
||||||
|
@endforelse
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user