FEATURE #1431: add template edit

This commit is contained in:
Michal Kváček
2016-02-19 15:10:39 +01:00
parent 53395bc47a
commit 57e08b76a8
12 changed files with 413 additions and 14 deletions
+14 -8
View File
@@ -1,11 +1,17 @@
<?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'
'core' => 'Core templates',
'homepage' => 'Home page',
'overview' => 'Templates',
'noSubdirectories' => 'No directories available',
'parentDirectory' => 'Parent directory',
'noTemplates' => 'No templates available',
'new' => 'New template',
'subdirectories' => 'Subdirectories',
'edit' => 'Edit template :name',
'name' => 'Template name',
'description' => 'Template description',
'editSuccessfull' => 'Template successfully edited.',
'notWritable' => 'Cannot write to :file. Any submited changes in this file will <strong>not</strong> be saved!',
'cannotWriteContent' => 'Cannot save template content, directory has unsufficient permissions. Meta information were saved.'
];
@@ -0,0 +1,14 @@
@extends('admin.layout')
@section('pageName', @trans('admin/templates.edit', ['name' => $template->template_name]))
@section('content')
<div class="row">
<h2>@lang('admin/templates.edit', ['name' => $template->template_name])</h2>
</div>
<div class="row">
@include('admin.templates.editForm')
</div>
@stop
@@ -0,0 +1,54 @@
@if (session('success'))
<div data-alert class="callout success">
<strong>{{ session('success') }}</strong>
</div>
@endif
@if (session('error'))
<div data-alert class="callout alert">
<strong>{{ session('error') }}</strong>
</div>
@endif
@if (!$isWritable)
<div data-alert class="callout 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="column large-8">
<div style="height: 30em">
@include('admin.snippets.aceEditor', [
'value' => old('templateContent', $templateContent),
'theme' => 'xcode',
'mode' => 'html',
'name' => 'templateContent'
])
</div>
</div>
<div class="column large-4">
<label>
@lang('admin/templates.name')
<input type="text" name="name" value="{{old('name', $template->name)}}" />
</label>
<label>
@lang('admin/templates.description')
<textarea name="description" rows="3">{{old('description', $template->description)}}</textarea>
</label>
<button type="submit" class="button success">
@lang('admin/templates.edit', ['name' => $template->template_name])
</button>
</div>
</div>
</form>
@@ -5,6 +5,18 @@
@section('content')
<h1>@lang('admin/templates.overview')</h1>
@if (session('success'))
<div data-alert class="callout success">
<strong>{{ session('success') }}</strong>
</div>
@endif
@if (session('error'))
<div data-alert class="callout alert">
<strong>{{ session('error') }}</strong>
</div>
@endif
<div class="row">
<div class="column large-9">
@include('admin.templates.templatesTiles')
View File
@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
@yield('head_meta')
<title>@yield('pageName', @trans('visitor/common.welcome')) | {{$vendorName}}</title>
<link rel="stylesheet" href="{{asset('../resources/assets/css/foundation.min.css')}}" />
<link rel="stylesheet" href="{{asset('../resources/assets/css/font-awesome.min.css')}}" />
<link rel="stylesheet" href="{{asset('../resources/assets/css/admin.css')}}" />
@yield('head_stylesheets')
<link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css">
<style>
html, body {
height: 100%;
}
body {
margin: 0;
padding: 0;
width: 100%;
color: #B0BEC5;
display: table;
font-weight: 100;
font-family: 'Lato';
}
.container {
text-align: center;
display: table-cell;
vertical-align: middle;
}
.content {
text-align: center;
display: inline-block;
}
.title {
font-size: 72px;
margin-bottom: 40px;
}
</style>
</head>
<body>
<div class="container">
<div class="content">
@yield('content')
</div>
</div>
</body>
</html>
View File