From c77fbebd22f4c08f2b4e07a9467240e04039e85c Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Wed, 22 Dec 2021 17:31:58 +0200 Subject: [PATCH] Discussions: Add ability to turn on the display of a list of topics above the wall --- Web/Models/Entities/Club.php | 5 ++ Web/Presenters/GroupPresenter.php | 1 + Web/Presenters/templates/Group/Edit.xml | 3 +- Web/Presenters/templates/Group/View.xml | 66 ++++++++++++------- .../sqls/00016-place-oftopic-list-setting.sql | 1 + locales/en.strings | 1 + locales/ru.strings | 1 + 7 files changed, 53 insertions(+), 25 deletions(-) create mode 100644 install/sqls/00016-place-oftopic-list-setting.sql diff --git a/Web/Models/Entities/Club.php b/Web/Models/Entities/Club.php index 26748d73..fff811f4 100644 --- a/Web/Models/Entities/Club.php +++ b/Web/Models/Entities/Club.php @@ -135,6 +135,11 @@ class Club extends RowModel return (bool) $this->getRecord()->everyone_can_create_topics; } + function isDisplayTopicsAboveWallEnabled(): bool + { + return (bool) $this->getRecord()->display_topics_above_wall; + } + function getType(): int { return $this->getRecord()->type; diff --git a/Web/Presenters/GroupPresenter.php b/Web/Presenters/GroupPresenter.php index 1af8ef28..7788c09e 100644 --- a/Web/Presenters/GroupPresenter.php +++ b/Web/Presenters/GroupPresenter.php @@ -208,6 +208,7 @@ final class GroupPresenter extends OpenVKPresenter $club->setWall(empty($this->postParam("wall")) ? 0 : 1); $club->setAdministrators_List_Display(empty($this->postParam("administrators_list_display")) ? 0 : $this->postParam("administrators_list_display")); $club->setEveryone_Can_Create_Topics(empty($this->postParam("everyone_can_create_topics")) ? 0 : 1); + $club->setDisplay_Topics_Above_Wall(empty($this->postParam("display_topics_above_wall")) ? 0 : 1);; $website = $this->postParam("website") ?? ""; if(empty($website)) diff --git a/Web/Presenters/templates/Group/Edit.xml b/Web/Presenters/templates/Group/Edit.xml index ecf17393..25c2b3d1 100644 --- a/Web/Presenters/templates/Group/Edit.xml +++ b/Web/Presenters/templates/Group/Edit.xml @@ -82,7 +82,8 @@ {_discussions}: - {_everyone_can_create_topics} + {_everyone_can_create_topics}
+ {_display_list_of_topics_above_wall} diff --git a/Web/Presenters/templates/Group/View.xml b/Web/Presenters/templates/Group/View.xml index f16c435d..a817b72c 100644 --- a/Web/Presenters/templates/Group/View.xml +++ b/Web/Presenters/templates/Group/View.xml @@ -41,36 +41,54 @@
- {var followersCount = $club->getFollowersCount()} - -
- {_participants} -
-
-
- {tr("participants", $followersCount)} -
- {_all_title} -
+ {var followersCount = $club->getFollowersCount()} + +
+ {_participants} +
+
+ +
+
+ {_discussions} +
+
+
+ {tr("topics", $topicsCount)} + +
+
+
+ {$topic->getTitle()}
+ {tr("updated_at", $topic->getUpdateTime())} +
+
+
+
{presenter "openvk!Wall->wallEmbedded", -$club->getId()} -
-
+
{_discussions}
diff --git a/install/sqls/00016-place-oftopic-list-setting.sql b/install/sqls/00016-place-oftopic-list-setting.sql new file mode 100644 index 00000000..500f6dff --- /dev/null +++ b/install/sqls/00016-place-oftopic-list-setting.sql @@ -0,0 +1 @@ +ALTER TABLE `groups` ADD COLUMN `display_topics_above_wall` BOOLEAN NOT NULL DEFAULT FALSE AFTER `everyone_can_create_topics`; diff --git a/locales/en.strings b/locales/en.strings index 1ab7b604..dfd47f2c 100644 --- a/locales/en.strings +++ b/locales/en.strings @@ -668,6 +668,7 @@ "created" = "Created"; "everyone_can_create_topics" = "Everyone can create topics"; +"display_list_of_topics_above_wall" = "Display a list of topics above the wall"; "topic_changes_saved_comment" = "The updated title and settings will appear on the topic page."; diff --git a/locales/ru.strings b/locales/ru.strings index 97900189..fdec87a6 100644 --- a/locales/ru.strings +++ b/locales/ru.strings @@ -703,6 +703,7 @@ "created" = "Создано"; "everyone_can_create_topics" = "Все могут создавать темы"; +"display_list_of_topics_above_wall" = "Отображать список тем над стеной"; "topic_changes_saved_comment" = "Обновлённый заголовок и настройки появятся на странице с темой.";