FEATURE: style templates management
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -33,6 +33,13 @@
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if (session('warning'))
|
||||
<div class="notification alert alert-warning">
|
||||
<i class="fa fw fa-warning"></i>
|
||||
<strong>{{ session('warning') }}</strong>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if (session('error'))
|
||||
<div data-alert class="notification alert alert-danger">
|
||||
<i class="fa fw fa-remove"></i>
|
||||
|
||||
@@ -23,8 +23,6 @@
|
||||
|
||||
<div class="header-block header-block-nav">
|
||||
<ul class="nav-profile">
|
||||
|
||||
|
||||
<li class="profile dropdown">
|
||||
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button"
|
||||
aria-haspopup="true" aria-expanded="false">
|
||||
@@ -49,14 +47,6 @@
|
||||
</a>
|
||||
|
||||
{!! Menu::render('profileMenu', 'profile-menu') !!}
|
||||
|
||||
{{--<div class="dropdown-menu profile-dropdown-menu" aria-labelledby="dropdownMenu1">--}}
|
||||
{{--<a class="dropdown-item" href="#"> <i class="fa fa-user icon"></i> Profile </a>--}}
|
||||
{{--<a class="dropdown-item" href="#"> <i class="fa fa-bell icon"></i> Notifications </a>--}}
|
||||
{{--<a class="dropdown-item" href="#"> <i class="fa fa-gear icon"></i> Settings </a>--}}
|
||||
{{--<div class="dropdown-divider"></div>--}}
|
||||
{{--<a class="dropdown-item" href="{{route('logout')}}"> <i class="fa fa-power-off icon"></i> Logout </a>--}}
|
||||
{{--</div>--}}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="ace-editor-container large">
|
||||
<textarea class="ace-editor-textarea" name="{{$name}}" id="{{$name}}" rows="5">{{$value}}</textarea>
|
||||
<textarea class="ace-editor-textarea" name="{{$name}}" id="{{$name}}" rows="{{$rows or '5'}}">{{$value}}</textarea>
|
||||
|
||||
<div class="ace-editor" id="{{$name}}Editor">{{$value}}</div>
|
||||
</div>
|
||||
|
||||
@@ -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,7 @@
|
||||
@extends('admin.layoutWithNavigation')
|
||||
|
||||
@section('pageHeading', @trans('admin/templates.edit', ['name' => $template->template_name]))
|
||||
|
||||
@section('content')
|
||||
@include('admin.templates.editForm')
|
||||
@stop
|
||||
@@ -0,0 +1,39 @@
|
||||
@if (!$isWritable)
|
||||
<div class="alert alert-warning">
|
||||
@lang('admin/templates.notWritable', ['file' => $path->path])
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<form action="{{route('templates.postEdit', ['id' => $template->id])}}" method="POST">
|
||||
{!! csrf_field() !!}
|
||||
<div class="row">
|
||||
<div class="col-lg-8">
|
||||
@include('admin.snippets.aceEditor', [
|
||||
'value' => old('templateContent', $templateContent),
|
||||
'theme' => 'xcode',
|
||||
'mode' => 'html',
|
||||
'name' => 'templateContent',
|
||||
'rows' => '20'
|
||||
])
|
||||
</div>
|
||||
|
||||
<div class="col-lg-4">
|
||||
<label class="label-control">
|
||||
@lang('admin/templates.name')
|
||||
</label>
|
||||
<input type="text" class="form-control" name="name" value="{{old('name', $template->name)}}" />
|
||||
|
||||
|
||||
<label class="label-control">
|
||||
@lang('admin/templates.description')
|
||||
</label>
|
||||
<textarea class="form-control" name="description"
|
||||
rows="3">{{old('description', $template->description)}}</textarea>
|
||||
|
||||
<button type="submit" class="btn btn-primary">
|
||||
@lang('admin/templates.edit', ['name' => $template->template_name])
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
@extends('admin.layoutWithNavigation')
|
||||
|
||||
@section('pageHeading', @trans('admin/templates.overview'))
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-lg-9">
|
||||
@include('admin.templates.templatesTiles')
|
||||
</div>
|
||||
|
||||
<div class="col-lg-3">
|
||||
<div class="callout">
|
||||
@include('admin.templates.directoriesList')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@stop
|
||||
@@ -0,0 +1,64 @@
|
||||
<div class="tile-overview">
|
||||
@forelse($templates as $template)
|
||||
<div class="col-lg-3">
|
||||
<div class="text-center" title="{{$template->name}}">
|
||||
{{str_limit($template->name, 15)}}
|
||||
</div>
|
||||
<div>
|
||||
{{str_limit($template->description, 150)}}
|
||||
</div>
|
||||
|
||||
@if($isWritable)
|
||||
<a data-template-id="{{$template->id}}" data-template-name="{{$template->template_name}}"
|
||||
class="btn btn-pill-left btn-primary col-lg-6 copy-template"
|
||||
title="@lang('admin/templates.copy')">
|
||||
<i class="fa fa-copy"></i>
|
||||
</a>
|
||||
@else
|
||||
<a href="#" class="btn btn-pill-left btn-primary disabled col-lg-6"
|
||||
title="@lang('admin/templates.cannotCopy')">
|
||||
<i class="fa fa-copy"></i>
|
||||
</a>
|
||||
@endif
|
||||
|
||||
@if ($template->editable)
|
||||
<a href="{{route('templates.edit', ['id' => $template->id])}}"
|
||||
class="btn btn-primary btn-pill-right col-lg-6"
|
||||
title="@lang('admin/templates.edit', ['name' => $template->name])">
|
||||
<i class="fa fa-edit"></i>
|
||||
</a>
|
||||
@endif
|
||||
</div>
|
||||
@empty
|
||||
<div class="alert alert-info">
|
||||
<em>@lang('admin/templates.noTemplates')</em>
|
||||
</div>
|
||||
@endforelse
|
||||
</div>
|
||||
|
||||
@section('javascripts')
|
||||
<script type="text/javascript">
|
||||
$ ('.copy-template').click (function () {
|
||||
var link = $ (this);
|
||||
var templateId = link.data ('template-id');
|
||||
var templateName = link.data ('template-name');
|
||||
templateName = templateName.substr (templateName.search ('::') + 2, templateName.length);
|
||||
|
||||
var newTemplateName = prompt ("@lang('admin/templates.newTemplateName')", templateName + "_" + "@lang('admin/templates.newTemplateNameSuffix')");
|
||||
|
||||
// no name given - give up
|
||||
if (newTemplateName == null) return;
|
||||
|
||||
// copy given template
|
||||
$.post ('{{route('templates.postCopy')}}', {
|
||||
templateId: templateId,
|
||||
newName: newTemplateName,
|
||||
_token: "{{csrf_token()}}"
|
||||
}, function (data) {
|
||||
if (data.status == 'success') {
|
||||
location.reload ();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user