Moved page editing to angular controller and started work on update drafts

This commit is contained in:
Dan Brown
2016-03-09 22:32:07 +00:00
parent 1d6137f7e2
commit 59ce228c2e
14 changed files with 202 additions and 32 deletions

View File

@ -142,6 +142,23 @@ class PageController extends Controller
return redirect($page->getUrl());
}
/**
* Save a draft update as a revision.
* @param Request $request
* @param $pageId
* @return \Illuminate\Http\JsonResponse
*/
public function saveUpdateDraft(Request $request, $pageId)
{
$this->validate($request, [
'name' => 'required|string|max:255'
]);
$page = $this->pageRepo->getById($pageId);
$this->checkOwnablePermission('page-update', $page);
$this->pageRepo->saveUpdateDraft($page, $request->only(['name', 'html']));
return response()->json(['status' => 'success', 'message' => 'Draft successfully saved']);
}
/**
* Redirect from a special link url which
* uses the page id rather than the name.