From 418d9ac4ca1a09b033dacbd7ac85d9855c73556d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Kv=C3=A1=C4=8Dek?= Date: Sun, 4 Sep 2016 02:42:55 +0200 Subject: [PATCH] FEATURE: style templates management --- app/Http/Controllers/Admin/EditTemplate.php | 2 +- resources/views/admin/layout.blade.php | 7 ++ .../admin/layoutWithNavigation.blade.php | 10 --- .../views/admin/snippets/aceEditor.blade.php | 2 +- .../admin/templates/directoriesList.blade.php | 25 ++++++++ .../views/admin/templates/edit.blade.php | 7 ++ .../views/admin/templates/editForm.blade.php | 39 +++++++++++ .../views/admin/templates/list.blade.php | 18 ++++++ .../admin/templates/templatesTiles.blade.php | 64 +++++++++++++++++++ 9 files changed, 162 insertions(+), 12 deletions(-) create mode 100644 resources/views/admin/templates/directoriesList.blade.php create mode 100644 resources/views/admin/templates/edit.blade.php create mode 100644 resources/views/admin/templates/editForm.blade.php create mode 100644 resources/views/admin/templates/list.blade.php create mode 100644 resources/views/admin/templates/templatesTiles.blade.php diff --git a/app/Http/Controllers/Admin/EditTemplate.php b/app/Http/Controllers/Admin/EditTemplate.php index b0a34148..e7995dc5 100644 --- a/app/Http/Controllers/Admin/EditTemplate.php +++ b/app/Http/Controllers/Admin/EditTemplate.php @@ -85,7 +85,7 @@ class EditTemplate extends Controller return redirect() ->route('templates.edit', ['id' => $request->id]) ->withInput() - ->with('error', trans('admin/templates.cannotWriteContent')); + ->with('warning', trans('admin/templates.cannotWriteContent')); } // save new content only if something was changed diff --git a/resources/views/admin/layout.blade.php b/resources/views/admin/layout.blade.php index b9cb30fe..5edac2b8 100644 --- a/resources/views/admin/layout.blade.php +++ b/resources/views/admin/layout.blade.php @@ -33,6 +33,13 @@ @endif +@if (session('warning')) +
+ + {{ session('warning') }} +
+@endif + @if (session('error'))
diff --git a/resources/views/admin/layoutWithNavigation.blade.php b/resources/views/admin/layoutWithNavigation.blade.php index 284b2063..d46663f6 100644 --- a/resources/views/admin/layoutWithNavigation.blade.php +++ b/resources/views/admin/layoutWithNavigation.blade.php @@ -23,8 +23,6 @@
diff --git a/resources/views/admin/snippets/aceEditor.blade.php b/resources/views/admin/snippets/aceEditor.blade.php index 9e3b7b14..2a61eca5 100644 --- a/resources/views/admin/snippets/aceEditor.blade.php +++ b/resources/views/admin/snippets/aceEditor.blade.php @@ -1,5 +1,5 @@
- +
{{$value}}
diff --git a/resources/views/admin/templates/directoriesList.blade.php b/resources/views/admin/templates/directoriesList.blade.php new file mode 100644 index 00000000..9835f77b --- /dev/null +++ b/resources/views/admin/templates/directoriesList.blade.php @@ -0,0 +1,25 @@ +@if($directory->parent_id) + + @lang('admin/templates.parentDirectory') + +
+@endif + +

@lang($directory->name)

+ +{{--@if (true || isset($isWritable) && $isWritable)--}} + {{--
--}} + {{-- @lang('admin/templates.new')
--}} + {{--
--}} +{{--@endif--}} + +
+ +
@lang('admin/templates.subdirectories')
+ + @forelse($subdirectories as $subdirectory) + {{trans($subdirectory->name)}} + @empty + @lang('admin/templates.noSubdirectories') + @endforelse +
\ No newline at end of file diff --git a/resources/views/admin/templates/edit.blade.php b/resources/views/admin/templates/edit.blade.php new file mode 100644 index 00000000..df60b694 --- /dev/null +++ b/resources/views/admin/templates/edit.blade.php @@ -0,0 +1,7 @@ +@extends('admin.layoutWithNavigation') + +@section('pageHeading', @trans('admin/templates.edit', ['name' => $template->template_name])) + +@section('content') + @include('admin.templates.editForm') +@stop \ No newline at end of file diff --git a/resources/views/admin/templates/editForm.blade.php b/resources/views/admin/templates/editForm.blade.php new file mode 100644 index 00000000..7c506a00 --- /dev/null +++ b/resources/views/admin/templates/editForm.blade.php @@ -0,0 +1,39 @@ +@if (!$isWritable) +
+ @lang('admin/templates.notWritable', ['file' => $path->path]) +
+@endif + +
+ {!! csrf_field() !!} +
+
+ @include('admin.snippets.aceEditor', [ + 'value' => old('templateContent', $templateContent), + 'theme' => 'xcode', + 'mode' => 'html', + 'name' => 'templateContent', + 'rows' => '20' + ]) +
+ +
+ + + + + + + + +
+
+
+ diff --git a/resources/views/admin/templates/list.blade.php b/resources/views/admin/templates/list.blade.php new file mode 100644 index 00000000..95e6e0bc --- /dev/null +++ b/resources/views/admin/templates/list.blade.php @@ -0,0 +1,18 @@ +@extends('admin.layoutWithNavigation') + +@section('pageHeading', @trans('admin/templates.overview')) + +@section('content') +
+
+ @include('admin.templates.templatesTiles') +
+ +
+
+ @include('admin.templates.directoriesList') +
+
+
+ +@stop \ No newline at end of file diff --git a/resources/views/admin/templates/templatesTiles.blade.php b/resources/views/admin/templates/templatesTiles.blade.php new file mode 100644 index 00000000..5a28b8d2 --- /dev/null +++ b/resources/views/admin/templates/templatesTiles.blade.php @@ -0,0 +1,64 @@ +
+ @forelse($templates as $template) +
+
+ {{str_limit($template->name, 15)}} +
+
+ {{str_limit($template->description, 150)}} +
+ + @if($isWritable) + + + + @else + + + + @endif + + @if ($template->editable) + + + + @endif +
+ @empty +
+ @lang('admin/templates.noTemplates') +
+ @endforelse +
+ +@section('javascripts') + +@endsection \ No newline at end of file