FEATURE: add saving settings

This commit is contained in:
Michal Kváček
2016-03-14 00:46:09 +01:00
parent 603e989b1e
commit 0313a1239f
10 changed files with 222 additions and 3 deletions
+14
View File
@@ -0,0 +1,14 @@
<?php
return [
'overview' => 'All available settings',
'basic' => 'Basic information',
'save' => 'Save',
'pageName' => 'Page name',
'metaKeywords' => 'Web keywords',
'metaDescription' => 'Web description',
'googleAnalyticsCode' => 'Google Analytics code',
'author' => 'Page owner',
'successfullySaved' => 'Settings successfully saved',
'nothingToSave' => 'You have submitted unchanged form. Try to change some attribute first.',
'meta' => 'Meta information'
];
@@ -0,0 +1,50 @@
@extends('admin.layout')
@section('pageName', @trans('admin/settings.overview'))
@section('content')
<div class="row">
<h2>@lang('admin/settings.overview')</h2>
</div>
@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">
<ul class="tabs" data-tabs id="static-page-controls">
@foreach($formSections as $id => $section)
<li class="tabs-title @if($section->getId() == reset($formSections)->getId()) is-active @endif">
<a href="#{{$id}}" @if($section->getId() == reset($formSections)->getId()) aria-selected="true" @endif>
{{trans($section->getName())}}
</a>
</li>
@endforeach
</ul>
<form action="{{route('settings.save')}}" method="POST">
{!! csrf_field() !!}
<div class="tabs-content" data-tabs-content="static-page-controls">
@foreach($formSections as $id => $section)
<div class="tabs-panel @if($id == reset($formSections)->getId()) is-active @endif" id="{{$section->getId()}}">
@include($section->getView())
</div>
@endforeach
</div>
<div class="row">
<div class="columns large-12">
<button type="submit" class="button success">@lang('admin/settings.save')</button>
</div>
</div>
</form>
</div>
@stop
@@ -0,0 +1,17 @@
<label>
@lang('admin/settings.pageName')
<input type="text" name="pageName" value="{{old('pageName', $settings->pageName)}}" />
</label>
<label>
@lang('admin/settings.author')
<input type="text" name="author" value="{{old('author', $settings->author)}}" />
</label>
<label>
@lang('admin/settings.googleAnalyticsCode')
<input type="text" name="googleAnalyticsCode" value="{{old('googleAnalyticsCode', $settings->googleAnalyticsCode)}}" />
</label>
@@ -0,0 +1,11 @@
<label>
@lang('admin/settings.metaKeywords')
<input type="text" name="metaKeywords" value="{{old('metaKeywords', $settings->metaKeywords)}}" />
</label>
<label>
@lang('admin/settings.metaDescription')
<textarea name="metaDescription" rows="3">{{old('metaDescription', $settings->metaDescription)}}</textarea>
</label>