FIX: fixing some missing translations and other minor bugs

This commit is contained in:
Michal Kváček
2016-03-11 16:27:26 +01:00
parent 0a1a25b300
commit a9a4cb70f0
7 changed files with 29 additions and 27 deletions
+3
View File
@@ -34,6 +34,9 @@ class History implements HistoryHandler
'to' => $statuses[$changeset->new_value]
]);
break;
case 'is_homepage':
return trans('admin/history.setupAsHomepage');
break;
default:
return trans('admin/history.changedFromTo', [
'from' => $changeset->old_value,
@@ -2,6 +2,7 @@
namespace App\Http\Controllers\Admin;
use App\Enumerations\ActiveContentStatuses;
use App\Http\Requests\CreateNewContentRequest;
use App\Models\Content;
use App\Models\Module;
use App\Models\Template;
@@ -48,8 +49,7 @@ class CreateNewContent extends Controller
/**
* Save new content page
*
* @param CreateNewStaticPageRequest $request
*
* @param CreateNewContentRequest $request
* @param $moduleId
*
* @return \Illuminate\Http\RedirectResponse
@@ -72,8 +72,8 @@ class CreateNewContent extends Controller
$page->url = Str::slug($request->url);
$page->published_from = $request->publishedFrom;
$page->published_to = $request->publishedTo;
$page->meta_keywords = $request->meta_description;
$page->meta_description = $request->meta_description;
$page->meta_keywords = $request->metaDescription;
$page->meta_description = $request->metaDescription;
$page->content = $request->pageContent;
$page->status = $request->status;
$page->template = $request->template;
+12 -12
View File
@@ -3,6 +3,7 @@ namespace App\Http\Controllers\Admin;
use App\Enumerations\ContentStatuses;
use App\Enumerations\ModulesHandlerToId;
use App\Http\Requests\EditContentRequest;
use App\Models\Content;
use App\Models\ContentHistory;
use App\Models\Template;
@@ -53,24 +54,24 @@ class EditContent extends Controller
// render view
return view('admin.content.edit', [
'contentStatuses' => $statuses,
'page' => $page,
'templates' => $templates,
'contentStatuses' => $statuses,
'page' => $page,
'templates' => $templates,
'formSectionNames' => call_user_func([$page->module_handler, 'getExtendedFormSections']),
'formSections' => call_user_func([$page->module_handler, 'getExtendedFormInputsCreate']),
'historySize' => count($history['changesets'])
'historySize' => count($history['changesets'])
]);
}
/**
* Edit static page and save changes into history.
*
* @param EditStaticPageRequest $request
* @param EditContentRequest $request
* @param $id
*
* @return \Illuminate\Http\RedirectResponse
*/
public function postEdit(EditStaticPageRequest $request, $id)
public function postEdit(EditContentRequest $request, $id)
{
try {
$page = Content::findOrFail($id);
@@ -230,7 +231,6 @@ class EditContent extends Controller
* @var $page Content
*/
$page = Content::findOrFail($id);
$homepage = $page->getHomepage();
} catch (NotFoundHttpException $e) {
// page not found
return redirect()
@@ -238,12 +238,12 @@ class EditContent extends Controller
->with('error', trans('admin/contents.invalidPage'));
}
// disable any other existing homepage
Content::where('is_homepage', 1)
->update(['is_homepage' => 0]);
list ($revision, $changedColumns) = $page->updateWithHistory(['is_homepage' => 'is_homepage'], ['is_homepage' => 1]);
if ($homepage)
$homepage->updateWithHistory(['isHomepage' => 'is_homepage'], ['ishomepage' => 0]);
// set new homepage
list (, $changedColumns) = $page->updateWithHistory(['is_homepage' => 'is_homepage'], ['is_homepage' => 1]);
// was something changed?
if ($changedColumns == 0) {
+2 -1
View File
@@ -34,5 +34,6 @@ return [
'appearance' => 'Appearance',
'template' => 'Template of this page',
'overview' => 'List of all content pages',
'homepageSetup' => 'Homepage successfully set up.'
'homepageSetup' => 'Homepage successfully set up.',
'setHomepage' => 'Set page as homepage'
];
+3 -1
View File
@@ -8,11 +8,13 @@ return [
'columnMetaDescription' => 'Description',
'columnStatus' => 'Page visibility',
'columnTemplate' => 'Template',
'columnIs_homepage' => 'Homepage',
'changedFromTo' => 'Changed from <del>:from</del> to <ins>:to</ins>',
'numOfChanges' => 'One change|:count changes',
'diff' => 'Difference',
'diffPageName' => 'Difference of :column',
'backToOverview' => 'Back to history overview',
'backToEdit' => 'Back to editation form'
'backToEdit' => 'Back to editation form',
'setupAsHomepage' => 'Setup as homepage'
];
@@ -3,8 +3,7 @@
<label>
@lang('admin/contents.field_meta_keywords')
<input type="text" name="meta_keywords" value="{{old('meta_keywords', $page->meta_keywords)}}"
placeholder="@lang('admin/contents.field_meta_keywords')" />
<input type="text" name="metaKeywords" value="{{old('meta_keywords', $page->meta_keywords)}}" placeholder="@lang('admin/contents.field_meta_keywords')" />
</label>
</div>
</div>
@@ -13,9 +12,7 @@
<label>
@lang('admin/contents.field_meta_description')
<textarea name="meta_description"
placeholder="@lang('admin/contents.field_meta_description')" rows="5">{{old('meta_description', $page->meta_description)}}
</textarea>
<textarea name="metaDescription" placeholder="@lang('admin/contents.field_meta_description')" rows="5">{{old('meta_description', $page->meta_description)}}</textarea>
</label>
</div>
</div>
@@ -41,7 +41,7 @@
<p class="controls row text-center">
<a href="{{route('page.content', ['url' => $page->url])}}" class="button tiny secondary has-tip" data-tooltip aria-haspopup="true" title="@lang('admin/contents.viewPage')"><i class="fa fa-desktop"></i></a>
@if($page->is_homepage)
@@ -55,9 +55,8 @@
@if($page->status == \App\Models\Content::STATUS_DRAFT)
<a href="{{route('content.changeStatus', ['id' => $page->id, 'status' => \App\Models\Content::STATUS_PUBLIC])}}" class="button tiny success confirm has-tip" data-tooltip aria-haspopup="true" title="@lang('admin/contents.makePublic')"><i class="fa fa-eye"></i></a>
<a href="{{route('content.changeStatus', ['id' => $page->id, 'status' => \App\Models\Content::STATUS_PROTECTED])}}" class="button tiny warning confirm has-tip" data-tooltip aria-haspopup="true" title="@lang('admin/contents.makeProtected')"><i class="fa fa-lock"></i></a>
@endif
@if(in_array($page->status, [\App\Models\Content::STATUS_PROTECTED, \App\Models\Content::STATUS_PUBLIC]))
@else
<a href="{{route('page.content', ['url' => $page->url])}}" target="_blank" class="button tiny secondary has-tip" data-tooltip aria-haspopup="true" title="@lang('admin/contents.viewPage')"><i class="fa fa-desktop"></i></a>
<a href="{{route('content.changeStatus', ['id' => $page->id, 'status' => \App\Models\Content::STATUS_DRAFT])}}" class="button tiny warning confirm has-tip" data-tooltip aria-haspopup="true" title="@lang('admin/contents.makeDraft')"><i class="fa fa-eye-slash"></i></a>
@endif