pages: fixes for wiki
This commit is contained in:
parent
a0c527078c
commit
da854a0f16
@ -29,6 +29,7 @@ sitemap_dir: /home/user/sitemap
|
||||
uploads_dir: /home/user/files.example.org
|
||||
uploads_path: /uploads
|
||||
files_domain: files.example.org
|
||||
wiki_root: wiki
|
||||
|
||||
# deploy config
|
||||
git_repo: git@github.com:example/example_org.git
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
const ROUTER_VERSION = 9;
|
||||
const ROUTER_VERSION = 10;
|
||||
const ROUTER_MC_KEY = '4in1/routes';
|
||||
|
||||
$RouterInput = [];
|
||||
|
@ -428,7 +428,7 @@ class AdminHandler extends request_handler {
|
||||
|
||||
add_skin_strings_re('/^(err_)?pages_/');
|
||||
add_skin_strings_re('/^(err_)?blog_/');
|
||||
set_title(lang('pages_page_edit_title', $page->shortName.'.html'));
|
||||
set_title(lang('pages_page_edit_title', $page->shortName));
|
||||
static::make_wide();
|
||||
$js_text = [
|
||||
'text' => $page->md,
|
||||
|
@ -50,7 +50,7 @@ class MainHandler extends request_handler {
|
||||
|
||||
if ($page->shortName == 'info')
|
||||
set_skin_opts(['head_section' => 'about']);
|
||||
else if ($page->shortName == 'notes')
|
||||
else if ($page->shortName == $config['wiki_root'])
|
||||
set_skin_opts(['head_section' => $page->shortName]);
|
||||
|
||||
$bc = null;
|
||||
|
@ -17,7 +17,7 @@ class Page extends model {
|
||||
|
||||
function edit(array $fields) {
|
||||
$fields['update_ts'] = time();
|
||||
if ($fields['md'] != $this->md || $fields['render_title'] != $this->renderTitle) {
|
||||
if ($fields['md'] != $this->md || $fields['render_title'] != $this->renderTitle || $fields['title'] != $this->title) {
|
||||
$md = $fields['md'];
|
||||
if ($fields['render_title'])
|
||||
$md = '# '.$fields['title']."\n\n".$md;
|
||||
|
@ -1,13 +1,15 @@
|
||||
<?php
|
||||
|
||||
return (function() {
|
||||
global $config;
|
||||
|
||||
require_once 'lib/files.php';
|
||||
|
||||
$files_collections = array_map(fn(FilesCollection $fn) => $fn->value, FilesCollection::cases());
|
||||
$coll_with_folder_support = [FilesCollection::WilliamFriedman->value, FilesCollection::Baconiana->value];
|
||||
|
||||
$pagename_regex = '[a-zA-Z0-9-]+';
|
||||
$wiki_root = 'notes';
|
||||
$wiki_root = $config['wiki_root'];
|
||||
|
||||
$routes = [
|
||||
'Main' => [
|
||||
@ -37,6 +39,8 @@ return (function() {
|
||||
'('.$pagename_regex.')/create/' => 'page_add short_name=$(1)',
|
||||
$wiki_root.'/('.$pagename_regex.')/{delete,edit}/' => 'page_${1} short_name='.$wiki_root.'/$(1)',
|
||||
$wiki_root.'/('.$pagename_regex.')/create/' => 'page_add short_name='.$wiki_root.'/$(1)',
|
||||
$wiki_root.'/{delete,edit}/' => 'page_${1} short_name='.$wiki_root,
|
||||
$wiki_root.'/create/' => 'page_add short_name='.$wiki_root,
|
||||
'articles/write/' => 'post_add',
|
||||
'articles/('.$pagename_regex.')/{delete,edit}/' => 'post_${1} short_name=$(1)',
|
||||
'admin/markdown-preview.ajax' => 'ajax_md_preview',
|
||||
|
@ -220,12 +220,13 @@ function renderHeader(SkinContext $ctx,
|
||||
?string $section,
|
||||
?string $articles_lang,
|
||||
bool $show_subtitle): string {
|
||||
global $config;
|
||||
$icons = svg();
|
||||
$items = [];
|
||||
$items[] = ['url' => '/articles/'.($articles_lang && $articles_lang != 'en' ? '?lang='.$articles_lang : ''), 'label' => 'articles', 'selected' => $section === 'articles'];
|
||||
$items[] = ['url' => '/files/', 'label' => 'files', 'selected' => $section === 'files'];
|
||||
if (is_admin())
|
||||
$items[] = ['url' => '/notes/', 'label' => 'notes', 'selected' => $section === 'notes'];
|
||||
$items[] = ['url' => '/'.$config['wiki_root'].'/', 'label' => 'wiki', 'selected' => $section === $config['wiki_root']];
|
||||
$items[] = ['url' => '/info/', 'label' => 'about', 'selected' => $section === 'about'];
|
||||
if (is_admin())
|
||||
$items[] = ['url' => '/admin/', 'label' => $icons->settings_28(in_place: true), 'type' => 'settings', 'selected' => $section === 'admin'];
|
||||
|
Loading…
x
Reference in New Issue
Block a user