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] 'to' => $statuses[$changeset->new_value]
]); ]);
break; break;
case 'is_homepage':
return trans('admin/history.setupAsHomepage');
break;
default: default:
return trans('admin/history.changedFromTo', [ return trans('admin/history.changedFromTo', [
'from' => $changeset->old_value, 'from' => $changeset->old_value,
@@ -2,6 +2,7 @@
namespace App\Http\Controllers\Admin; namespace App\Http\Controllers\Admin;
use App\Enumerations\ActiveContentStatuses; use App\Enumerations\ActiveContentStatuses;
use App\Http\Requests\CreateNewContentRequest;
use App\Models\Content; use App\Models\Content;
use App\Models\Module; use App\Models\Module;
use App\Models\Template; use App\Models\Template;
@@ -48,8 +49,7 @@ class CreateNewContent extends Controller
/** /**
* Save new content page * Save new content page
* *
* @param CreateNewStaticPageRequest $request * @param CreateNewContentRequest $request
*
* @param $moduleId * @param $moduleId
* *
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
@@ -72,8 +72,8 @@ class CreateNewContent extends Controller
$page->url = Str::slug($request->url); $page->url = Str::slug($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->metaDescription;
$page->meta_description = $request->meta_description; $page->meta_description = $request->metaDescription;
$page->content = $request->pageContent; $page->content = $request->pageContent;
$page->status = $request->status; $page->status = $request->status;
$page->template = $request->template; $page->template = $request->template;
+8 -8
View File
@@ -3,6 +3,7 @@ namespace App\Http\Controllers\Admin;
use App\Enumerations\ContentStatuses; use App\Enumerations\ContentStatuses;
use App\Enumerations\ModulesHandlerToId; use App\Enumerations\ModulesHandlerToId;
use App\Http\Requests\EditContentRequest;
use App\Models\Content; use App\Models\Content;
use App\Models\ContentHistory; use App\Models\ContentHistory;
use App\Models\Template; use App\Models\Template;
@@ -65,12 +66,12 @@ class EditContent extends Controller
/** /**
* Edit static page and save changes into history. * Edit static page and save changes into history.
* *
* @param EditStaticPageRequest $request * @param EditContentRequest $request
* @param $id * @param $id
* *
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function postEdit(EditStaticPageRequest $request, $id) public function postEdit(EditContentRequest $request, $id)
{ {
try { try {
$page = Content::findOrFail($id); $page = Content::findOrFail($id);
@@ -230,7 +231,6 @@ class EditContent extends Controller
* @var $page Content * @var $page Content
*/ */
$page = Content::findOrFail($id); $page = Content::findOrFail($id);
$homepage = $page->getHomepage();
} catch (NotFoundHttpException $e) { } catch (NotFoundHttpException $e) {
// page not found // page not found
return redirect() return redirect()
@@ -238,12 +238,12 @@ class EditContent extends Controller
->with('error', trans('admin/contents.invalidPage')); ->with('error', trans('admin/contents.invalidPage'));
} }
// disable any other existing homepage
Content::where('is_homepage', 1)
->update(['is_homepage' => 0]);
// set new homepage
list ($revision, $changedColumns) = $page->updateWithHistory(['is_homepage' => 'is_homepage'], ['is_homepage' => 1]); list (, $changedColumns) = $page->updateWithHistory(['is_homepage' => 'is_homepage'], ['is_homepage' => 1]);
if ($homepage)
$homepage->updateWithHistory(['isHomepage' => 'is_homepage'], ['ishomepage' => 0]);
// was something changed? // was something changed?
if ($changedColumns == 0) { if ($changedColumns == 0) {
+2 -1
View File
@@ -34,5 +34,6 @@ return [
'appearance' => 'Appearance', 'appearance' => 'Appearance',
'template' => 'Template of this page', 'template' => 'Template of this page',
'overview' => 'List of all content pages', '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', 'columnMetaDescription' => 'Description',
'columnStatus' => 'Page visibility', 'columnStatus' => 'Page visibility',
'columnTemplate' => 'Template', 'columnTemplate' => 'Template',
'columnIs_homepage' => 'Homepage',
'changedFromTo' => 'Changed from <del>:from</del> to <ins>:to</ins>', 'changedFromTo' => 'Changed from <del>:from</del> to <ins>:to</ins>',
'numOfChanges' => 'One change|:count changes', 'numOfChanges' => 'One change|:count changes',
'diff' => 'Difference', 'diff' => 'Difference',
'diffPageName' => 'Difference of :column', 'diffPageName' => 'Difference of :column',
'backToOverview' => 'Back to history overview', 'backToOverview' => 'Back to history overview',
'backToEdit' => 'Back to editation form' 'backToEdit' => 'Back to editation form',
'setupAsHomepage' => 'Setup as homepage'
]; ];
@@ -3,8 +3,7 @@
<label> <label>
@lang('admin/contents.field_meta_keywords') @lang('admin/contents.field_meta_keywords')
<input type="text" name="meta_keywords" value="{{old('meta_keywords', $page->meta_keywords)}}" <input type="text" name="metaKeywords" value="{{old('meta_keywords', $page->meta_keywords)}}" placeholder="@lang('admin/contents.field_meta_keywords')" />
placeholder="@lang('admin/contents.field_meta_keywords')" />
</label> </label>
</div> </div>
</div> </div>
@@ -13,9 +12,7 @@
<label> <label>
@lang('admin/contents.field_meta_description') @lang('admin/contents.field_meta_description')
<textarea name="meta_description" <textarea name="metaDescription" placeholder="@lang('admin/contents.field_meta_description')" rows="5">{{old('meta_description', $page->meta_description)}}</textarea>
placeholder="@lang('admin/contents.field_meta_description')" rows="5">{{old('meta_description', $page->meta_description)}}
</textarea>
</label> </label>
</div> </div>
</div> </div>
@@ -41,7 +41,7 @@
<p class="controls row text-center"> <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) @if($page->is_homepage)
@@ -55,9 +55,8 @@
@if($page->status == \App\Models\Content::STATUS_DRAFT) @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_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> <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 @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>
@if(in_array($page->status, [\App\Models\Content::STATUS_PROTECTED, \App\Models\Content::STATUS_PUBLIC]))
<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> <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 @endif