FEATURE: make settings translatable

This commit is contained in:
Michal Kváček
2016-07-23 21:47:20 +02:00
parent b89941b909
commit ab3d8eab41
11 changed files with 150 additions and 47 deletions
+3 -2
View File
@@ -11,8 +11,9 @@ return [
'successfullySaved' => 'Settings successfully saved',
'nothingToSave' => 'You have submitted unchanged form. Try to change some attribute first.',
'meta' => 'Meta information',
'socialSites' => 'Social networks',
'social' => [
'commonSettings' => 'Use for all languages?',
'socialSites' => 'Social networks',
'social' => [
'facebook' => 'Facebook profile',
'instagram' => 'Instagram profile',
'twitter' => 'Twitter profile',
+2 -2
View File
@@ -5,7 +5,7 @@
<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('admin/common.admin')) | {{$pageName}}</title>
<title>@yield('pageName', @trans('admin/common.admin')) | {{isset($pageName) ? $pageName : ''}}</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')}}" />
@@ -62,7 +62,7 @@
</div>
<footer class="row text-center">
&copy; {{$pageName}} {{date('Y')}}
&copy; {{isset($pageName) ? $pageName : ''}} {{date('Y')}}
</footer>
</div>
<script src="{{asset('resources/assets/js/vendor/jquery.min.js')}}"></script>
@@ -1,17 +1,27 @@
<label>
@lang('admin/settings.pageName')
<input type="text" name="pageName" value="{{old('pageName', $settings->pageName)}}" />
<input type="text" name="pageName" value="{{old('pageName', isset($settings->pageName) ? $settings->pageName['val'] : '')}}" />
@if (isset($errors) && $errors->has('pageName'))
<div class="callout alert">
{{ $errors->first('pageName') }}
</div>
@endif
</label>
<label>
@lang('admin/settings.author')
<input type="text" name="author" value="{{old('author', $settings->author)}}" />
<input type="text" name="author" value="{{old('author', isset($settings->author) ? $settings->author['val'] : '')}}" />
@include('admin.settings.snippets.commonSettings', ['field' => 'author'])
</label>
<label>
@lang('admin/settings.googleAnalyticsCode')
<input type="text" name="googleAnalyticsCode" value="{{old('googleAnalyticsCode', $settings->googleAnalyticsCode)}}" />
<input type="text" name="googleAnalyticsCode" value="{{old('googleAnalyticsCode', isset($settings->googleAnalyticsCode) ? $settings->googleAnalyticsCode['val'] : '')}}" />
@include('admin.settings.snippets.commonSettings', ['field' => 'googleAnalyticsCode'])
</label>
@@ -1,11 +1,13 @@
<label>
@lang('admin/settings.metaKeywords')
<input type="text" name="metaKeywords" value="{{old('metaKeywords', $settings->metaKeywords)}}" />
<input type="text" name="metaKeywords"
value="{{old('metaKeywords', isset($settings->metaKeywords) ? $settings->metaKeywords['val'] : '')}}" />
</label>
<label>
@lang('admin/settings.metaDescription')
<textarea name="metaDescription" rows="3">{{old('metaDescription', $settings->metaDescription)}}</textarea>
<textarea name="metaDescription"
rows="3">{{old('metaDescription', isset($settings->metaDescription) ? $settings->metaDescription['val'] : '')}}</textarea>
</label>
@@ -1,29 +1,29 @@
<label>
@lang('admin/settings.social.facebook')
<input type="text" name="facebookProfile" value="{{old('facebookProfile', isset($settings->facebookProfile) ? $settings->facebookProfile : '')}}" />
<input type="text" name="facebookProfile" value="{{old('facebookProfile', isset($settings->facebookProfile) ? $settings->facebookProfile['val'] : '')}}" />
</label>
<label>
@lang('admin/settings.social.twitter')
<input type="text" name="twitterProfile" value="{{old('twitterProfile', isset($settings->twitterProfile) ? $settings->twitterProfile : '')}}" />
<input type="text" name="twitterProfile" value="{{old('twitterProfile', isset($settings->twitterProfile) ? $settings->twitterProfile['val'] : '')}}" />
</label>
<label>
@lang('admin/settings.social.pinterest')
<input type="text" name="pinterestProfile" value="{{old('pinterestProfile', isset($settings->pinterestProfile) ? $settings->pinterestProfile : '')}}" />
<input type="text" name="pinterestProfile" value="{{old('pinterestProfile', isset($settings->pinterestProfile) ? $settings->pinterestProfile['val'] : '')}}" />
</label>
<label>
@lang('admin/settings.social.gplus')
<input type="text" name="gplusProfile" value="{{old('gplusProfile', isset($settings->gplusProfile) ? $settings->gplusProfile : '')}}" />
<input type="text" name="gplusProfile" value="{{old('gplusProfile', isset($settings->gplusProfile) ? $settings->gplusProfile['val'] : '')}}" />
</label>
<label>
@lang('admin/settings.social.instagram')
<input type="text" name="instagramProfile" value="{{old('instagramProfile', isset($settings->instagramProfile) ? $settings->instagramProfile : '')}}" />
<input type="text" name="instagramProfile" value="{{old('instagramProfile', isset($settings->instagramProfile) ? $settings->instagramProfile['val'] : '')}}" />
</label>
@@ -0,0 +1,5 @@
<input type="checkbox" name="commonSettings[{{$field}}]" value="1"
@if(!isset($settings->{$field}) || $settings->{$field}['lang'] == null)
checked
@endif />
@lang('admin/settings.commonSettings')
View File