FEATURE: add displaying errors
This commit is contained in:
@@ -39,17 +39,19 @@ class CreateNewStaticPage extends Controller
|
|||||||
|
|
||||||
$page->user_id = \Auth::user()->id;
|
$page->user_id = \Auth::user()->id;
|
||||||
$page->title = $request->title;
|
$page->title = $request->title;
|
||||||
|
$page->url = $request->url;
|
||||||
$page->published_from = $request->publishedFrom;
|
$page->published_from = $request->publishedFrom;
|
||||||
$page->published_to = $request->publishedTo;
|
$page->published_to = $request->publishedTo;
|
||||||
$page->meta_keywords = $request->meta_description;
|
$page->meta_keywords = $request->meta_description;
|
||||||
$page->meta_description = $request->meta_description;
|
$page->meta_description = $request->meta_description;
|
||||||
$page->content = $request->pageContent;
|
$page->content = $request->pageContent;
|
||||||
|
$page->status = $request->status;
|
||||||
$page->module_handler = config('staticpages.handler');
|
$page->module_handler = config('staticpages.handler');
|
||||||
|
|
||||||
$page->save();
|
$page->save();
|
||||||
|
|
||||||
return redirect()
|
return redirect()
|
||||||
->route('staticpages.new')
|
->route('staticpage.new')
|
||||||
->with('success', trans('admin.successfullyCreated'));
|
->with('success', trans('staticpages::admin.successfullyCreated'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -29,6 +29,6 @@ Route::group([
|
|||||||
->name('staticpage.edit');
|
->name('staticpage.edit');
|
||||||
|
|
||||||
// post method for creating new static page
|
// post method for creating new static page
|
||||||
Route::post('new', 'CreateNewStaticPage@getNew')
|
Route::post('new', 'CreateNewStaticPage@postNew')
|
||||||
->name('staticpage.newPost');
|
->name('staticpage.newPost');
|
||||||
});
|
});
|
||||||
@@ -5,12 +5,13 @@ return [
|
|||||||
'content' => 'Page content',
|
'content' => 'Page content',
|
||||||
'save' => 'Save new page',
|
'save' => 'Save new page',
|
||||||
'basicInfo' => 'Basic information',
|
'basicInfo' => 'Basic information',
|
||||||
'metaOptions' => 'Meta information',
|
'metaOptions' => 'Meta information',
|
||||||
'publicationOptions' => 'Publication setup',
|
'publicationOptions' => 'Publication setup',
|
||||||
'field_title' => 'Page title',
|
'field_title' => 'Page title',
|
||||||
'field_url' => 'URL',
|
'field_url' => 'URL',
|
||||||
'field_meta_keywords' => 'Keywords',
|
'field_meta_keywords' => 'Keywords',
|
||||||
'field_meta_description' => 'Page description',
|
'field_meta_description' => 'Page description',
|
||||||
'field_published_from' => 'Published from',
|
'field_published_from' => 'Published from',
|
||||||
'field_published_to' => 'Published to'
|
'field_published_to' => 'Published to',
|
||||||
|
'successfullyCreated' => 'Page successfully created'
|
||||||
];
|
];
|
||||||
@@ -42,17 +42,33 @@
|
|||||||
|
|
||||||
<input type="text" name="url" placeholder="@lang('staticpages::admin.field_url')"
|
<input type="text" name="url" placeholder="@lang('staticpages::admin.field_url')"
|
||||||
value="{{old('url')}}" />
|
value="{{old('url')}}" />
|
||||||
|
|
||||||
|
@if (isset($errors) && $errors->has('url'))
|
||||||
|
<div class="callout alert">
|
||||||
|
{{ $errors->first('url') }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="columns large-12">
|
<div class="columns large-12">
|
||||||
<select name="status">
|
<label>
|
||||||
@foreach($contentStatuses as $status => $translation)
|
<select name="status">
|
||||||
<option value="{{$status}}" @if($selectedStatus == $status) selected @endif>{{$translation}}</option>
|
@foreach($contentStatuses as $status => $translation)
|
||||||
@endforeach
|
<option value="{{$status}}" @if($selectedStatus== $status) selected @endif>
|
||||||
</select>
|
{{$translation}}
|
||||||
|
</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
@if (isset($errors) && $errors->has('status'))
|
||||||
|
<div class="callout alert">
|
||||||
|
{{ $errors->first('status') }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -60,8 +76,9 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="columns large-12">
|
<div class="columns large-12">
|
||||||
<label>
|
<label>
|
||||||
<textarea placeholder="@lang('staticpages::admin.content')" name="pageContent" id="pageContent"
|
<textarea name="pageContent" id="pageContent" class="wysiwyg-editor">
|
||||||
class="wysiwyg-editor">{{old('pageContent')}}</textarea>
|
{{old('pageContent')}}
|
||||||
|
</textarea>
|
||||||
|
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
@@ -75,6 +92,12 @@
|
|||||||
|
|
||||||
<input type="datetime" name="published_from" value="{{old('published_from')}}"
|
<input type="datetime" name="published_from" value="{{old('published_from')}}"
|
||||||
placeholder="@lang('staticpages::admin.field_published_from')" />
|
placeholder="@lang('staticpages::admin.field_published_from')" />
|
||||||
|
|
||||||
|
@if (isset($errors) && $errors->has('published_from'))
|
||||||
|
<div class="callout alert">
|
||||||
|
{{ $errors->first('published_from') }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -84,6 +107,12 @@
|
|||||||
|
|
||||||
<input type="datetime" name="published_to" value="{{old('published_to')}}"
|
<input type="datetime" name="published_to" value="{{old('published_to')}}"
|
||||||
placeholder="@lang('staticpages::admin.field_published_to')" />
|
placeholder="@lang('staticpages::admin.field_published_to')" />
|
||||||
|
|
||||||
|
@if (isset($errors) && $errors->has('published_to'))
|
||||||
|
<div class="callout alert">
|
||||||
|
{{ $errors->first('published_to') }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -129,8 +158,6 @@
|
|||||||
<script src="{{asset('../resources/assets/js/vendor/trumbowyg/trumbowyg.min.js')}}"></script>
|
<script src="{{asset('../resources/assets/js/vendor/trumbowyg/trumbowyg.min.js')}}"></script>
|
||||||
|
|
||||||
<script type="application/javascript">
|
<script type="application/javascript">
|
||||||
$(document).ready(function () {
|
|
||||||
$('#pageContent').trumbowyg();
|
$('#pageContent').trumbowyg();
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
@stop
|
@stop
|
||||||
Reference in New Issue
Block a user