From 674992adb0f0815d6917abf0f34945bfbbc8cfc8 Mon Sep 17 00:00:00 2001 From: vidhyasagargm Date: Thu, 12 Sep 2024 15:30:00 +0200 Subject: [PATCH 01/44] #1 cleaned up the branch and implmented numbering to overview and content --- views/page/_view_content.php | 40 +++++++++++++++++++++++++++++++--- widgets/.WikiRichText.php.swp | Bin 0 -> 1024 bytes widgets/PageListItemTitle.php | 23 ++++++++++++++++++- 3 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 widgets/.WikiRichText.php.swp diff --git a/views/page/_view_content.php b/views/page/_view_content.php index 9e9277aa..a2f6ad74 100644 --- a/views/page/_view_content.php +++ b/views/page/_view_content.php @@ -11,20 +11,54 @@ /* @var $page \humhub\modules\wiki\models\WikiPage */ /* @var $canEdit bool */ /* @var $content string */ + +// Function to add Numbering into the content +function addNumberingToHeaders($content) { + $headerCounters = [0, 0, 0, 0, 0, 0]; // To keep track of header levels + + // Regex to match markdown headers (e.g., #, ##, ###) + return preg_replace_callback('/^(#+)\s*(.+)/m', function ($matches) use (&$headerCounters) { + $headerLevel = strlen($matches[1]); + + // Reset counters for deeper levels + for ($i = $headerLevel; $i < 6; $i++) { + $headerCounters[$i] = 0; + } + + // Increment the counter for the current header level + $headerCounters[$headerLevel - 1]++; + + // Build the numbering string (e.g., 1.2.3) + $numbering = ''; + for ($i = 0; $i < $headerLevel; $i++) { + if ($headerCounters[$i] > 0) { + $numbering .= $headerCounters[$i] . '.'; + } + } + + // Return the header with the numbering added + return $matches[1] . ' ' . trim($numbering, '.') . ' ' . $matches[2]; + }, $content); +} + +// Apply header numbering to the content before rendering it +if (!empty($content)) { + $content = addNumberingToHeaders($content); +} + ?>
content->getTags(Topic::class)->all() as $topic) : ?> - +

title) ?>

- render('_view_category_index', ['page' => $page]) ?>
data-ui-init style="display:none"> - 'wiki-page-richtext']) ?> + 'wiki-page-richtext']) ?>

diff --git a/widgets/.WikiRichText.php.swp b/widgets/.WikiRichText.php.swp new file mode 100644 index 0000000000000000000000000000000000000000..33ebc40aa3987aa2e017be521e319c0cfe0fe8f9 GIT binary patch literal 1024 zcmYc?$V<%2S1{KzVn6|F-1r!Z^7Bhj1aWZ6GE*`t6N?km6N_}iGK)$|6LXyMD=-y@ gXJ%&xWhQ5Yq*j#Z6=W1(su&d+4S~@Rpl1jG04PQjzW@LL literal 0 HcmV?d00001 diff --git a/widgets/PageListItemTitle.php b/widgets/PageListItemTitle.php index fa8ead57..ab119140 100644 --- a/widgets/PageListItemTitle.php +++ b/widgets/PageListItemTitle.php @@ -89,10 +89,12 @@ public function run() $this->page->childrenCount) { $this->titleInfo = Yii::t('WikiModule.base', '({n,plural,=1{+1 subpage}other{+{count} subpages}})', ['n' => $this->page->childrenCount, 'count' => $this->page->childrenCount]); } + // Generate numbering for categories and pages + $numbering = $this->generateNumbering($this->level); return $this->render('pageListItemTitle', [ 'page' => $this->page, - 'title' => $this->title, + 'title' =>$numbering.' '. $this->title, 'titleIcon' => $this->getVisibilityIcon(), 'titleInfo' => $this->titleInfo, 'url' => $this->page ? $this->page->getUrl() : null, @@ -103,6 +105,25 @@ public function run() 'level' => $this->level, ]); } + protected function generateNumbering($level) + { + static $numbering = []; + + // Increment numbering for the current level + if (!isset($numbering[$level])) { + $numbering[$level] = 1; + } else { + $numbering[$level]++; + } + + // Reset numbering for deeper levels + for ($i = $level + 1; $i < count($numbering); $i++) { + $numbering[$i] = 0; + } + + // Build the numbering string (e.g., "1", "2.1", "2.2") + return implode('.', array_filter($numbering)); + } public function getOptions(): array { From 90d784000579b440b8bed9ffdd24293e40e26ace Mon Sep 17 00:00:00 2001 From: vidhyasagargm <85664242+vidhyasagargm@users.noreply.github.com> Date: Wed, 18 Sep 2024 01:24:39 -0700 Subject: [PATCH 02/44] Update widgets/PageListItemTitle.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marius Meißner --- widgets/PageListItemTitle.php | 1 + 1 file changed, 1 insertion(+) diff --git a/widgets/PageListItemTitle.php b/widgets/PageListItemTitle.php index ab119140..4b4ef70a 100644 --- a/widgets/PageListItemTitle.php +++ b/widgets/PageListItemTitle.php @@ -105,6 +105,7 @@ public function run() 'level' => $this->level, ]); } + protected function generateNumbering($level) { static $numbering = []; From e591a418b063d946b177ce3fb76deade0c526fc7 Mon Sep 17 00:00:00 2001 From: vidhyasagargm <85664242+vidhyasagargm@users.noreply.github.com> Date: Wed, 18 Sep 2024 12:00:53 +0200 Subject: [PATCH 03/44] Delete widgets/.WikiRichText.php.swp --- widgets/.WikiRichText.php.swp | Bin 1024 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 widgets/.WikiRichText.php.swp diff --git a/widgets/.WikiRichText.php.swp b/widgets/.WikiRichText.php.swp deleted file mode 100644 index 33ebc40aa3987aa2e017be521e319c0cfe0fe8f9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1024 zcmYc?$V<%2S1{KzVn6|F-1r!Z^7Bhj1aWZ6GE*`t6N?km6N_}iGK)$|6LXyMD=-y@ gXJ%&xWhQ5Yq*j#Z6=W1(su&d+4S~@Rpl1jG04PQjzW@LL From 59ee21db284ca034bd48466fb7ddda4e125f5ae6 Mon Sep 17 00:00:00 2001 From: vidhyasagargm Date: Wed, 18 Sep 2024 12:03:08 +0200 Subject: [PATCH 04/44] added unit testing for numbering logic --- .../unit/PageListItemTitleTest.php | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/codeception/unit/PageListItemTitleTest.php diff --git a/tests/codeception/unit/PageListItemTitleTest.php b/tests/codeception/unit/PageListItemTitleTest.php new file mode 100644 index 00000000..eeaecb38 --- /dev/null +++ b/tests/codeception/unit/PageListItemTitleTest.php @@ -0,0 +1,30 @@ +generateNumbering(0); + $this->assertEquals('1', $numbering, 'Numbering at level 0 is incorrect.'); + + // Test level 1 numbering + $numbering = $widget->generateNumbering(1); + $this->assertEquals('1.1', $numbering, 'Numbering at level 1 is incorrect.'); + + // Test level 2 numbering + $numbering = $widget->generateNumbering(2); + $this->assertEquals('1.1.1', $numbering, 'Numbering at level 2 is incorrect.'); + + // Reset and increment first level again + $numbering = $widget->generateNumbering(0); + $this->assertEquals('2', $numbering, 'Second increment of level 0 is incorrect.'); + } +} From 0dc8f5d2d13eecd0d5bbb638c4e9ced5a9b3e1bd Mon Sep 17 00:00:00 2001 From: vidhyasagargm Date: Wed, 18 Sep 2024 13:24:34 +0200 Subject: [PATCH 05/44] Revert "Merge branch '1-content-overview-title-numbering' of https://github.com/Neo-Atlas/humhub_wiki into 1-content-overview-title-numbering" This reverts commit b1e21c5975de84dc5d176665e250033b48e57abd, reversing changes made to 59ee21db284ca034bd48466fb7ddda4e125f5ae6. --- widgets/.WikiRichText.php.swp | Bin 0 -> 1024 bytes widgets/PageListItemTitle.php | 1 - 2 files changed, 1 deletion(-) create mode 100644 widgets/.WikiRichText.php.swp diff --git a/widgets/.WikiRichText.php.swp b/widgets/.WikiRichText.php.swp new file mode 100644 index 0000000000000000000000000000000000000000..33ebc40aa3987aa2e017be521e319c0cfe0fe8f9 GIT binary patch literal 1024 zcmYc?$V<%2S1{KzVn6|F-1r!Z^7Bhj1aWZ6GE*`t6N?km6N_}iGK)$|6LXyMD=-y@ gXJ%&xWhQ5Yq*j#Z6=W1(su&d+4S~@Rpl1jG04PQjzW@LL literal 0 HcmV?d00001 diff --git a/widgets/PageListItemTitle.php b/widgets/PageListItemTitle.php index 4b4ef70a..ab119140 100644 --- a/widgets/PageListItemTitle.php +++ b/widgets/PageListItemTitle.php @@ -105,7 +105,6 @@ public function run() 'level' => $this->level, ]); } - protected function generateNumbering($level) { static $numbering = []; From 3d1df8b39364f30ee7daf5e1fad4833d9827783c Mon Sep 17 00:00:00 2001 From: vidhyasagargm Date: Wed, 18 Sep 2024 17:02:51 +0200 Subject: [PATCH 06/44] #1 Toggle button for numbering pagelist with unit testing --- .../unit/PageListItemTitleTest.php | 57 +++++++++++++++++++ views/overview/list-categories.php | 8 +++ widgets/PageListItemTitle.php | 52 +++++++++++------ 3 files changed, 101 insertions(+), 16 deletions(-) diff --git a/tests/codeception/unit/PageListItemTitleTest.php b/tests/codeception/unit/PageListItemTitleTest.php index eeaecb38..d3806c1a 100644 --- a/tests/codeception/unit/PageListItemTitleTest.php +++ b/tests/codeception/unit/PageListItemTitleTest.php @@ -3,6 +3,10 @@ use humhub\modules\wiki\widgets\PageListItemTitle; use Codeception\Test\Unit; +use Yii; +use yii\web\Request; +// use yii\helpers\Url; +use humhub\modules\wiki\helpers\Url; class PageListItemTitleTest extends Unit { @@ -27,4 +31,57 @@ public function testGenerateNumbering() $numbering = $widget->generateNumbering(0); $this->assertEquals('2', $numbering, 'Second increment of level 0 is incorrect.'); } + + // Test when numbering is enabled + public function testButtonWhenNumberingEnabled() + { + // Simulate a request with the 'numbering' parameter set to 'enabled' + Yii::$app->set('request', new Request([ + 'queryParams' => ['numbering' => 'enabled'] + ])); + + // Check if numbering is enabled + $numbering_enabled = Yii::$app->request->get('numbering', 'disabled') === 'enabled'; + + // Assert that the numbering is enabled + $this->assertTrue($numbering_enabled); + + // Use a valid route in Url::to() as it is hard to simulate Url::current() + $url = Url::to(['/wiki/overview/list-categories', 'numbering' => 'disabled']); + $expectedUrl = '/index-test.php?r=wiki%2Foverview%2Flist-categories&numbering=disabled'; + + // Assert that the correct URL is generated + $this->assertEquals($expectedUrl, $url); + + // Assert that the button label is correct + $buttonLabel = $numbering_enabled ? 'Disable Numbering' : 'Enable Numbering'; + $this->assertEquals('Disable Numbering', $buttonLabel); + } + + // Test when numbering is disabled + public function testButtonWhenNumberingDisabled() + { + // Simulate a request with the 'numbering' parameter set to 'disabled' + Yii::$app->set('request', new Request([ + 'queryParams' => ['numbering' => 'disabled'] + ])); + + // Check if numbering is disabled + $numbering_enabled = Yii::$app->request->get('numbering', 'disabled') === 'enabled'; + + // Assert that the numbering is disabled + $this->assertFalse($numbering_enabled); + + /// Use a valid route in Url::to() as it is hard to simulate Url::current() + $url = Url::to(['/wiki/overview/list-categories', 'numbering' => 'enabled']); + $expectedUrl = '/index-test.php?r=wiki%2Foverview%2Flist-categories&numbering=enabled'; + + // Assert that the correct URL is generated + $this->assertEquals($expectedUrl, $url); + + // Assert that the button label is correct + $buttonLabel = $numbering_enabled ? 'Disable Numbering' : 'Enable Numbering'; + $this->assertEquals('Enable Numbering', $buttonLabel); + } + } diff --git a/views/overview/list-categories.php b/views/overview/list-categories.php index cfb43355..16fc1ffa 100644 --- a/views/overview/list-categories.php +++ b/views/overview/list-categories.php @@ -40,6 +40,14 @@
sm()->link(Url::toLastEdited($contentContainer))->cssClass(Helper::isEnterpriseTheme() ? 'hidden-lg' : '') ?> icon('fa-plus')->sm()->link(Url::toWikiCreate($contentContainer))->visible($canCreate) ?> + request->get('numbering', 'disabled') === 'enabled'; + ?> + + + +
diff --git a/widgets/PageListItemTitle.php b/widgets/PageListItemTitle.php index ab119140..ca916e36 100644 --- a/widgets/PageListItemTitle.php +++ b/widgets/PageListItemTitle.php @@ -89,23 +89,43 @@ public function run() $this->page->childrenCount) { $this->titleInfo = Yii::t('WikiModule.base', '({n,plural,=1{+1 subpage}other{+{count} subpages}})', ['n' => $this->page->childrenCount, 'count' => $this->page->childrenCount]); } - // Generate numbering for categories and pages - $numbering = $this->generateNumbering($this->level); - - return $this->render('pageListItemTitle', [ - 'page' => $this->page, - 'title' =>$numbering.' '. $this->title, - 'titleIcon' => $this->getVisibilityIcon(), - 'titleInfo' => $this->titleInfo, - 'url' => $this->page ? $this->page->getUrl() : null, - 'icon' => $this->icon ?? $icon, - 'showDrag' => $this->showDrag, - 'showAddPage' => $this->showAddPage, - 'options' => $this->getOptions(), - 'level' => $this->level, - ]); + + // Generate numbering for categories and pages + $numbering_enabled = Yii::$app->request->get('numbering', 'disabled') === 'enabled'; + + // Generate numbering for categories and pages + if($numbering_enabled){ + $number = $this->generateNumbering($this->level); + return $this->render('pageListItemTitle', [ + 'page' => $this->page, + 'title' =>$number.' '. $this->title, + 'titleIcon' => $this->getVisibilityIcon(), + 'titleInfo' => $this->titleInfo, + 'url' => $this->page ? $this->page->getUrl() : null, + 'icon' => $this->icon ?? $icon, + 'showDrag' => $this->showDrag, + 'showAddPage' => $this->showAddPage, + 'options' => $this->getOptions(), + 'level' => $this->level, + ]); + } + else { + return $this->render('pageListItemTitle', [ + 'page' => $this->page, + 'title' => $this->title, + 'titleIcon' => $this->getVisibilityIcon(), + 'titleInfo' => $this->titleInfo, + 'url' => $this->page ? $this->page->getUrl() : null, + 'icon' => $this->icon ?? $icon, + 'showDrag' => $this->showDrag, + 'showAddPage' => $this->showAddPage, + 'options' => $this->getOptions(), + 'level' => $this->level, + ]); + } } - protected function generateNumbering($level) + + public function generateNumbering($level) { static $numbering = []; From b1c56d50ca791c9d59888d80bc43c1e8a91a7dad Mon Sep 17 00:00:00 2001 From: vidhyasagargm Date: Fri, 20 Sep 2024 13:07:02 +0200 Subject: [PATCH 07/44] #1 Fixed double numbering in content and added a button --- views/page/_view_body.php | 10 +++++- views/page/_view_content.php | 65 ++++++++++++++++++++---------------- widgets/views/menu.php | 11 ++++++ 3 files changed, 57 insertions(+), 29 deletions(-) diff --git a/views/page/_view_body.php b/views/page/_view_body.php index 055c5106..c22ff4d7 100644 --- a/views/page/_view_body.php +++ b/views/page/_view_body.php @@ -11,6 +11,8 @@ use humhub\modules\wiki\assets\Assets; use humhub\modules\wiki\models\WikiPage; use humhub\modules\wiki\models\WikiPageRevision; +use humhub\modules\wiki\helpers\Url; + /* @var $this View */ /* @var $page WikiPage */ @@ -19,10 +21,16 @@ /* @var $canEdit bool */ Assets::register($this); + +// Determine the current numbering state from the URL parameter +$numbering_enabled = Yii::$app->request->get('numbering', 'disabled') === 'enabled'; + ?> + render('_view_header', ['page' => $page, 'revision' => $revision, 'displayTitle' => false]) ?> -
+ +
> render('_view_content', ['page' => $page, 'canEdit' => $canEdit, 'content' => $content]) ?>
diff --git a/views/page/_view_content.php b/views/page/_view_content.php index a2f6ad74..f0e120c8 100644 --- a/views/page/_view_content.php +++ b/views/page/_view_content.php @@ -12,41 +12,50 @@ /* @var $canEdit bool */ /* @var $content string */ -// Function to add Numbering into the content -function addNumberingToHeaders($content) { - $headerCounters = [0, 0, 0, 0, 0, 0]; // To keep track of header levels +?> + + -// Apply header numbering to the content before rendering it -if (!empty($content)) { - $content = addNumberingToHeaders($content); -} -?>
content->getTags(Topic::class)->all() as $topic) : ?> diff --git a/widgets/views/menu.php b/widgets/views/menu.php index 92b8a31b..16069a84 100644 --- a/widgets/views/menu.php +++ b/widgets/views/menu.php @@ -8,12 +8,23 @@ use humhub\libs\Html; use humhub\modules\ui\menu\MenuEntry; use humhub\modules\wiki\widgets\WikiMenu; +use humhub\modules\wiki\helpers\Url; /* @var $menu WikiMenu */ /* @var $entries MenuEntry[] */ /* @var $options array */ + +// Determine the current numbering state from the URL parameter +$numbering_enabled = Yii::$app->request->get('numbering', 'disabled') === 'enabled'; + ?>
+ + + + + + buttons as $button) : ?> renderButton($button) ?> From 7dd22b108db782de75c8d9c741f3e1f63deae8a0 Mon Sep 17 00:00:00 2001 From: vidhyasagargm Date: Fri, 20 Sep 2024 16:25:41 +0200 Subject: [PATCH 08/44] #1 Fixed double numbering in content and added a button --- views/page/_view_content.php | 45 +++++++++--------------------------- 1 file changed, 11 insertions(+), 34 deletions(-) diff --git a/views/page/_view_content.php b/views/page/_view_content.php index f0e120c8..c164bf69 100644 --- a/views/page/_view_content.php +++ b/views/page/_view_content.php @@ -13,46 +13,23 @@ /* @var $content string */ ?> + From 531d360f39eb657d3abe7f194bc5939857c2c313 Mon Sep 17 00:00:00 2001 From: vidhyasagargm <85664242+vidhyasagargm@users.noreply.github.com> Date: Fri, 20 Sep 2024 07:32:40 -0700 Subject: [PATCH 09/44] Delete widgets/.WikiRichText.php.swp --- widgets/.WikiRichText.php.swp | Bin 1024 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 widgets/.WikiRichText.php.swp diff --git a/widgets/.WikiRichText.php.swp b/widgets/.WikiRichText.php.swp deleted file mode 100644 index 33ebc40aa3987aa2e017be521e319c0cfe0fe8f9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1024 zcmYc?$V<%2S1{KzVn6|F-1r!Z^7Bhj1aWZ6GE*`t6N?km6N_}iGK)$|6LXyMD=-y@ gXJ%&xWhQ5Yq*j#Z6=W1(su&d+4S~@Rpl1jG04PQjzW@LL From c9e2ba46348a344d69ae7c2ba2e0bf1e1a76a12b Mon Sep 17 00:00:00 2001 From: vidhyasagargm Date: Wed, 25 Sep 2024 12:12:37 +0200 Subject: [PATCH 10/44] #1 Implemented German Language for button content --- messages/de/base.php | 2 ++ views/overview/list-categories.php | 2 +- widgets/views/menu.php | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/messages/de/base.php b/messages/de/base.php index b7c00dad..24062455 100644 --- a/messages/de/base.php +++ b/messages/de/base.php @@ -86,4 +86,6 @@ 'Hide Navigation Entries of this module globally by default' => '', 'Hide Navigation Entry' => '', 'No wiki pages found.' => '', + 'Enable Numbering' => 'Nummerierung umschalten', + 'Disable Numbering' => 'Nummerierung abschaltbar', ]; diff --git a/views/overview/list-categories.php b/views/overview/list-categories.php index 16fc1ffa..682469ec 100644 --- a/views/overview/list-categories.php +++ b/views/overview/list-categories.php @@ -46,7 +46,7 @@ ?> - +
diff --git a/widgets/views/menu.php b/widgets/views/menu.php index 16069a84..cd297580 100644 --- a/widgets/views/menu.php +++ b/widgets/views/menu.php @@ -22,7 +22,7 @@ - + buttons as $button) : ?> From ffeb277bae24dcf601eea47e4e2f8b763ad8284d Mon Sep 17 00:00:00 2001 From: vidhyasagargm <85664242+vidhyasagargm@users.noreply.github.com> Date: Wed, 25 Sep 2024 03:20:52 -0700 Subject: [PATCH 11/44] Update _view_body.php removed addditional empty spaces --- views/page/_view_body.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/views/page/_view_body.php b/views/page/_view_body.php index c22ff4d7..d55f15a2 100644 --- a/views/page/_view_body.php +++ b/views/page/_view_body.php @@ -13,7 +13,6 @@ use humhub\modules\wiki\models\WikiPageRevision; use humhub\modules\wiki\helpers\Url; - /* @var $this View */ /* @var $page WikiPage */ /* @var $revision WikiPageRevision */ @@ -21,12 +20,9 @@ /* @var $canEdit bool */ Assets::register($this); - // Determine the current numbering state from the URL parameter $numbering_enabled = Yii::$app->request->get('numbering', 'disabled') === 'enabled'; - ?> - render('_view_header', ['page' => $page, 'revision' => $revision, 'displayTitle' => false]) ?> @@ -43,4 +39,4 @@ ]) ?>
- $page]) ?> \ No newline at end of file + $page]) ?> From f8862059625b3b885a75b4a26fb13668a7ed8d01 Mon Sep 17 00:00:00 2001 From: vidhyasagargm <85664242+vidhyasagargm@users.noreply.github.com> Date: Wed, 25 Sep 2024 03:29:12 -0700 Subject: [PATCH 12/44] Update _view_content.php removed additional space and tabspace --- views/page/_view_content.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/views/page/_view_content.php b/views/page/_view_content.php index c164bf69..409dc820 100644 --- a/views/page/_view_content.php +++ b/views/page/_view_content.php @@ -11,7 +11,6 @@ /* @var $page \humhub\modules\wiki\models\WikiPage */ /* @var $canEdit bool */ /* @var $content string */ - ?> @@ -35,16 +34,17 @@
content->getTags(Topic::class)->all() as $topic) : ?> - +

title) ?>

+ render('_view_category_index', ['page' => $page]) ?>
data-ui-init style="display:none"> - 'wiki-page-richtext']) ?> + 'wiki-page-richtext']) ?>

From 855c04ce975606d5f6866d12a901030604199bdb Mon Sep 17 00:00:00 2001 From: vidhyasagargm <85664242+vidhyasagargm@users.noreply.github.com> Date: Wed, 25 Sep 2024 03:36:11 -0700 Subject: [PATCH 13/44] Update _view_content.php --- views/page/_view_content.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/page/_view_content.php b/views/page/_view_content.php index 409dc820..482c20f4 100644 --- a/views/page/_view_content.php +++ b/views/page/_view_content.php @@ -34,7 +34,7 @@
content->getTags(Topic::class)->all() as $topic) : ?> - +
From e1979a585a064d4396400f5cef96488684ab7848 Mon Sep 17 00:00:00 2001 From: vidhyasagargm Date: Tue, 1 Oct 2024 11:56:10 +0200 Subject: [PATCH 14/44] #1 toggle for numbering fixed appearance on edit page --- views/page/_view_header.php | 14 +++++++++++++- widgets/views/menu.php | 13 +------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/views/page/_view_header.php b/views/page/_view_header.php index eea72089..a059bcf0 100644 --- a/views/page/_view_header.php +++ b/views/page/_view_header.php @@ -18,16 +18,28 @@ if (empty($buttons)) { $buttons = WikiMenu::LINK_EDIT; } + +// Determine the current numbering state from the URL parameter +$numbering_enabled = Yii::$app->request->get('numbering', 'disabled') === 'enabled'; + ?> + +
$page]) ?> +
+ + + + +
$page, 'buttons' => $buttons, 'revision' => $revision ?? null - ]) ?> + ]) ?>
diff --git a/widgets/views/menu.php b/widgets/views/menu.php index cd297580..2de517f1 100644 --- a/widgets/views/menu.php +++ b/widgets/views/menu.php @@ -8,23 +8,12 @@ use humhub\libs\Html; use humhub\modules\ui\menu\MenuEntry; use humhub\modules\wiki\widgets\WikiMenu; -use humhub\modules\wiki\helpers\Url; /* @var $menu WikiMenu */ /* @var $entries MenuEntry[] */ /* @var $options array */ - -// Determine the current numbering state from the URL parameter -$numbering_enabled = Yii::$app->request->get('numbering', 'disabled') === 'enabled'; - ?>
- - - - - - buttons as $button) : ?> renderButton($button) ?> @@ -41,4 +30,4 @@ -
+
\ No newline at end of file From 6d93c5eb1793e23092bf3e1a19a46b11e1253d03 Mon Sep 17 00:00:00 2001 From: vidhyasagargm <85664242+vidhyasagargm@users.noreply.github.com> Date: Tue, 1 Oct 2024 03:11:54 -0700 Subject: [PATCH 15/44] Update _view_body.php From f17a7adee006d341bd02a8acfe3f11ba10f365b6 Mon Sep 17 00:00:00 2001 From: vidhyasagargm Date: Tue, 1 Oct 2024 12:45:23 +0200 Subject: [PATCH 16/44] Restore menu.php --- widgets/views/menu.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/widgets/views/menu.php b/widgets/views/menu.php index 2de517f1..92b8a31b 100644 --- a/widgets/views/menu.php +++ b/widgets/views/menu.php @@ -30,4 +30,4 @@ -
\ No newline at end of file + From add39f14c971d30f8a3a1a9a3e7e1e08cb0bd027 Mon Sep 17 00:00:00 2001 From: vidhyasagargm <85664242+vidhyasagargm@users.noreply.github.com> Date: Wed, 2 Oct 2024 14:39:04 -0700 Subject: [PATCH 17/44] Update widgets/PageListItemTitle.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marius Meißner --- widgets/PageListItemTitle.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/widgets/PageListItemTitle.php b/widgets/PageListItemTitle.php index ca916e36..6d333e64 100644 --- a/widgets/PageListItemTitle.php +++ b/widgets/PageListItemTitle.php @@ -91,7 +91,7 @@ public function run() } // Generate numbering for categories and pages - $numbering_enabled = Yii::$app->request->get('numbering', 'disabled') === 'enabled'; + $numberingEnabled = Yii::$app->request->get('numbering', 'disabled') === 'enabled'; // Generate numbering for categories and pages if($numbering_enabled){ From b14519e7e4102e740a7fd1c1b7ae50d80ddaacfa Mon Sep 17 00:00:00 2001 From: vidhyasagargm <85664242+vidhyasagargm@users.noreply.github.com> Date: Wed, 2 Oct 2024 14:45:02 -0700 Subject: [PATCH 18/44] Update widgets/PageListItemTitle.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marius Meißner --- widgets/PageListItemTitle.php | 40 +++++++++++------------------------ 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/widgets/PageListItemTitle.php b/widgets/PageListItemTitle.php index 6d333e64..bf6bfabe 100644 --- a/widgets/PageListItemTitle.php +++ b/widgets/PageListItemTitle.php @@ -94,34 +94,18 @@ public function run() $numberingEnabled = Yii::$app->request->get('numbering', 'disabled') === 'enabled'; // Generate numbering for categories and pages - if($numbering_enabled){ - $number = $this->generateNumbering($this->level); - return $this->render('pageListItemTitle', [ - 'page' => $this->page, - 'title' =>$number.' '. $this->title, - 'titleIcon' => $this->getVisibilityIcon(), - 'titleInfo' => $this->titleInfo, - 'url' => $this->page ? $this->page->getUrl() : null, - 'icon' => $this->icon ?? $icon, - 'showDrag' => $this->showDrag, - 'showAddPage' => $this->showAddPage, - 'options' => $this->getOptions(), - 'level' => $this->level, - ]); - } - else { - return $this->render('pageListItemTitle', [ - 'page' => $this->page, - 'title' => $this->title, - 'titleIcon' => $this->getVisibilityIcon(), - 'titleInfo' => $this->titleInfo, - 'url' => $this->page ? $this->page->getUrl() : null, - 'icon' => $this->icon ?? $icon, - 'showDrag' => $this->showDrag, - 'showAddPage' => $this->showAddPage, - 'options' => $this->getOptions(), - 'level' => $this->level, - ]); + return $this->render('pageListItemTitle', [ + 'page' => $this->page, + 'title' => $numberingEnabled ? ($this->generateNumbering($this->level) . ' ' . $this->title) : $this->title, + 'titleIcon' => $this->getVisibilityIcon(), + 'titleInfo' => $this->titleInfo, + 'url' => $this->page ? $this->page->getUrl() : null, + 'icon' => $this->icon ?? $icon, + 'showDrag' => $this->showDrag, + 'showAddPage' => $this->showAddPage, + 'options' => $this->getOptions(), + 'level' => $this->level, + ]); } } From 6dc658cd9ee2843d7ba38eeb0701acaeebf384c4 Mon Sep 17 00:00:00 2001 From: vidhyasagargm Date: Fri, 4 Oct 2024 21:18:30 +0200 Subject: [PATCH 19/44] #1 Added CSS styling to css file and changed naming convention --- resources/css/humhub.wiki.min.css | 6 +++++- views/overview/list-categories.php | 6 +++--- views/page/_view_body.php | 4 ++-- views/page/_view_content.php | 20 -------------------- views/page/_view_header.php | 9 +++------ widgets/PageListItemTitle.php | 1 - 6 files changed, 13 insertions(+), 33 deletions(-) diff --git a/resources/css/humhub.wiki.min.css b/resources/css/humhub.wiki.min.css index f6ea1e63..7998a3b1 100644 --- a/resources/css/humhub.wiki.min.css +++ b/resources/css/humhub.wiki.min.css @@ -1 +1,5 @@ -.layout-content-container .wiki-welcome h1{font-size:36px;font-weight:700}.layout-content-container .wiki-welcome h2{font-size:14px;font-weight:200;line-height:24px;margin:10px 100px}@media (max-width:768px){.layout-content-container .wiki-welcome h2{margin:10px}}.layout-content-container .wiki-bg{padding:150px 0 150px;background-repeat:no-repeat;background-position:center 100px}@media only screen and (max-width:520px){.layout-content-container .wiki-bg{background-size:contain}}.layout-content-container .wiki-page-path{padding-right:8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:13px;font-weight:600;color:var(--text-color-highlight)}.layout-content-container .wiki-page-path.wiki-page-path-length-0 .fa{font-size:28px}@media only screen and (max-width:520px){.layout-content-container .wiki-page-path .wiki-page-path-categories{display:none}.layout-content-container .wiki-page-path .fa{font-size:28px}}@media only screen and (max-width:1199px){.layout-content-container .wiki-page-path .wiki-page-path-first-categories{display:none}}.layout-content-container .wiki-menu{white-space:nowrap}.layout-content-container .wiki-menu .btn-group{margin-left:4px}.layout-content-container .wiki-page-index{border:1px solid #eee;border-radius:4px;padding:3px 5px;margin:30px 0}@media (min-width:480px){.layout-content-container .wiki-page-index{width:50%}}.layout-content-container .wiki-page-index .nav{padding:0;margin:0}.layout-content-container .wiki-page-index .nav li{margin:2px 0}.layout-content-container .wiki-page-index .nav li a{padding:3px 15px;color:var(--info)!important}.layout-content-container .wiki-page-index .nav li a>span{font-weight:600;color:var(--text-color-highlight)!important;margin-right:10px}.layout-content-container .wiki-page-index .nav li:first-child a{font-size:14px;font-weight:600;color:var(--text-color-highlight)!important}.layout-content-container .wiki-page-index .wiki-page-index-section .header-anchor{text-overflow:ellipsis;overflow:hidden;padding-left:20px}.layout-content-container .wiki-page-index .wiki-page-index-section-level2 .header-anchor{padding-left:50px}.layout-content-container .wiki-page-index .wiki-page-index-section-level3 .header-anchor{padding-left:80px}.layout-content-container .current-anchor-header{background:var(--background-color-highlight);width:fit-content;border-radius:4px}.layout-content-container #wiki-page-edit .ProseMirror-menubar-wrapper{z-index:8}.layout-content-container #wiki-page-edit .ProseMirror{min-height:150px!important}.layout-content-container .wiki-content hr.dashed,.layout-content-container .wiki-page-index hr.dashed{border-style:dashed}.layout-content-container .wiki-page-content{min-height:220px}.layout-content-container .wiki-page-content .topic-label-list{margin-bottom:10px}.layout-content-container .wiki-page-content .wiki-page-title{font-size:1.75em;font-weight:500;color:var(--text-color-highlight);clear:both}.layout-content-container .wiki-page-content .wiki-page-title i.fa{margin-right:4px}.layout-content-container .wiki-page-content .wiki-page-body{padding:0 30px 30px}.layout-content-container .wiki-page-content .wiki-headline{padding-bottom:8px;margin-bottom:10px;border-bottom:1px solid #eee}.layout-content-container .wiki-page-content .wiki-headline .wiki-headline-top{display:flex;justify-content:space-between;align-items:center}.layout-content-container .wiki-page-content .wiki-headline .label{margin-left:2px}.layout-content-container .wiki-page-content .wiki-headline .wiki-page-path a{color:var(--info)}.layout-content-container .wiki-page-content .wiki-headline .wiki-page-path a:hover{color:var(--text-color-highlight)}.layout-content-container .wiki-page-content hr.wiki-headline-seperator{margin:20px 0 10px}.layout-content-container .wiki-page-content .wiki-category-list-item{padding-bottom:0!important;position:relative}.layout-content-container .wiki-page-content .wiki-category-list-sort-fixer{position:absolute;visibility:hidden}.layout-content-container .wiki-page-content .markdown-render{margin-bottom:10px}.layout-content-container .wiki-page-content .wiki-sub-pages{border:1px solid #ddd;padding:15px 0;margin-bottom:10px}@media (min-width:480px){.layout-content-container .wiki-page-content .wiki-sub-pages{width:50%}}.layout-content-container .wiki-page-content .wiki-sub-pages ul.wiki-page-list{margin-bottom:0;padding-left:2px}.layout-content-container .wiki-page-content .wiki-sub-pages ul.wiki-page-list .page-title .fa{font-size:11px;color:var(--text-color-main);margin:0 5px}.layout-content-container .wiki-page-content .wiki-sub-pages ul.wiki-page-list .page-title:hover{border-color:transparent}.layout-content-container .wiki-page-content .wiki-sub-pages a,.layout-content-container .wiki-page-content .wiki-sub-pages span.page-title-info{font-size:13px;font-weight:500;color:var(--text-color-main)}.layout-content-container .wiki-page-content .wiki-sub-pages a{color:var(--info)}.layout-content-container .wiki-page-content .wiki-sub-pages ul.wiki-page-list{padding:0}.layout-content-container .wiki-page-content .wiki-sub-pages ul.wiki-page-list .page-title{padding-top:0;padding-bottom:0}.layout-content-container .wiki-page-content .wiki-sub-pages span.page-title-text{display:inline-block;margin-bottom:10px;color:var(--text-color-highlight);font-weight:600}.layout-content-container .wiki-page-list-row-details,.layout-content-container .wiki-page-list-row-details .time,.layout-content-container .wiki-page-list-row-details a{color:var(--text-color-secondary);font-size:12px}.layout-content-container .wiki-content .wiki-content-info{margin-top:5px}.layout-content-container .wiki-content .wiki-content-info a{color:var(--text-color-main)}.layout-content-container .wiki-content .wiki-content-info a:hover{color:var(--info)}.layout-content-container .wiki-content [data-wiki-page]{color:#ec4332!important}.layout-content-container .wiki-content [data-wiki-page="#"]{color:#4cc159!important}.layout-content-container .wiki-content .social-controls,.layout-content-container .wiki-content .social-controls a{font-size:11px;color:var(--text-color-soft2);margin-bottom:10px}.layout-content-container .wiki-content .wall-entry-controls .like{font-size:11px;color:var(--text-color-soft2)}.layout-content-container .wiki-content ul.wiki-page-list{list-style:none;padding-left:0}.layout-content-container .wiki-content ul.wiki-page-list.wiki-page-list-droppable-target{height:15px;bottom:9px;position:absolute;width:100%;display:block!important}.layout-content-container .wiki-content ul.wiki-page-list.wiki-page-list-droppable-target li{display:none!important}.layout-content-container .wiki-content ul.wiki-page-list.wiki-page-list-droppable-target .ui-sortable-drop-area{margin-top:10px!important;border:none!important}.layout-content-container .wiki-content ul.wiki-page-list li{font-size:14px;padding-bottom:6px}.layout-content-container .wiki-content ul.wiki-page-list .wiki-list-item-selected{background:var(--background-color-highlight-soft)}.layout-content-container .wiki-content ul.wiki-page-list .wiki-list-item-selected>.page-title{background:var(--background-color-highlight)}.layout-content-container .wiki-content ul.wiki-page-list .page-title{padding:4px 12px;border:1px solid transparent;border-radius:4px;display:flex;cursor:pointer;transition:background 1s ease}.layout-content-container .wiki-content ul.wiki-page-list .page-title .fa[class*=fa-caret]{cursor:default}.layout-content-container .wiki-content ul.wiki-page-list .page-title:hover{border-color:var(--info)}.layout-content-container .wiki-content ul.wiki-page-list .page-title:hover .wiki-category-add{display:block}.layout-content-container .wiki-content ul.wiki-page-list .page-title:not(.page-is-category) .page-title-text{padding-left:24px}.layout-content-container .wiki-content ul.wiki-page-list .page-title .wiki-page-control{color:var(--text-color-secondary)}.layout-content-container .wiki-content ul.wiki-page-list .page-title .wiki-page-control.wiki-category-add{color:var(--text-color-highlight);margin-left:8px}.layout-content-container .wiki-content ul.wiki-page-list .page-title .wiki-category-add{display:none}.layout-content-container .wiki-content ul.wiki-page-list .page-title .fa{font-size:14px}.layout-content-container .wiki-content ul.wiki-page-list .page-title .fa-caret-down{margin:0 6px}.layout-content-container .wiki-content ul.wiki-page-list .page-title .fa-caret-right{margin:0 8px 0 7px}.layout-content-container .wiki-content ul.wiki-page-list .page-title>div{display:flex;overflow:hidden}.layout-content-container .wiki-content ul.wiki-page-list .page-title>div .page-title-text{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.layout-content-container .wiki-content ul.wiki-page-list .page-title>div>i.fa{padding:3px 2px}.layout-content-container .wiki-content ul.wiki-page-list .page-title .page-title-icon{margin-left:8px}.layout-content-container .wiki-content ul.wiki-page-list .page-title .page-title-icon .page-title-icon-visibility{color:var(--text-color-soft2)}.layout-content-container .wiki-content ul.wiki-page-list .page-title.wiki-page-dropped{background:rgba(255,193,7,.12)}.layout-content-container .wiki-content ul.wiki-page-list.wiki-page-is-dropping ul.wiki-page-list:not(.wiki-page-list-droppable-target){padding-top:25px;margin-top:-25px}.layout-content-container .wiki-content ul.wiki-page-list.wiki-page-is-dropping li:not(.wiki-current-target-category-over)>.page-title:hover{border-color:transparent!important}.layout-content-container .wiki-content ul.wiki-page-list.wiki-page-is-dropping .wiki-category-add{display:none!important}.layout-content-container .wiki-content ul.wiki-page-list.wiki-page-is-dropping .drag-icon{visibility:hidden!important}.layout-content-container .wiki-content ul.wiki-page-history{list-style:none;margin-left:22px;padding-left:0;border-left:1px dashed #aeaeae}.layout-content-container .wiki-content ul.wiki-page-history.wiki-page-history-with-diff li{padding-left:56px}.layout-content-container .wiki-content ul.wiki-page-history li{padding:20px 18px;position:relative}.layout-content-container .wiki-content ul.wiki-page-history li:first-child::before{content:'';background:var(--background-color-main);display:block;position:absolute;top:0;left:-1px;width:1px;height:38px}.layout-content-container .wiki-content ul.wiki-page-history li h4.media-heading{font-size:16px;font-weight:600}.layout-content-container .wiki-content ul.wiki-page-history li h5{margin-bottom:0;color:var(--text-color-highlight);font-size:13px}.layout-content-container .wiki-content ul.wiki-page-history li .horizontal-line{position:absolute;left:2px;top:38px;letter-spacing:1px;border-top:1px dashed #aeaeae}.layout-content-container .wiki-content ul.wiki-page-history li .horizontal-line input[type=radio]{position:relative;right:-27px;top:-9px}.layout-content-container .wiki-content ul.wiki-page-history li .wiki-author-link{color:var(--text-color-soft2);text-decoration:underline}.layout-content-container .wiki-content ul.wiki-page-history li .media{padding:0 11px}.layout-content-container .wiki-content ul.wiki-page-history li .alert{padding:10px;margin-bottom:0}.layout-content-container .wiki-content ul.wiki-page-history li .alert .horizontal-line{top:48px}.layout-content-container .wiki-content button.wiki-page-history-btn-compare{margin-left:15px}.layout-content-container .wiki-content.wiki-page-diff ins{text-decoration:none;background-color:#d4fcbc}.layout-content-container .wiki-content.wiki-page-diff del{text-decoration:line-through;background-color:#fbb6c2;color:var(--text-color-main)}.layout-content-container .wiki-page-history-title{padding-left:15px;font-weight:600;font-size:20px}.layout-content-container .wiki-page-history-title .fa{font-size:14px}.layout-content-container .wiki-content .new{color:#4cc159}.layout-content-container .wiki-content .delete{color:#ec4332}.layout-content-container .wiki-content .history{color:#ff8a00}.layout-content-container .wiki-content .fa-link{color:#7880dd;margin-right:4px}.layout-content-container .wiki-content .back{color:var(--text-color-main)}@media (max-width:768px){.wiki-page-content{min-height:220px}}.wiki-page-content-header{display:flex;margin-bottom:10px;padding:10px 10px}.wiki-page-content-header h3{color:var(--text-color-highlight);float:left;font-size:28px;white-space:nowrap;margin:0 30px 0 0;padding:0 0 0 15px}.wiki-page-content-header h3 .fa{font-size:20px;margin-right:8px;position:relative;top:-3px}.wiki-page-content-header .wiki-search-form{margin:0 0 10px}.wiki-page-content-header .wiki-page-content-header-actions{float:right;padding-top:5px}.wiki-page-content-header .wiki-page-content-header-actions .btn{margin-bottom:4px}.wiki-page-content-header .wiki-search-form{width:100%;max-width:none;margin-right:50px!important}.wiki-page-content-header .wiki-page-content-header-actions{white-space:nowrap}@media (max-width:991px){.wiki-page-content-header .wiki-search-form{margin-right:10px!important}}@media (max-width:479px){.wiki-page-content-header{display:block!important}.wiki-page-content-header .wiki-search-form{width:auto;margin-right:0!important}.wiki-page-content-header .wiki-page-content-header-actions{white-space:normal}}.wiki-page-header-wrapper p:last-child{margin:0 0 1.2em}.wiki-page-header-wrapper:last-child p:last-child{margin:0}.wiki-page-header-wrapper a.header-edit-link{display:none;color:var(--text-color-main)!important}.wiki-page-header-wrapper:hover .header-edit-link{display:inline}.wiki-page-header-wrapper h1:hover a,.wiki-page-header-wrapper h2:hover a,.wiki-page-header-wrapper h3:hover a{display:inline!important}.wiki-search-form{float:right;position:relative;margin-left:4px;max-width:168px}.wiki-search-form input[name=keyword]{background:#f3f3f3;font-size:13px;border:none;color:var(--text-color-main);padding-left:26px;height:36px;min-height:36px}.wiki-search-form input[name=keyword]::placeholder{color:var(--text-color-secondary)!important;opacity:1}.wiki-search-form input[name=keyword]:not(:placeholder-shown)+button[type=submit] i.fa{color:var(--text-color-main)!important}.wiki-search-form button[type=submit]{position:absolute;top:0;background:0 0;padding:5px 8px}.wiki-search-form button[type=submit]:focus{background:0 0;box-shadow:none}.wiki-search-form button[type=submit] i.fa{color:var(--text-color-secondary)!important;margin-top:6px}#category_list_view.wiki-page-list>li>div>.page-title-text{font-weight:600}#category_list_view .wiki-current-target-category>.page-title{border-color:var(--info)}#category_list_view .ui-sortable-drop-area+.wiki-current-target-category>.page-title{border-color:transparent}#category_list_view .wiki-current-dropping-page{background:rgba(33,161,179,.12)}#category_list_view .wiki-current-dropping-page+.ui-sortable-drop-area{display:none}#category_list_view .ui-sortable-helper{visibility:hidden}#category_list_view .ui-sortable-helper .fa{display:none}#category_list_view .ui-sortable-drop-area{border-bottom:2px solid #000;margin-top:-6px;margin-bottom:-2px}#category_list_view .drag-icon{visibility:hidden;color:var(--text-color-soft2)}#category_list_view .drag-icon .fa{font-size:11px}#category_list_view .page-title:hover .drag-icon{visibility:visible;cursor:move}.wiki-page-sidebar{padding-right:0;position:relative}.wiki-page-sidebar #category_list_view.wiki-page-list{padding:0 0 10px 0;margin:0 -14px}.wiki-page-sidebar #category_list_view.wiki-page-list .page-title{padding-left:12px;padding-right:12px}.wiki-page-sidebar .wiki-page-content{padding:0 4px}.wiki-page-sidebar .wiki-page-content-header{display:block;padding:3px 0 0;border:none}@media (max-width:1199px){.wiki-page-sidebar .wiki-page-content-header{display:flex}}.wiki-page-sidebar .wiki-page-content-header h3{font-size:28px;font-weight:600;color:var(--text-color-highlight);padding:0;margin:5px 0}.wiki-page-sidebar .wiki-page-content-header h3 .fa{font-size:16px;margin:0}.wiki-page-sidebar .wiki-page-content-header .btn-add-page{float:left;padding:4px 6px;margin:9px 0 0 9px;line-height:9px}.wiki-page-sidebar .wiki-page-content-header .btn-add-page:active{padding:3px 5px}.wiki-page-sidebar .wiki-page-content-header .wiki-page-content-header-actions{padding:0}.wiki-page-sidebar .wiki-search-form{margin:55px 0 15px;display:block;float:none;clear:both;max-width:none}.wiki-page-sidebar .wiki-content ul.wiki-page-list .page-title:hover{border-radius:0}.wiki-page-sidebar .ui-resizable-handle.ui-resizable-e{cursor:ew-resize}@media (max-width:1199px){.wiki-page-sidebar{padding-right:15px}.wiki-page-sidebar:not(.visible-lg){width:100%!important}.wiki-page-sidebar:not(.visible-lg) .ui-resizable-handle{display:none}.wiki-page-sidebar #category_list_view.wiki-page-list{margin-left:0;margin-right:0}.wiki-page-sidebar #category_list_view.wiki-page-list .page-title:hover{border-radius:4px}.wiki-page-sidebar .wiki-page-content-header{padding:14px 8px 20px}.wiki-page-sidebar .wiki-page-content-header h3{color:var(--text-color-main);font-weight:400;text-transform:none;font-size:12px;margin-right:16px}.wiki-page-sidebar .wiki-page-content-header h3,.wiki-page-sidebar .wiki-page-content-header h3 .fa{font-size:28px}.wiki-page-sidebar .wiki-page-content-header .btn-sm{padding:4px 8px;margin-top:4px}.wiki-page-sidebar .wiki-page-content-header .btn-add-page{display:none}.wiki-page-sidebar .wiki-search-form{float:left;clear:none;max-width:none;margin:0}}.wiki-page-list-table .wiki-search-form{float:left}.wiki-page-list-table .table-responsive{padding-left:15px;padding-right:15px}.wiki-page-list-table .table-responsive .grid-view{padding:15px 0}.wiki-page-list-table .table-responsive .grid-view .pagination{margin-bottom:0}.wiki-page-list-table .table-responsive table a:hover{color:var(--info)}.wiki-page-list-table .table-responsive table .wiki-page-list-row-title{font-size:14px;font-weight:500}.wiki-page-list-table .table-responsive table .wiki-page-list-row-title a{display:block}.wiki-page-list-table .table-responsive table .wiki-page-list-row-title a:hover{color:var(--text-color-highlight)}.wiki-page-list-table .table-responsive table td{font-size:14px;border:none}.wiki-page-list-table .table-responsive table td:hover{cursor:pointer}.wiki-page-list-table .table-responsive table td:first-child{padding-left:12px;border-top-left-radius:4px;border-bottom-left-radius:4px}.wiki-page-list-table .table-responsive table td:last-child{border-top-right-radius:4px;border-bottom-right-radius:4px}.wiki-page-list-table .table-responsive .pagination>.active>a,.wiki-page-list-table .table-responsive .pagination>.active>a:focus,.wiki-page-list-table .table-responsive .pagination>.active>a:hover,.wiki-page-list-table .table-responsive .pagination>.active>span,.wiki-page-list-table .table-responsive .pagination>.active>span:focus,.wiki-page-list-table .table-responsive .pagination>.active>span:hover{background-color:var(--info);border-color:var(--info)}@media (max-width:1199px){.wiki-page-list-table .table-responsive{border:none}.wiki-right-part:not(.visible-lg){width:100%!important}}@media (max-width:768px){.layout-content-container .wiki-page-content .wiki-page-body{padding-left:0;padding-right:0}}.wiki-preview{border:1px solid #e1e1e1;border-radius:4px;padding:10px}.wiki-preview .wiki-preview-content{margin-bottom:10px}.wiki-icon-print{float:right;cursor:pointer}@media print{#topbar-first,.comment-container,.footer-nav,.social-controls,.space-nav,.wiki-content-info,.wiki-icon-print,.wiki-menu{display:none}.layout-content-container .wiki-content{border:none}.space-layout-container{margin:0}#page-content-wrapper{padding:0}} \ No newline at end of file +.layout-content-container .wiki-welcome h1{font-size:36px;font-weight:700}.layout-content-container .wiki-welcome h2{font-size:14px;font-weight:200;line-height:24px;margin:10px 100px}@media (max-width:768px){.layout-content-container .wiki-welcome h2{margin:10px}}.layout-content-container .wiki-bg{padding:150px 0 150px;background-repeat:no-repeat;background-position:center 100px}@media only screen and (max-width:520px){.layout-content-container .wiki-bg{background-size:contain}}.layout-content-container .wiki-page-path{padding-right:8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:13px;font-weight:600;color:var(--text-color-highlight)}.layout-content-container .wiki-page-path.wiki-page-path-length-0 .fa{font-size:28px}@media only screen and (max-width:520px){.layout-content-container .wiki-page-path .wiki-page-path-categories{display:none}.layout-content-container .wiki-page-path .fa{font-size:28px}}@media only screen and (max-width:1199px){.layout-content-container .wiki-page-path .wiki-page-path-first-categories{display:none}}.layout-content-container .wiki-menu{white-space:nowrap}.layout-content-container .wiki-menu .btn-group{margin-left:4px}.layout-content-container .wiki-page-index{border:1px solid #eee;border-radius:4px;padding:3px 5px;margin:30px 0}@media (min-width:480px){.layout-content-container .wiki-page-index{width:50%}}.layout-content-container .wiki-page-index .nav{padding:0;margin:0}.layout-content-container .wiki-page-index .nav li{margin:2px 0}.layout-content-container .wiki-page-index .nav li a{padding:3px 15px;color:var(--info)!important}.layout-content-container .wiki-page-index .nav li a>span{font-weight:600;color:var(--text-color-highlight)!important;margin-right:10px}.layout-content-container .wiki-page-index .nav li:first-child a{font-size:14px;font-weight:600;color:var(--text-color-highlight)!important}.layout-content-container .wiki-page-index .wiki-page-index-section .header-anchor{text-overflow:ellipsis;overflow:hidden;padding-left:20px}.layout-content-container .wiki-page-index .wiki-page-index-section-level2 .header-anchor{padding-left:50px}.layout-content-container .wiki-page-index .wiki-page-index-section-level3 .header-anchor{padding-left:80px}.layout-content-container .current-anchor-header{background:var(--background-color-highlight);width:fit-content;border-radius:4px}.layout-content-container #wiki-page-edit .ProseMirror-menubar-wrapper{z-index:8}.layout-content-container #wiki-page-edit .ProseMirror{min-height:150px!important}.layout-content-container .wiki-content hr.dashed,.layout-content-container .wiki-page-index hr.dashed{border-style:dashed}.layout-content-container .wiki-page-content{min-height:220px}.layout-content-container .wiki-page-content .topic-label-list{margin-bottom:10px}.layout-content-container .wiki-page-content .wiki-page-title{font-size:1.75em;font-weight:500;color:var(--text-color-highlight);clear:both}.layout-content-container .wiki-page-content .wiki-page-title i.fa{margin-right:4px}.layout-content-container .wiki-page-content .wiki-page-body{padding:0 30px 30px}.layout-content-container .wiki-page-content .wiki-headline{padding-bottom:8px;margin-bottom:10px;border-bottom:1px solid #eee}.layout-content-container .wiki-page-content .wiki-headline .wiki-headline-top{display:flex;justify-content:space-between;align-items:center}.layout-content-container .wiki-page-content .wiki-headline .label{margin-left:2px}.layout-content-container .wiki-page-content .wiki-headline .wiki-page-path a{color:var(--info)}.layout-content-container .wiki-page-content .wiki-headline .wiki-page-path a:hover{color:var(--text-color-highlight)}.layout-content-container .wiki-page-content hr.wiki-headline-seperator{margin:20px 0 10px}.layout-content-container .wiki-page-content .wiki-category-list-item{padding-bottom:0!important;position:relative}.layout-content-container .wiki-page-content .wiki-category-list-sort-fixer{position:absolute;visibility:hidden}.layout-content-container .wiki-page-content .markdown-render{margin-bottom:10px}.layout-content-container .wiki-page-content .wiki-sub-pages{border:1px solid #ddd;padding:15px 0;margin-bottom:10px}@media (min-width:480px){.layout-content-container .wiki-page-content .wiki-sub-pages{width:50%}}.layout-content-container .wiki-page-content .wiki-sub-pages ul.wiki-page-list{margin-bottom:0;padding-left:2px}.layout-content-container .wiki-page-content .wiki-sub-pages ul.wiki-page-list .page-title .fa{font-size:11px;color:var(--text-color-main);margin:0 5px}.layout-content-container .wiki-page-content .wiki-sub-pages ul.wiki-page-list .page-title:hover{border-color:transparent}.layout-content-container .wiki-page-content .wiki-sub-pages a,.layout-content-container .wiki-page-content .wiki-sub-pages span.page-title-info{font-size:13px;font-weight:500;color:var(--text-color-main)}.layout-content-container .wiki-page-content .wiki-sub-pages a{color:var(--info)}.layout-content-container .wiki-page-content .wiki-sub-pages ul.wiki-page-list{padding:0}.layout-content-container .wiki-page-content .wiki-sub-pages ul.wiki-page-list .page-title{padding-top:0;padding-bottom:0}.layout-content-container .wiki-page-content .wiki-sub-pages span.page-title-text{display:inline-block;margin-bottom:10px;color:var(--text-color-highlight);font-weight:600}.layout-content-container .wiki-page-list-row-details,.layout-content-container .wiki-page-list-row-details .time,.layout-content-container .wiki-page-list-row-details a{color:var(--text-color-secondary);font-size:12px}.layout-content-container .wiki-content .wiki-content-info{margin-top:5px}.layout-content-container .wiki-content .wiki-content-info a{color:var(--text-color-main)}.layout-content-container .wiki-content .wiki-content-info a:hover{color:var(--info)}.layout-content-container .wiki-content [data-wiki-page]{color:#ec4332!important}.layout-content-container .wiki-content [data-wiki-page="#"]{color:#4cc159!important}.layout-content-container .wiki-content .social-controls,.layout-content-container .wiki-content .social-controls a{font-size:11px;color:var(--text-color-soft2);margin-bottom:10px}.layout-content-container .wiki-content .wall-entry-controls .like{font-size:11px;color:var(--text-color-soft2)}.layout-content-container .wiki-content ul.wiki-page-list{list-style:none;padding-left:0}.layout-content-container .wiki-content ul.wiki-page-list.wiki-page-list-droppable-target{height:15px;bottom:9px;position:absolute;width:100%;display:block!important}.layout-content-container .wiki-content ul.wiki-page-list.wiki-page-list-droppable-target li{display:none!important}.layout-content-container .wiki-content ul.wiki-page-list.wiki-page-list-droppable-target .ui-sortable-drop-area{margin-top:10px!important;border:none!important}.layout-content-container .wiki-content ul.wiki-page-list li{font-size:14px;padding-bottom:6px}.layout-content-container .wiki-content ul.wiki-page-list .wiki-list-item-selected{background:var(--background-color-highlight-soft)}.layout-content-container .wiki-content ul.wiki-page-list .wiki-list-item-selected>.page-title{background:var(--background-color-highlight)}.layout-content-container .wiki-content ul.wiki-page-list .page-title{padding:4px 12px;border:1px solid transparent;border-radius:4px;display:flex;cursor:pointer;transition:background 1s ease}.layout-content-container .wiki-content ul.wiki-page-list .page-title .fa[class*=fa-caret]{cursor:default}.layout-content-container .wiki-content ul.wiki-page-list .page-title:hover{border-color:var(--info)}.layout-content-container .wiki-content ul.wiki-page-list .page-title:hover .wiki-category-add{display:block}.layout-content-container .wiki-content ul.wiki-page-list .page-title:not(.page-is-category) .page-title-text{padding-left:24px}.layout-content-container .wiki-content ul.wiki-page-list .page-title .wiki-page-control{color:var(--text-color-secondary)}.layout-content-container .wiki-content ul.wiki-page-list .page-title .wiki-page-control.wiki-category-add{color:var(--text-color-highlight);margin-left:8px}.layout-content-container .wiki-content ul.wiki-page-list .page-title .wiki-category-add{display:none}.layout-content-container .wiki-content ul.wiki-page-list .page-title .fa{font-size:14px}.layout-content-container .wiki-content ul.wiki-page-list .page-title .fa-caret-down{margin:0 6px}.layout-content-container .wiki-content ul.wiki-page-list .page-title .fa-caret-right{margin:0 8px 0 7px}.layout-content-container .wiki-content ul.wiki-page-list .page-title>div{display:flex;overflow:hidden}.layout-content-container .wiki-content ul.wiki-page-list .page-title>div .page-title-text{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.layout-content-container .wiki-content ul.wiki-page-list .page-title>div>i.fa{padding:3px 2px}.layout-content-container .wiki-content ul.wiki-page-list .page-title .page-title-icon{margin-left:8px}.layout-content-container .wiki-content ul.wiki-page-list .page-title .page-title-icon .page-title-icon-visibility{color:var(--text-color-soft2)}.layout-content-container .wiki-content ul.wiki-page-list .page-title.wiki-page-dropped{background:rgba(255,193,7,.12)}.layout-content-container .wiki-content ul.wiki-page-list.wiki-page-is-dropping ul.wiki-page-list:not(.wiki-page-list-droppable-target){padding-top:25px;margin-top:-25px}.layout-content-container .wiki-content ul.wiki-page-list.wiki-page-is-dropping li:not(.wiki-current-target-category-over)>.page-title:hover{border-color:transparent!important}.layout-content-container .wiki-content ul.wiki-page-list.wiki-page-is-dropping .wiki-category-add{display:none!important}.layout-content-container .wiki-content ul.wiki-page-list.wiki-page-is-dropping .drag-icon{visibility:hidden!important}.layout-content-container .wiki-content ul.wiki-page-history{list-style:none;margin-left:22px;padding-left:0;border-left:1px dashed #aeaeae}.layout-content-container .wiki-content ul.wiki-page-history.wiki-page-history-with-diff li{padding-left:56px}.layout-content-container .wiki-content ul.wiki-page-history li{padding:20px 18px;position:relative}.layout-content-container .wiki-content ul.wiki-page-history li:first-child::before{content:'';background:var(--background-color-main);display:block;position:absolute;top:0;left:-1px;width:1px;height:38px}.layout-content-container .wiki-content ul.wiki-page-history li h4.media-heading{font-size:16px;font-weight:600}.layout-content-container .wiki-content ul.wiki-page-history li h5{margin-bottom:0;color:var(--text-color-highlight);font-size:13px}.layout-content-container .wiki-content ul.wiki-page-history li .horizontal-line{position:absolute;left:2px;top:38px;letter-spacing:1px;border-top:1px dashed #aeaeae}.layout-content-container .wiki-content ul.wiki-page-history li .horizontal-line input[type=radio]{position:relative;right:-27px;top:-9px}.layout-content-container .wiki-content ul.wiki-page-history li .wiki-author-link{color:var(--text-color-soft2);text-decoration:underline}.layout-content-container .wiki-content ul.wiki-page-history li .media{padding:0 11px}.layout-content-container .wiki-content ul.wiki-page-history li .alert{padding:10px;margin-bottom:0}.layout-content-container .wiki-content ul.wiki-page-history li .alert .horizontal-line{top:48px}.layout-content-container .wiki-content button.wiki-page-history-btn-compare{margin-left:15px}.layout-content-container .wiki-content.wiki-page-diff ins{text-decoration:none;background-color:#d4fcbc}.layout-content-container .wiki-content.wiki-page-diff del{text-decoration:line-through;background-color:#fbb6c2;color:var(--text-color-main)}.layout-content-container .wiki-page-history-title{padding-left:15px;font-weight:600;font-size:20px}.layout-content-container .wiki-page-history-title .fa{font-size:14px}.layout-content-container .wiki-content .new{color:#4cc159}.layout-content-container .wiki-content .delete{color:#ec4332}.layout-content-container .wiki-content .history{color:#ff8a00}.layout-content-container .wiki-content .fa-link{color:#7880dd;margin-right:4px}.layout-content-container .wiki-content .back{color:var(--text-color-main)}@media (max-width:768px){.wiki-page-content{min-height:220px}}.wiki-page-content-header{display:flex;margin-bottom:10px;padding:10px 10px}.wiki-page-content-header h3{color:var(--text-color-highlight);float:left;font-size:28px;white-space:nowrap;margin:0 30px 0 0;padding:0 0 0 15px}.wiki-page-content-header h3 .fa{font-size:20px;margin-right:8px;position:relative;top:-3px}.wiki-page-content-header .wiki-search-form{margin:0 0 10px}.wiki-page-content-header .wiki-page-content-header-actions{float:right;padding-top:5px}.wiki-page-content-header .wiki-page-content-header-actions .btn{margin-bottom:4px}.wiki-page-content-header .wiki-search-form{width:100%;max-width:none;margin-right:50px!important}.wiki-page-content-header .wiki-page-content-header-actions{white-space:nowrap}@media (max-width:991px){.wiki-page-content-header .wiki-search-form{margin-right:10px!important}}@media (max-width:479px){.wiki-page-content-header{display:block!important}.wiki-page-content-header .wiki-search-form{width:auto;margin-right:0!important}.wiki-page-content-header .wiki-page-content-header-actions{white-space:normal}}.wiki-page-header-wrapper p:last-child{margin:0 0 1.2em}.wiki-page-header-wrapper:last-child p:last-child{margin:0}.wiki-page-header-wrapper a.header-edit-link{display:none;color:var(--text-color-main)!important}.wiki-page-header-wrapper:hover .header-edit-link{display:inline}.wiki-page-header-wrapper h1:hover a,.wiki-page-header-wrapper h2:hover a,.wiki-page-header-wrapper h3:hover a{display:inline!important}.wiki-search-form{float:right;position:relative;margin-left:4px;max-width:168px}.wiki-search-form input[name=keyword]{background:#f3f3f3;font-size:13px;border:none;color:var(--text-color-main);padding-left:26px;height:36px;min-height:36px}.wiki-search-form input[name=keyword]::placeholder{color:var(--text-color-secondary)!important;opacity:1}.wiki-search-form input[name=keyword]:not(:placeholder-shown)+button[type=submit] i.fa{color:var(--text-color-main)!important}.wiki-search-form button[type=submit]{position:absolute;top:0;background:0 0;padding:5px 8px}.wiki-search-form button[type=submit]:focus{background:0 0;box-shadow:none}.wiki-search-form button[type=submit] i.fa{color:var(--text-color-secondary)!important;margin-top:6px}#category_list_view.wiki-page-list>li>div>.page-title-text{font-weight:600}#category_list_view .wiki-current-target-category>.page-title{border-color:var(--info)}#category_list_view .ui-sortable-drop-area+.wiki-current-target-category>.page-title{border-color:transparent}#category_list_view .wiki-current-dropping-page{background:rgba(33,161,179,.12)}#category_list_view .wiki-current-dropping-page+.ui-sortable-drop-area{display:none}#category_list_view .ui-sortable-helper{visibility:hidden}#category_list_view .ui-sortable-helper .fa{display:none}#category_list_view .ui-sortable-drop-area{border-bottom:2px solid #000;margin-top:-6px;margin-bottom:-2px}#category_list_view .drag-icon{visibility:hidden;color:var(--text-color-soft2)}#category_list_view .drag-icon .fa{font-size:11px}#category_list_view .page-title:hover .drag-icon{visibility:visible;cursor:move}.wiki-page-sidebar{padding-right:0;position:relative}.wiki-page-sidebar #category_list_view.wiki-page-list{padding:0 0 10px 0;margin:0 -14px}.wiki-page-sidebar #category_list_view.wiki-page-list .page-title{padding-left:12px;padding-right:12px}.wiki-page-sidebar .wiki-page-content{padding:0 4px}.wiki-page-sidebar .wiki-page-content-header{display:block;padding:3px 0 0;border:none}@media (max-width:1199px){.wiki-page-sidebar .wiki-page-content-header{display:flex}}.wiki-page-sidebar .wiki-page-content-header h3{font-size:28px;font-weight:600;color:var(--text-color-highlight);padding:0;margin:5px 0}.wiki-page-sidebar .wiki-page-content-header h3 .fa{font-size:16px;margin:0}.wiki-page-sidebar .wiki-page-content-header .btn-add-page{float:left;padding:4px 6px;margin:9px 0 0 9px;line-height:9px}.wiki-page-sidebar .wiki-page-content-header .btn-add-page:active{padding:3px 5px}.wiki-page-sidebar .wiki-page-content-header .wiki-page-content-header-actions{padding:0}.wiki-page-sidebar .wiki-search-form{margin:55px 0 15px;display:block;float:none;clear:both;max-width:none}.wiki-page-sidebar .wiki-content ul.wiki-page-list .page-title:hover{border-radius:0}.wiki-page-sidebar .ui-resizable-handle.ui-resizable-e{cursor:ew-resize}@media (max-width:1199px){.wiki-page-sidebar{padding-right:15px}.wiki-page-sidebar:not(.visible-lg){width:100%!important}.wiki-page-sidebar:not(.visible-lg) .ui-resizable-handle{display:none}.wiki-page-sidebar #category_list_view.wiki-page-list{margin-left:0;margin-right:0}.wiki-page-sidebar #category_list_view.wiki-page-list .page-title:hover{border-radius:4px}.wiki-page-sidebar .wiki-page-content-header{padding:14px 8px 20px}.wiki-page-sidebar .wiki-page-content-header h3{color:var(--text-color-main);font-weight:400;text-transform:none;font-size:12px;margin-right:16px}.wiki-page-sidebar .wiki-page-content-header h3,.wiki-page-sidebar .wiki-page-content-header h3 .fa{font-size:28px}.wiki-page-sidebar .wiki-page-content-header .btn-sm{padding:4px 8px;margin-top:4px}.wiki-page-sidebar .wiki-page-content-header .btn-add-page{display:none}.wiki-page-sidebar .wiki-search-form{float:left;clear:none;max-width:none;margin:0}}.wiki-page-list-table .wiki-search-form{float:left}.wiki-page-list-table .table-responsive{padding-left:15px;padding-right:15px}.wiki-page-list-table .table-responsive .grid-view{padding:15px 0}.wiki-page-list-table .table-responsive .grid-view .pagination{margin-bottom:0}.wiki-page-list-table .table-responsive table a:hover{color:var(--info)}.wiki-page-list-table .table-responsive table .wiki-page-list-row-title{font-size:14px;font-weight:500}.wiki-page-list-table .table-responsive table .wiki-page-list-row-title a{display:block}.wiki-page-list-table .table-responsive table .wiki-page-list-row-title a:hover{color:var(--text-color-highlight)}.wiki-page-list-table .table-responsive table td{font-size:14px;border:none}.wiki-page-list-table .table-responsive table td:hover{cursor:pointer}.wiki-page-list-table .table-responsive table td:first-child{padding-left:12px;border-top-left-radius:4px;border-bottom-left-radius:4px}.wiki-page-list-table .table-responsive table td:last-child{border-top-right-radius:4px;border-bottom-right-radius:4px}.wiki-page-list-table .table-responsive .pagination>.active>a,.wiki-page-list-table .table-responsive .pagination>.active>a:focus,.wiki-page-list-table .table-responsive .pagination>.active>a:hover,.wiki-page-list-table .table-responsive .pagination>.active>span,.wiki-page-list-table .table-responsive .pagination>.active>span:focus,.wiki-page-list-table .table-responsive .pagination>.active>span:hover{background-color:var(--info);border-color:var(--info)}@media (max-width:1199px){.wiki-page-list-table .table-responsive{border:none}.wiki-right-part:not(.visible-lg){width:100%!important}}@media (max-width:768px){.layout-content-container .wiki-page-content .wiki-page-body{padding-left:0;padding-right:0}}.wiki-preview{border:1px solid #e1e1e1;border-radius:4px;padding:10px}.wiki-preview .wiki-preview-content{margin-bottom:10px}.wiki-icon-print{float:right;cursor:pointer}@media print{#topbar-first,.comment-container,.footer-nav,.social-controls,.space-nav,.wiki-content-info,.wiki-icon-print,.wiki-menu{display:none}.layout-content-container .wiki-content{border:none}.space-layout-container{margin:0}#page-content-wrapper{padding:0}} +/* CSS Styling for numbering wiki page content */ +.numbered { counter-reset: h1 h2 h3;}.numbered h1{counter-set: h2 0;}.numbered h1::before { counter-increment: h1; content: counter(h1) ' ';}.numbered h2{counter-set: h3 0;}.numbered h2::before { counter-increment: h2; content: counter(h1) '.' counter(h2) ' ';}.numbered h3::before { counter-increment: h3; content: counter(h1) '.' counter(h2) '.' counter(h3) ' ';}.numbered h1.wiki-page-title::before { counter-increment: none; content: none;} +/* CSS Styling for toggle button */ +.toggle-numbering {margin-left: auto;padding-right: 10px;} \ No newline at end of file diff --git a/views/overview/list-categories.php b/views/overview/list-categories.php index 682469ec..01dad1c1 100644 --- a/views/overview/list-categories.php +++ b/views/overview/list-categories.php @@ -42,11 +42,11 @@ icon('fa-plus')->sm()->link(Url::toWikiCreate($contentContainer))->visible($canCreate) ?> request->get('numbering', 'disabled') === 'enabled'; + $numberingEnabled = Yii::$app->request->get('numbering', 'disabled') === 'enabled'; ?> - - + +
diff --git a/views/page/_view_body.php b/views/page/_view_body.php index d55f15a2..0649ca3b 100644 --- a/views/page/_view_body.php +++ b/views/page/_view_body.php @@ -21,12 +21,12 @@ Assets::register($this); // Determine the current numbering state from the URL parameter -$numbering_enabled = Yii::$app->request->get('numbering', 'disabled') === 'enabled'; +$numberingEnabled = Yii::$app->request->get('numbering', 'disabled') === 'enabled'; ?> render('_view_header', ['page' => $page, 'revision' => $revision, 'displayTitle' => false]) ?> -
> +
render('_view_content', ['page' => $page, 'canEdit' => $canEdit, 'content' => $content]) ?>
diff --git a/views/page/_view_content.php b/views/page/_view_content.php index 482c20f4..9e9277aa 100644 --- a/views/page/_view_content.php +++ b/views/page/_view_content.php @@ -12,26 +12,6 @@ /* @var $canEdit bool */ /* @var $content string */ ?> - - - - -
content->getTags(Topic::class)->all() as $topic) : ?> diff --git a/views/page/_view_header.php b/views/page/_view_header.php index a059bcf0..0d5343a0 100644 --- a/views/page/_view_header.php +++ b/views/page/_view_header.php @@ -20,19 +20,16 @@ } // Determine the current numbering state from the URL parameter -$numbering_enabled = Yii::$app->request->get('numbering', 'disabled') === 'enabled'; - +$numberingEnabled = Yii::$app->request->get('numbering', 'disabled') === 'enabled'; ?> - -
$page]) ?> $this->getOptions(), 'level' => $this->level, ]); - } } public function generateNumbering($level) From 1a67e0fd183e7252dd4e99ba7485d5cc965c2a09 Mon Sep 17 00:00:00 2001 From: vidhyasagargm Date: Fri, 4 Oct 2024 21:24:53 +0200 Subject: [PATCH 20/44] #1 changed the test case with html render --- .../unit/PageListItemTitleTest.php | 46 +++++++++++++++---- views/page/_view_header.php | 2 +- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/tests/codeception/unit/PageListItemTitleTest.php b/tests/codeception/unit/PageListItemTitleTest.php index d3806c1a..72a55363 100644 --- a/tests/codeception/unit/PageListItemTitleTest.php +++ b/tests/codeception/unit/PageListItemTitleTest.php @@ -41,10 +41,10 @@ public function testButtonWhenNumberingEnabled() ])); // Check if numbering is enabled - $numbering_enabled = Yii::$app->request->get('numbering', 'disabled') === 'enabled'; + $numberingEnabled = Yii::$app->request->get('numbering', 'disabled') === 'enabled'; // Assert that the numbering is enabled - $this->assertTrue($numbering_enabled); + $this->assertTrue($numberingEnabled); // Use a valid route in Url::to() as it is hard to simulate Url::current() $url = Url::to(['/wiki/overview/list-categories', 'numbering' => 'disabled']); @@ -53,9 +53,16 @@ public function testButtonWhenNumberingEnabled() // Assert that the correct URL is generated $this->assertEquals($expectedUrl, $url); - // Assert that the button label is correct - $buttonLabel = $numbering_enabled ? 'Disable Numbering' : 'Enable Numbering'; - $this->assertEquals('Disable Numbering', $buttonLabel); + // Expected button label when numbering is enabled + $expectedLabel = 'Disable Numbering'; + + + // Render the button HTML with the $numberingEnabled = true + $html = $this->renderButton($numberingEnabled); + + + // Assert that the correct label is present in the rendered HTML + $this->assertStringContainsString($expectedLabel, $html); } // Test when numbering is disabled @@ -67,10 +74,10 @@ public function testButtonWhenNumberingDisabled() ])); // Check if numbering is disabled - $numbering_enabled = Yii::$app->request->get('numbering', 'disabled') === 'enabled'; + $numberingEnabled = Yii::$app->request->get('numbering', 'disabled') === 'enabled'; // Assert that the numbering is disabled - $this->assertFalse($numbering_enabled); + $this->assertFalse($numberingEnabled); /// Use a valid route in Url::to() as it is hard to simulate Url::current() $url = Url::to(['/wiki/overview/list-categories', 'numbering' => 'enabled']); @@ -79,9 +86,28 @@ public function testButtonWhenNumberingDisabled() // Assert that the correct URL is generated $this->assertEquals($expectedUrl, $url); - // Assert that the button label is correct - $buttonLabel = $numbering_enabled ? 'Disable Numbering' : 'Enable Numbering'; - $this->assertEquals('Enable Numbering', $buttonLabel); + // Expected button label when numbering is disabled + $expectedLabel = 'Enable Numbering'; + + + // Render the button HTML with the $numberingEnabled = false + $html = $this->renderButton($numberingEnabled); + + + // Assert that the correct label is present in the rendered HTML + $this->assertStringContainsString($expectedLabel, $html); } + // Function to render html button + private function renderButton($numberingEnabled) + { + // Simulate what would be inside the view + ob_start(); // Start output buffering + ?> + + + + $page, 'buttons' => $buttons, 'revision' => $revision ?? null - ]) ?> + ]) ?>
From b9492e5091ba320148de8e454624f732faa2ef9a Mon Sep 17 00:00:00 2001 From: vidhyasagargm Date: Wed, 9 Oct 2024 23:43:52 +0200 Subject: [PATCH 21/44] #1 implemented preserve settings --- controllers/OverviewController.php | 21 ++++ controllers/PageController.php | 31 ++++- .../unit/OverviewNumberingTest.php | 114 ++++++++++++++++++ .../unit/PageListItemTitleTest.php | 113 ----------------- tests/codeception/unit/WikiNumberingTest.php | 102 ++++++++++++++++ views/overview/list-categories.php | 12 +- views/page/_view_body.php | 9 +- views/page/_view_header.php | 10 +- widgets/PageListItemTitle.php | 8 +- 9 files changed, 295 insertions(+), 125 deletions(-) create mode 100644 tests/codeception/unit/OverviewNumberingTest.php delete mode 100644 tests/codeception/unit/PageListItemTitleTest.php create mode 100644 tests/codeception/unit/WikiNumberingTest.php diff --git a/controllers/OverviewController.php b/controllers/OverviewController.php index 0e1a9b44..19e036ec 100644 --- a/controllers/OverviewController.php +++ b/controllers/OverviewController.php @@ -112,4 +112,25 @@ public function actionUpdateFoldingState(int $categoryId, int $state) { $this->updateFoldingState($categoryId, $state); } + + public function actionToggleNumbering() + { + // Get the current module + $module = Yii::$app->getModule('wiki'); + + // Get the current user + $user = Yii::$app->user->identity; + + // Retrieve the current numbering state from the module's user-specific settings + $numberingEnabled = $module->settings->contentContainer($user)->get('overviewNumbering', 'disabled') === 'enabled'; + + // Toggle the state + $newState = $numberingEnabled ? 'disabled' : 'enabled'; + + // Save the new state in the settings using contentContainer($user) + $module->settings->contentContainer($user)->set('overviewNumbering', $newState); + + // Redirect back to the overview page + return $this->redirect(Url::toOverview($this->contentContainer)); + } } diff --git a/controllers/PageController.php b/controllers/PageController.php index 387f726b..55c68486 100644 --- a/controllers/PageController.php +++ b/controllers/PageController.php @@ -439,5 +439,34 @@ protected function getAccessRules() ]; } - + public function actionToggleNumbering(int $id) + { + // Get the current module + $module = Yii::$app->getModule('wiki'); + + // Get the current user + $user = Yii::$app->user->identity; + + // Retrieve the current numbering state from the module's user-specific settings + $numberingEnabled = $module->settings->contentContainer($user)->get('wikiNumbering', 'disabled') === 'enabled'; + + // Toggle the state + $newState = $numberingEnabled ? 'disabled' : 'enabled'; + + // Save the new state in the settings using contentContainer($user) + $module->settings->contentContainer($user)->set('wikiNumbering', $newState); + + // Try to go back to the wiki page + try { + // Get page content from page id + $page = $this->getWikiPage($id); + + // Redirect back to the wiki page + return $this->redirect(Url::toWiki($page)); + } + // If the page could not be found go to the previous URL + catch(Exception $e) { + return $this->redirect(Url::previous()); + } + } } diff --git a/tests/codeception/unit/OverviewNumberingTest.php b/tests/codeception/unit/OverviewNumberingTest.php new file mode 100644 index 00000000..3189c8ae --- /dev/null +++ b/tests/codeception/unit/OverviewNumberingTest.php @@ -0,0 +1,114 @@ +user = $this->make(User::class, [ + 'id' => 1, + 'username' => 'testUser', + ]); + Yii::$app->user->login($this->user); + + // Mock the wiki module + $this->module = Yii::$app->getModule('wiki'); + + // Initialise the controller + $this->controller = new OverviewController('overview', $this->module); + $this->controller->contentContainer = $this->user; + } + public function testGenerateNumbering() + { + // Create a new instance of PageListItemTitle + $widget = new PageListItemTitle(); + + // Test level 0 numbering + $numbering = $widget->generateNumbering(0); + $this->assertEquals('1', $numbering, 'Numbering at level 0 is incorrect.'); + + // Test level 1 numbering + $numbering = $widget->generateNumbering(1); + $this->assertEquals('1.1', $numbering, 'Numbering at level 1 is incorrect.'); + + // Test level 2 numbering + $numbering = $widget->generateNumbering(2); + $this->assertEquals('1.1.1', $numbering, 'Numbering at level 2 is incorrect.'); + + // Reset and increment first level again + $numbering = $widget->generateNumbering(0); + $this->assertEquals('2', $numbering, 'Second increment of level 0 is incorrect.'); + } + + public function testToggleOverviewNumberingEnabled() + { + // Mock wiki module settings for the user + $this->module->settings->contentContainer($this->user)->set('overviewNumbering', 'disabled'); + + // Call the actionToggleNumbering method + $this->controller->actionToggleNumbering(); + + // Assert that the state was updated to 'enabled' + $this->assertEquals('enabled', $this->module->settings->contentContainer($this->user)->get('overviewNumbering')); + + // Call the logic that renders the button with text + $numberingEnabled = $this->module->settings->contentContainer($this->user)->get('overviewNumbering') === 'enabled'; + + // Simulate rendering the button HTML + $html = $this->renderButton($numberingEnabled); + + // Expected button label when numbering is enabled + $expectedLabel = 'Disable Numbering'; + + // Assert that the correct label is present in the rendered HTML + $this->assertStringContainsString($expectedLabel, $html); + } + + public function testToggleOverviewNumberingDisabled() + { + // Mock wiki module settings for the user + $this->module->settings->contentContainer($this->user)->set('overviewNumbering', 'enabled'); + + // Call the actionToggleNumbering method + $this->controller->actionToggleNumbering(); + + // Assert that the state was updated to 'disabled' + $this->assertEquals('disabled', $this->module->settings->contentContainer($this->user)->get('overviewNumbering')); + + // Call the logic that renders the button with text + $numberingEnabled = $this->module->settings->contentContainer($this->user)->get('overviewNumbering') === 'enabled'; + + // Simulate rendering the button HTML + $html = $this->renderButton($numberingEnabled); + + // Expected button label when numbering is enabled + $expectedLabel = 'Enable Numbering'; + + // Assert that the correct label is present in the rendered HTML + $this->assertStringContainsString($expectedLabel, $html); + } + + // Function to render html button + private function renderButton($numberingEnabled) + { + // Simulate what would be inside the view + ob_start(); // Start output buffering + ?> + + + + generateNumbering(0); - $this->assertEquals('1', $numbering, 'Numbering at level 0 is incorrect.'); - - // Test level 1 numbering - $numbering = $widget->generateNumbering(1); - $this->assertEquals('1.1', $numbering, 'Numbering at level 1 is incorrect.'); - - // Test level 2 numbering - $numbering = $widget->generateNumbering(2); - $this->assertEquals('1.1.1', $numbering, 'Numbering at level 2 is incorrect.'); - - // Reset and increment first level again - $numbering = $widget->generateNumbering(0); - $this->assertEquals('2', $numbering, 'Second increment of level 0 is incorrect.'); - } - - // Test when numbering is enabled - public function testButtonWhenNumberingEnabled() - { - // Simulate a request with the 'numbering' parameter set to 'enabled' - Yii::$app->set('request', new Request([ - 'queryParams' => ['numbering' => 'enabled'] - ])); - - // Check if numbering is enabled - $numberingEnabled = Yii::$app->request->get('numbering', 'disabled') === 'enabled'; - - // Assert that the numbering is enabled - $this->assertTrue($numberingEnabled); - - // Use a valid route in Url::to() as it is hard to simulate Url::current() - $url = Url::to(['/wiki/overview/list-categories', 'numbering' => 'disabled']); - $expectedUrl = '/index-test.php?r=wiki%2Foverview%2Flist-categories&numbering=disabled'; - - // Assert that the correct URL is generated - $this->assertEquals($expectedUrl, $url); - - // Expected button label when numbering is enabled - $expectedLabel = 'Disable Numbering'; - - - // Render the button HTML with the $numberingEnabled = true - $html = $this->renderButton($numberingEnabled); - - - // Assert that the correct label is present in the rendered HTML - $this->assertStringContainsString($expectedLabel, $html); - } - - // Test when numbering is disabled - public function testButtonWhenNumberingDisabled() - { - // Simulate a request with the 'numbering' parameter set to 'disabled' - Yii::$app->set('request', new Request([ - 'queryParams' => ['numbering' => 'disabled'] - ])); - - // Check if numbering is disabled - $numberingEnabled = Yii::$app->request->get('numbering', 'disabled') === 'enabled'; - - // Assert that the numbering is disabled - $this->assertFalse($numberingEnabled); - - /// Use a valid route in Url::to() as it is hard to simulate Url::current() - $url = Url::to(['/wiki/overview/list-categories', 'numbering' => 'enabled']); - $expectedUrl = '/index-test.php?r=wiki%2Foverview%2Flist-categories&numbering=enabled'; - - // Assert that the correct URL is generated - $this->assertEquals($expectedUrl, $url); - - // Expected button label when numbering is disabled - $expectedLabel = 'Enable Numbering'; - - - // Render the button HTML with the $numberingEnabled = false - $html = $this->renderButton($numberingEnabled); - - - // Assert that the correct label is present in the rendered HTML - $this->assertStringContainsString($expectedLabel, $html); - } - - // Function to render html button - private function renderButton($numberingEnabled) - { - // Simulate what would be inside the view - ob_start(); // Start output buffering - ?> - - - - user = $this->make(User::class, [ + 'id' => 1, + 'username' => 'testUser', + ]); + Yii::$app->user->login($this->user); + + // Mock the WikiPage object + $this->pageId = 123; + $this->page = $this->make(WikiPage::class, [ + 'id' => $this->pageId, + 'title' => 'Test Wiki Page', + ]); + + // Mock the wiki module + $this->module = Yii::$app->getModule('wiki'); + + // Initiate the controller + $this->controller = new PageController('wiki', $this->module); + $this->controller->contentContainer = $this->user; + } + public function testToggleWikiNumberingEnabled() + { + // Mock wiki module settings for the user + $this->module->settings->contentContainer($this->user)->set('wikiNumbering', 'disabled'); + + // Call the actionToggleNumbering method + $this->controller->actionToggleNumbering($this->pageId); + + // Assert that the state was updated to 'enabled' + $this->assertEquals('enabled', $this->module->settings->contentContainer($this->user)->get('wikiNumbering')); + + // Call the logic that renders the button with the text + $numberingEnabled = $this->module->settings->contentContainer($this->user)->get('wikiNumbering') === 'enabled'; + + // Simulate rendering the button HTML + $html = $this->renderButton($numberingEnabled); + + // Expected button label when numbering is enabled + $expectedLabel = 'Disable Numbering'; + + // Assert that the correct label is present in the rendered HTML + $this->assertStringContainsString($expectedLabel, $html); + } + + public function testToggleOverviewNumberingDisabled() + { + // Mock wiki module settings for the user + $this->module->settings->contentContainer($this->user)->set('wikiNumbering', 'enabled'); + + // Call the actionToggleNumbering method + $this->controller->actionToggleNumbering($this->pageId); + + // Assert that the state was updated to 'disabled' + $this->assertEquals('disabled', $this->module->settings->contentContainer($this->user)->get('wikiNumbering')); + + // Call the logic that renders the button with the text + $numberingEnabled = $this->module->settings->contentContainer($this->user)->get('wikiNumbering') === 'enabled'; + + // Simulate rendering the button HTML + $html = $this->renderButton($numberingEnabled); + + // Expected button label when numbering is enabled + $expectedLabel = 'Enable Numbering'; + + // Assert that the correct label is present in the rendered HTML + $this->assertStringContainsString($expectedLabel, $html); + } + + // Function to render html button + private function renderButton($numberingEnabled) + { + // Simulate what would be inside the view + ob_start(); // Start output buffering + ?> + + + + sm()->link(Url::toLastEdited($contentContainer))->cssClass(Helper::isEnterpriseTheme() ? 'hidden-lg' : '') ?> icon('fa-plus')->sm()->link(Url::toWikiCreate($contentContainer))->visible($canCreate) ?> request->get('numbering', 'disabled') === 'enabled'; + // Get the current module + $module = Yii::$app->getModule('wiki'); + // Get the current user + $user = Yii::$app->user->identity; + // Retrieve the current numbering state for this user from the settings + $numberingEnabled = $module->settings->contentContainer($user)->get('overviewNumbering', 'disabled') === 'enabled'; ?> - - + +
diff --git a/views/page/_view_body.php b/views/page/_view_body.php index 0649ca3b..ca8ebf80 100644 --- a/views/page/_view_body.php +++ b/views/page/_view_body.php @@ -20,8 +20,13 @@ /* @var $canEdit bool */ Assets::register($this); -// Determine the current numbering state from the URL parameter -$numberingEnabled = Yii::$app->request->get('numbering', 'disabled') === 'enabled'; + +// Get the current module +$module = Yii::$app->getModule('wiki'); +// Get the current user +$user = Yii::$app->user->identity; +// Retrieve the current numbering state for this user from the settings +$numberingEnabled = $module->settings->contentContainer($user)->get('wikiNumbering', 'disabled') === 'enabled'; ?> render('_view_header', ['page' => $page, 'revision' => $revision, 'displayTitle' => false]) ?> diff --git a/views/page/_view_header.php b/views/page/_view_header.php index 8efb4bec..e34bbc7f 100644 --- a/views/page/_view_header.php +++ b/views/page/_view_header.php @@ -19,8 +19,12 @@ $buttons = WikiMenu::LINK_EDIT; } -// Determine the current numbering state from the URL parameter -$numberingEnabled = Yii::$app->request->get('numbering', 'disabled') === 'enabled'; +// Get the current module +$module = Yii::$app->getModule('wiki'); +// Get the current user +$user = Yii::$app->user->identity; +// Retrieve the current numbering state for this user from the settings +$numberingEnabled = $module->settings->contentContainer($user)->get('wikiNumbering', 'disabled') === 'enabled'; ?>
@@ -28,7 +32,7 @@ $page]) ?> diff --git a/widgets/PageListItemTitle.php b/widgets/PageListItemTitle.php index 013c96f8..000df97f 100644 --- a/widgets/PageListItemTitle.php +++ b/widgets/PageListItemTitle.php @@ -90,8 +90,12 @@ public function run() $this->titleInfo = Yii::t('WikiModule.base', '({n,plural,=1{+1 subpage}other{+{count} subpages}})', ['n' => $this->page->childrenCount, 'count' => $this->page->childrenCount]); } - // Generate numbering for categories and pages - $numberingEnabled = Yii::$app->request->get('numbering', 'disabled') === 'enabled'; + // Get the current module + $module = Yii::$app->getModule('wiki'); + // Get the current user + $user = Yii::$app->user->identity; + // Retrieve the current numbering state for this user from the settings + $numberingEnabled = $module->settings->contentContainer($user)->get('overviewNumbering', 'disabled') === 'enabled'; // Generate numbering for categories and pages return $this->render('pageListItemTitle', [ From 733b08db3d4e9322edcaf76d45227bb6bd79bd6e Mon Sep 17 00:00:00 2001 From: vidhyasagargm Date: Thu, 17 Oct 2024 21:28:39 +0200 Subject: [PATCH 22/44] #1 Matched numbering with TOC --- assets/Assets.php | 2 +- resources/css/humhub.wiki.min.css | 2 -- resources/js/humhub.wiki.bundle.js | 44 ++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/assets/Assets.php b/assets/Assets.php index 5475b285..2f7dcd03 100644 --- a/assets/Assets.php +++ b/assets/Assets.php @@ -35,7 +35,7 @@ class Assets extends AssetBundle ]; public $js = [ - 'js/humhub.wiki.bundle.min.js', + 'js/humhub.wiki.bundle.js', //'js/jquery.ui.touch-punch.js' ]; diff --git a/resources/css/humhub.wiki.min.css b/resources/css/humhub.wiki.min.css index 7998a3b1..e9a20440 100644 --- a/resources/css/humhub.wiki.min.css +++ b/resources/css/humhub.wiki.min.css @@ -1,5 +1,3 @@ .layout-content-container .wiki-welcome h1{font-size:36px;font-weight:700}.layout-content-container .wiki-welcome h2{font-size:14px;font-weight:200;line-height:24px;margin:10px 100px}@media (max-width:768px){.layout-content-container .wiki-welcome h2{margin:10px}}.layout-content-container .wiki-bg{padding:150px 0 150px;background-repeat:no-repeat;background-position:center 100px}@media only screen and (max-width:520px){.layout-content-container .wiki-bg{background-size:contain}}.layout-content-container .wiki-page-path{padding-right:8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:13px;font-weight:600;color:var(--text-color-highlight)}.layout-content-container .wiki-page-path.wiki-page-path-length-0 .fa{font-size:28px}@media only screen and (max-width:520px){.layout-content-container .wiki-page-path .wiki-page-path-categories{display:none}.layout-content-container .wiki-page-path .fa{font-size:28px}}@media only screen and (max-width:1199px){.layout-content-container .wiki-page-path .wiki-page-path-first-categories{display:none}}.layout-content-container .wiki-menu{white-space:nowrap}.layout-content-container .wiki-menu .btn-group{margin-left:4px}.layout-content-container .wiki-page-index{border:1px solid #eee;border-radius:4px;padding:3px 5px;margin:30px 0}@media (min-width:480px){.layout-content-container .wiki-page-index{width:50%}}.layout-content-container .wiki-page-index .nav{padding:0;margin:0}.layout-content-container .wiki-page-index .nav li{margin:2px 0}.layout-content-container .wiki-page-index .nav li a{padding:3px 15px;color:var(--info)!important}.layout-content-container .wiki-page-index .nav li a>span{font-weight:600;color:var(--text-color-highlight)!important;margin-right:10px}.layout-content-container .wiki-page-index .nav li:first-child a{font-size:14px;font-weight:600;color:var(--text-color-highlight)!important}.layout-content-container .wiki-page-index .wiki-page-index-section .header-anchor{text-overflow:ellipsis;overflow:hidden;padding-left:20px}.layout-content-container .wiki-page-index .wiki-page-index-section-level2 .header-anchor{padding-left:50px}.layout-content-container .wiki-page-index .wiki-page-index-section-level3 .header-anchor{padding-left:80px}.layout-content-container .current-anchor-header{background:var(--background-color-highlight);width:fit-content;border-radius:4px}.layout-content-container #wiki-page-edit .ProseMirror-menubar-wrapper{z-index:8}.layout-content-container #wiki-page-edit .ProseMirror{min-height:150px!important}.layout-content-container .wiki-content hr.dashed,.layout-content-container .wiki-page-index hr.dashed{border-style:dashed}.layout-content-container .wiki-page-content{min-height:220px}.layout-content-container .wiki-page-content .topic-label-list{margin-bottom:10px}.layout-content-container .wiki-page-content .wiki-page-title{font-size:1.75em;font-weight:500;color:var(--text-color-highlight);clear:both}.layout-content-container .wiki-page-content .wiki-page-title i.fa{margin-right:4px}.layout-content-container .wiki-page-content .wiki-page-body{padding:0 30px 30px}.layout-content-container .wiki-page-content .wiki-headline{padding-bottom:8px;margin-bottom:10px;border-bottom:1px solid #eee}.layout-content-container .wiki-page-content .wiki-headline .wiki-headline-top{display:flex;justify-content:space-between;align-items:center}.layout-content-container .wiki-page-content .wiki-headline .label{margin-left:2px}.layout-content-container .wiki-page-content .wiki-headline .wiki-page-path a{color:var(--info)}.layout-content-container .wiki-page-content .wiki-headline .wiki-page-path a:hover{color:var(--text-color-highlight)}.layout-content-container .wiki-page-content hr.wiki-headline-seperator{margin:20px 0 10px}.layout-content-container .wiki-page-content .wiki-category-list-item{padding-bottom:0!important;position:relative}.layout-content-container .wiki-page-content .wiki-category-list-sort-fixer{position:absolute;visibility:hidden}.layout-content-container .wiki-page-content .markdown-render{margin-bottom:10px}.layout-content-container .wiki-page-content .wiki-sub-pages{border:1px solid #ddd;padding:15px 0;margin-bottom:10px}@media (min-width:480px){.layout-content-container .wiki-page-content .wiki-sub-pages{width:50%}}.layout-content-container .wiki-page-content .wiki-sub-pages ul.wiki-page-list{margin-bottom:0;padding-left:2px}.layout-content-container .wiki-page-content .wiki-sub-pages ul.wiki-page-list .page-title .fa{font-size:11px;color:var(--text-color-main);margin:0 5px}.layout-content-container .wiki-page-content .wiki-sub-pages ul.wiki-page-list .page-title:hover{border-color:transparent}.layout-content-container .wiki-page-content .wiki-sub-pages a,.layout-content-container .wiki-page-content .wiki-sub-pages span.page-title-info{font-size:13px;font-weight:500;color:var(--text-color-main)}.layout-content-container .wiki-page-content .wiki-sub-pages a{color:var(--info)}.layout-content-container .wiki-page-content .wiki-sub-pages ul.wiki-page-list{padding:0}.layout-content-container .wiki-page-content .wiki-sub-pages ul.wiki-page-list .page-title{padding-top:0;padding-bottom:0}.layout-content-container .wiki-page-content .wiki-sub-pages span.page-title-text{display:inline-block;margin-bottom:10px;color:var(--text-color-highlight);font-weight:600}.layout-content-container .wiki-page-list-row-details,.layout-content-container .wiki-page-list-row-details .time,.layout-content-container .wiki-page-list-row-details a{color:var(--text-color-secondary);font-size:12px}.layout-content-container .wiki-content .wiki-content-info{margin-top:5px}.layout-content-container .wiki-content .wiki-content-info a{color:var(--text-color-main)}.layout-content-container .wiki-content .wiki-content-info a:hover{color:var(--info)}.layout-content-container .wiki-content [data-wiki-page]{color:#ec4332!important}.layout-content-container .wiki-content [data-wiki-page="#"]{color:#4cc159!important}.layout-content-container .wiki-content .social-controls,.layout-content-container .wiki-content .social-controls a{font-size:11px;color:var(--text-color-soft2);margin-bottom:10px}.layout-content-container .wiki-content .wall-entry-controls .like{font-size:11px;color:var(--text-color-soft2)}.layout-content-container .wiki-content ul.wiki-page-list{list-style:none;padding-left:0}.layout-content-container .wiki-content ul.wiki-page-list.wiki-page-list-droppable-target{height:15px;bottom:9px;position:absolute;width:100%;display:block!important}.layout-content-container .wiki-content ul.wiki-page-list.wiki-page-list-droppable-target li{display:none!important}.layout-content-container .wiki-content ul.wiki-page-list.wiki-page-list-droppable-target .ui-sortable-drop-area{margin-top:10px!important;border:none!important}.layout-content-container .wiki-content ul.wiki-page-list li{font-size:14px;padding-bottom:6px}.layout-content-container .wiki-content ul.wiki-page-list .wiki-list-item-selected{background:var(--background-color-highlight-soft)}.layout-content-container .wiki-content ul.wiki-page-list .wiki-list-item-selected>.page-title{background:var(--background-color-highlight)}.layout-content-container .wiki-content ul.wiki-page-list .page-title{padding:4px 12px;border:1px solid transparent;border-radius:4px;display:flex;cursor:pointer;transition:background 1s ease}.layout-content-container .wiki-content ul.wiki-page-list .page-title .fa[class*=fa-caret]{cursor:default}.layout-content-container .wiki-content ul.wiki-page-list .page-title:hover{border-color:var(--info)}.layout-content-container .wiki-content ul.wiki-page-list .page-title:hover .wiki-category-add{display:block}.layout-content-container .wiki-content ul.wiki-page-list .page-title:not(.page-is-category) .page-title-text{padding-left:24px}.layout-content-container .wiki-content ul.wiki-page-list .page-title .wiki-page-control{color:var(--text-color-secondary)}.layout-content-container .wiki-content ul.wiki-page-list .page-title .wiki-page-control.wiki-category-add{color:var(--text-color-highlight);margin-left:8px}.layout-content-container .wiki-content ul.wiki-page-list .page-title .wiki-category-add{display:none}.layout-content-container .wiki-content ul.wiki-page-list .page-title .fa{font-size:14px}.layout-content-container .wiki-content ul.wiki-page-list .page-title .fa-caret-down{margin:0 6px}.layout-content-container .wiki-content ul.wiki-page-list .page-title .fa-caret-right{margin:0 8px 0 7px}.layout-content-container .wiki-content ul.wiki-page-list .page-title>div{display:flex;overflow:hidden}.layout-content-container .wiki-content ul.wiki-page-list .page-title>div .page-title-text{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.layout-content-container .wiki-content ul.wiki-page-list .page-title>div>i.fa{padding:3px 2px}.layout-content-container .wiki-content ul.wiki-page-list .page-title .page-title-icon{margin-left:8px}.layout-content-container .wiki-content ul.wiki-page-list .page-title .page-title-icon .page-title-icon-visibility{color:var(--text-color-soft2)}.layout-content-container .wiki-content ul.wiki-page-list .page-title.wiki-page-dropped{background:rgba(255,193,7,.12)}.layout-content-container .wiki-content ul.wiki-page-list.wiki-page-is-dropping ul.wiki-page-list:not(.wiki-page-list-droppable-target){padding-top:25px;margin-top:-25px}.layout-content-container .wiki-content ul.wiki-page-list.wiki-page-is-dropping li:not(.wiki-current-target-category-over)>.page-title:hover{border-color:transparent!important}.layout-content-container .wiki-content ul.wiki-page-list.wiki-page-is-dropping .wiki-category-add{display:none!important}.layout-content-container .wiki-content ul.wiki-page-list.wiki-page-is-dropping .drag-icon{visibility:hidden!important}.layout-content-container .wiki-content ul.wiki-page-history{list-style:none;margin-left:22px;padding-left:0;border-left:1px dashed #aeaeae}.layout-content-container .wiki-content ul.wiki-page-history.wiki-page-history-with-diff li{padding-left:56px}.layout-content-container .wiki-content ul.wiki-page-history li{padding:20px 18px;position:relative}.layout-content-container .wiki-content ul.wiki-page-history li:first-child::before{content:'';background:var(--background-color-main);display:block;position:absolute;top:0;left:-1px;width:1px;height:38px}.layout-content-container .wiki-content ul.wiki-page-history li h4.media-heading{font-size:16px;font-weight:600}.layout-content-container .wiki-content ul.wiki-page-history li h5{margin-bottom:0;color:var(--text-color-highlight);font-size:13px}.layout-content-container .wiki-content ul.wiki-page-history li .horizontal-line{position:absolute;left:2px;top:38px;letter-spacing:1px;border-top:1px dashed #aeaeae}.layout-content-container .wiki-content ul.wiki-page-history li .horizontal-line input[type=radio]{position:relative;right:-27px;top:-9px}.layout-content-container .wiki-content ul.wiki-page-history li .wiki-author-link{color:var(--text-color-soft2);text-decoration:underline}.layout-content-container .wiki-content ul.wiki-page-history li .media{padding:0 11px}.layout-content-container .wiki-content ul.wiki-page-history li .alert{padding:10px;margin-bottom:0}.layout-content-container .wiki-content ul.wiki-page-history li .alert .horizontal-line{top:48px}.layout-content-container .wiki-content button.wiki-page-history-btn-compare{margin-left:15px}.layout-content-container .wiki-content.wiki-page-diff ins{text-decoration:none;background-color:#d4fcbc}.layout-content-container .wiki-content.wiki-page-diff del{text-decoration:line-through;background-color:#fbb6c2;color:var(--text-color-main)}.layout-content-container .wiki-page-history-title{padding-left:15px;font-weight:600;font-size:20px}.layout-content-container .wiki-page-history-title .fa{font-size:14px}.layout-content-container .wiki-content .new{color:#4cc159}.layout-content-container .wiki-content .delete{color:#ec4332}.layout-content-container .wiki-content .history{color:#ff8a00}.layout-content-container .wiki-content .fa-link{color:#7880dd;margin-right:4px}.layout-content-container .wiki-content .back{color:var(--text-color-main)}@media (max-width:768px){.wiki-page-content{min-height:220px}}.wiki-page-content-header{display:flex;margin-bottom:10px;padding:10px 10px}.wiki-page-content-header h3{color:var(--text-color-highlight);float:left;font-size:28px;white-space:nowrap;margin:0 30px 0 0;padding:0 0 0 15px}.wiki-page-content-header h3 .fa{font-size:20px;margin-right:8px;position:relative;top:-3px}.wiki-page-content-header .wiki-search-form{margin:0 0 10px}.wiki-page-content-header .wiki-page-content-header-actions{float:right;padding-top:5px}.wiki-page-content-header .wiki-page-content-header-actions .btn{margin-bottom:4px}.wiki-page-content-header .wiki-search-form{width:100%;max-width:none;margin-right:50px!important}.wiki-page-content-header .wiki-page-content-header-actions{white-space:nowrap}@media (max-width:991px){.wiki-page-content-header .wiki-search-form{margin-right:10px!important}}@media (max-width:479px){.wiki-page-content-header{display:block!important}.wiki-page-content-header .wiki-search-form{width:auto;margin-right:0!important}.wiki-page-content-header .wiki-page-content-header-actions{white-space:normal}}.wiki-page-header-wrapper p:last-child{margin:0 0 1.2em}.wiki-page-header-wrapper:last-child p:last-child{margin:0}.wiki-page-header-wrapper a.header-edit-link{display:none;color:var(--text-color-main)!important}.wiki-page-header-wrapper:hover .header-edit-link{display:inline}.wiki-page-header-wrapper h1:hover a,.wiki-page-header-wrapper h2:hover a,.wiki-page-header-wrapper h3:hover a{display:inline!important}.wiki-search-form{float:right;position:relative;margin-left:4px;max-width:168px}.wiki-search-form input[name=keyword]{background:#f3f3f3;font-size:13px;border:none;color:var(--text-color-main);padding-left:26px;height:36px;min-height:36px}.wiki-search-form input[name=keyword]::placeholder{color:var(--text-color-secondary)!important;opacity:1}.wiki-search-form input[name=keyword]:not(:placeholder-shown)+button[type=submit] i.fa{color:var(--text-color-main)!important}.wiki-search-form button[type=submit]{position:absolute;top:0;background:0 0;padding:5px 8px}.wiki-search-form button[type=submit]:focus{background:0 0;box-shadow:none}.wiki-search-form button[type=submit] i.fa{color:var(--text-color-secondary)!important;margin-top:6px}#category_list_view.wiki-page-list>li>div>.page-title-text{font-weight:600}#category_list_view .wiki-current-target-category>.page-title{border-color:var(--info)}#category_list_view .ui-sortable-drop-area+.wiki-current-target-category>.page-title{border-color:transparent}#category_list_view .wiki-current-dropping-page{background:rgba(33,161,179,.12)}#category_list_view .wiki-current-dropping-page+.ui-sortable-drop-area{display:none}#category_list_view .ui-sortable-helper{visibility:hidden}#category_list_view .ui-sortable-helper .fa{display:none}#category_list_view .ui-sortable-drop-area{border-bottom:2px solid #000;margin-top:-6px;margin-bottom:-2px}#category_list_view .drag-icon{visibility:hidden;color:var(--text-color-soft2)}#category_list_view .drag-icon .fa{font-size:11px}#category_list_view .page-title:hover .drag-icon{visibility:visible;cursor:move}.wiki-page-sidebar{padding-right:0;position:relative}.wiki-page-sidebar #category_list_view.wiki-page-list{padding:0 0 10px 0;margin:0 -14px}.wiki-page-sidebar #category_list_view.wiki-page-list .page-title{padding-left:12px;padding-right:12px}.wiki-page-sidebar .wiki-page-content{padding:0 4px}.wiki-page-sidebar .wiki-page-content-header{display:block;padding:3px 0 0;border:none}@media (max-width:1199px){.wiki-page-sidebar .wiki-page-content-header{display:flex}}.wiki-page-sidebar .wiki-page-content-header h3{font-size:28px;font-weight:600;color:var(--text-color-highlight);padding:0;margin:5px 0}.wiki-page-sidebar .wiki-page-content-header h3 .fa{font-size:16px;margin:0}.wiki-page-sidebar .wiki-page-content-header .btn-add-page{float:left;padding:4px 6px;margin:9px 0 0 9px;line-height:9px}.wiki-page-sidebar .wiki-page-content-header .btn-add-page:active{padding:3px 5px}.wiki-page-sidebar .wiki-page-content-header .wiki-page-content-header-actions{padding:0}.wiki-page-sidebar .wiki-search-form{margin:55px 0 15px;display:block;float:none;clear:both;max-width:none}.wiki-page-sidebar .wiki-content ul.wiki-page-list .page-title:hover{border-radius:0}.wiki-page-sidebar .ui-resizable-handle.ui-resizable-e{cursor:ew-resize}@media (max-width:1199px){.wiki-page-sidebar{padding-right:15px}.wiki-page-sidebar:not(.visible-lg){width:100%!important}.wiki-page-sidebar:not(.visible-lg) .ui-resizable-handle{display:none}.wiki-page-sidebar #category_list_view.wiki-page-list{margin-left:0;margin-right:0}.wiki-page-sidebar #category_list_view.wiki-page-list .page-title:hover{border-radius:4px}.wiki-page-sidebar .wiki-page-content-header{padding:14px 8px 20px}.wiki-page-sidebar .wiki-page-content-header h3{color:var(--text-color-main);font-weight:400;text-transform:none;font-size:12px;margin-right:16px}.wiki-page-sidebar .wiki-page-content-header h3,.wiki-page-sidebar .wiki-page-content-header h3 .fa{font-size:28px}.wiki-page-sidebar .wiki-page-content-header .btn-sm{padding:4px 8px;margin-top:4px}.wiki-page-sidebar .wiki-page-content-header .btn-add-page{display:none}.wiki-page-sidebar .wiki-search-form{float:left;clear:none;max-width:none;margin:0}}.wiki-page-list-table .wiki-search-form{float:left}.wiki-page-list-table .table-responsive{padding-left:15px;padding-right:15px}.wiki-page-list-table .table-responsive .grid-view{padding:15px 0}.wiki-page-list-table .table-responsive .grid-view .pagination{margin-bottom:0}.wiki-page-list-table .table-responsive table a:hover{color:var(--info)}.wiki-page-list-table .table-responsive table .wiki-page-list-row-title{font-size:14px;font-weight:500}.wiki-page-list-table .table-responsive table .wiki-page-list-row-title a{display:block}.wiki-page-list-table .table-responsive table .wiki-page-list-row-title a:hover{color:var(--text-color-highlight)}.wiki-page-list-table .table-responsive table td{font-size:14px;border:none}.wiki-page-list-table .table-responsive table td:hover{cursor:pointer}.wiki-page-list-table .table-responsive table td:first-child{padding-left:12px;border-top-left-radius:4px;border-bottom-left-radius:4px}.wiki-page-list-table .table-responsive table td:last-child{border-top-right-radius:4px;border-bottom-right-radius:4px}.wiki-page-list-table .table-responsive .pagination>.active>a,.wiki-page-list-table .table-responsive .pagination>.active>a:focus,.wiki-page-list-table .table-responsive .pagination>.active>a:hover,.wiki-page-list-table .table-responsive .pagination>.active>span,.wiki-page-list-table .table-responsive .pagination>.active>span:focus,.wiki-page-list-table .table-responsive .pagination>.active>span:hover{background-color:var(--info);border-color:var(--info)}@media (max-width:1199px){.wiki-page-list-table .table-responsive{border:none}.wiki-right-part:not(.visible-lg){width:100%!important}}@media (max-width:768px){.layout-content-container .wiki-page-content .wiki-page-body{padding-left:0;padding-right:0}}.wiki-preview{border:1px solid #e1e1e1;border-radius:4px;padding:10px}.wiki-preview .wiki-preview-content{margin-bottom:10px}.wiki-icon-print{float:right;cursor:pointer}@media print{#topbar-first,.comment-container,.footer-nav,.social-controls,.space-nav,.wiki-content-info,.wiki-icon-print,.wiki-menu{display:none}.layout-content-container .wiki-content{border:none}.space-layout-container{margin:0}#page-content-wrapper{padding:0}} -/* CSS Styling for numbering wiki page content */ -.numbered { counter-reset: h1 h2 h3;}.numbered h1{counter-set: h2 0;}.numbered h1::before { counter-increment: h1; content: counter(h1) ' ';}.numbered h2{counter-set: h3 0;}.numbered h2::before { counter-increment: h2; content: counter(h1) '.' counter(h2) ' ';}.numbered h3::before { counter-increment: h3; content: counter(h1) '.' counter(h2) '.' counter(h3) ' ';}.numbered h1.wiki-page-title::before { counter-increment: none; content: none;} /* CSS Styling for toggle button */ .toggle-numbering {margin-left: auto;padding-right: 10px;} \ No newline at end of file diff --git a/resources/js/humhub.wiki.bundle.js b/resources/js/humhub.wiki.bundle.js index 63544264..e99f31ac 100644 --- a/resources/js/humhub.wiki.bundle.js +++ b/resources/js/humhub.wiki.bundle.js @@ -158,6 +158,7 @@ humhub.module('wiki.Page', function (module, require, $) { that.buildIndex(); that.initAnchor(); that.initHeaderEditIcons(); + that.buildNumbering(); }); }; @@ -199,6 +200,49 @@ humhub.module('wiki.Page', function (module, require, $) { }); } + Page.prototype.buildNumbering = function() { + var headerLevel = 1; + var headerNum = []; + var minLevel = this.$.find('#wiki-page-richtext h1').length ? 1 : 2; + var showh3 = this.$.find('#wiki-page-richtext h3').length <= module.config.tocMaxH3; + if (document.querySelector('.numbered')){ + this.$.find('#wiki-page-richtext').find('h1,h2' + (showh3 ? ',h3' : '')).each(function () { + var $header = $(this); + + // Determine the current header level (h1 -> 1, h2 -> 2, h3 -> 3) + var currentHeaderLevel = 1; + if ($header.is('h2')) { + currentHeaderLevel = minLevel === 2 ? 1 : 2; + } else if ($header.is('h3')) { + currentHeaderLevel = minLevel === 2 ? 2 : 3; + } + + // Adjust the header level for numbering + if (currentHeaderLevel !== headerLevel) { + if (currentHeaderLevel > headerLevel) { + headerNum[currentHeaderLevel] = 0; + } + headerLevel = currentHeaderLevel; + } + + if (typeof (headerNum[headerLevel]) === 'undefined') { + headerNum[headerLevel] = 0; + } + + headerNum[headerLevel]++; + + // Generate the numbering string (1, 1.1, 1.1.1, etc.) + var numberString = ''; + for (var i = 1; i <= headerLevel; i++) { + numberString += (i > 1 ? '.' : '') + (headerNum[i] || 1); + } + + // Add the numbering in front of the header text + $header.prepend('' + numberString + ' '); + }); + } + }; + Page.prototype.buildIndex = function () { var $list = $('
')),this.$.find("h1,h2,h3").each(function(){var t=h(this).find("a.header-anchor"),e='';t.length?t.before(e+" "):h(this).append(" "+e)}))},t.prototype.buildIndex=function(){var o=h('
')),this.$.find("h1,h2,h3").each(function(){var t=h(this).find("a.header-anchor"),e='';t.length?t.before(e+" "):h(this).append(" "+e)}))},t.prototype.buildIndex=function(){var o=h('