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
+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) {