wiki features

This commit is contained in:
amazuecos
2025-02-23 00:14:07 +01:00
parent f270b6dee8
commit eea947e80b
13 changed files with 251 additions and 33 deletions

View File

@ -43,7 +43,9 @@ class WikiController extends BaseController
$section = $this->wikiSectionModel->where('slug', $slug)->first();
$this->viewData['slug'] = $slug;
$this->viewData['section'] = $section->withAll($this->locale);
$this->viewData['breadcrumb'] = [
['title' => lang("Wiki.".$section->slug), 'route' => route_to('showWikiPage',$slug), 'active' => true],
];
return view('themes/vuexy/wiki/pages/render', $this->viewData);
}
public function get_section(int $section_id)
@ -72,6 +74,24 @@ class WikiController extends BaseController
]);
return $this->response->setJSON(["data" => [], "message" => lang("App.global_alert_save_success")]);
}
public function store_publish_page(int $section_id)
{
$bodyData = $this->request->getPost();
$wikiSectionPage = $this->wikiSectionModel->find($section_id)->page();
if ($wikiSectionPage) {
$wikiPageId = $wikiSectionPage->id;
$this->wikiContentModel->update($wikiPageId,[
"locale" => $this->locale,
"page_id" => $wikiPageId,
"editor_data" => json_encode($bodyData),
"published_data" => json_encode($bodyData)
]);
$response = $this->response->setJSON(["data" => [], "message" => lang("App.global_alert_save_success")]);
} else {
$response = $this->response->setStatusCode(400)->setJSON(["data" => [], "error" => lang('Wiki.errors.publish_before_save')]);
}
return $response;
}
public function wiki_file_upload(int $section_id)
{
try {