Discussions: Add ability to turn on the display of a list of topics above the wall

This commit is contained in:
Maxim Leshchenko 2021-12-22 17:31:58 +02:00
parent d2814bef01
commit c77fbebd22
No known key found for this signature in database
GPG key ID: BB9C44A8733FBEEE
7 changed files with 53 additions and 25 deletions

View file

@ -135,6 +135,11 @@ class Club extends RowModel
return (bool) $this->getRecord()->everyone_can_create_topics; return (bool) $this->getRecord()->everyone_can_create_topics;
} }
function isDisplayTopicsAboveWallEnabled(): bool
{
return (bool) $this->getRecord()->display_topics_above_wall;
}
function getType(): int function getType(): int
{ {
return $this->getRecord()->type; return $this->getRecord()->type;

View file

@ -208,6 +208,7 @@ final class GroupPresenter extends OpenVKPresenter
$club->setWall(empty($this->postParam("wall")) ? 0 : 1); $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->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->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") ?? ""; $website = $this->postParam("website") ?? "";
if(empty($website)) if(empty($website))

View file

@ -82,7 +82,8 @@
<span class="nobold">{_discussions}: </span> <span class="nobold">{_discussions}: </span>
</td> </td>
<td> <td>
<input type="checkbox" name="everyone_can_create_topics" value="1" n:attr="checked => $club->isEveryoneCanCreateTopics()" /> {_everyone_can_create_topics} <input type="checkbox" name="everyone_can_create_topics" value="1" n:attr="checked => $club->isEveryoneCanCreateTopics()" /> {_everyone_can_create_topics}<br>
<input type="checkbox" name="display_topics_above_wall" value="1" n:attr="checked => $club->isDisplayTopicsAboveWallEnabled()" /> {_display_list_of_topics_above_wall}
</td> </td>
</tr> </tr>
<tr> <tr>

View file

@ -68,9 +68,27 @@
</div> </div>
</div> </div>
</div> </div>
<div n:if="($topicsCount > 0 || $club->isEveryoneCanCreateTopics() || ($thisUser && $club->canBeModifiedBy($thisUser))) && $club->isDisplayTopicsAboveWallEnabled()">
<div class="content_title_expanded" onclick="hidePanel(this, {$topicsCount});">
{_discussions}
</div>
<div>
<div class="content_subtitle">
{tr("topics", $topicsCount)}
<div style="float: right;">
<a href="/board{$club->getId()}">{_"all_title"}</a>
</div>
</div>
<div>
<div n:foreach="$topics as $topic" class="topic-list-item" style="padding: 8px;">
<b><a href="/topic{$topic->getPrettyId()}">{$topic->getTitle()}</a></b><br>
<span class="nobold">{tr("updated_at", $topic->getUpdateTime())}</span>
</div>
</div>
</div>
</div>
{presenter "openvk!Wall->wallEmbedded", -$club->getId()} {presenter "openvk!Wall->wallEmbedded", -$club->getId()}
</div> </div>
<div class="right_small_block"> <div class="right_small_block">
<a href="{$club->getAvatarLink()|nocheck}"> <a href="{$club->getAvatarLink()|nocheck}">
@ -194,7 +212,7 @@
</div> </div>
</div> </div>
</div> </div>
<div n:if="$topicsCount > 0 || $club->isEveryoneCanCreateTopics() || ($thisUser && $club->canBeModifiedBy($thisUser))"> <div n:if="($topicsCount > 0 || $club->isEveryoneCanCreateTopics() || ($thisUser && $club->canBeModifiedBy($thisUser))) && !$club->isDisplayTopicsAboveWallEnabled()">
<div class="content_title_expanded" onclick="hidePanel(this, {$topicsCount});"> <div class="content_title_expanded" onclick="hidePanel(this, {$topicsCount});">
{_discussions} {_discussions}
</div> </div>

View file

@ -0,0 +1 @@
ALTER TABLE `groups` ADD COLUMN `display_topics_above_wall` BOOLEAN NOT NULL DEFAULT FALSE AFTER `everyone_can_create_topics`;

View file

@ -668,6 +668,7 @@
"created" = "Created"; "created" = "Created";
"everyone_can_create_topics" = "Everyone can create topics"; "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."; "topic_changes_saved_comment" = "The updated title and settings will appear on the topic page.";

View file

@ -703,6 +703,7 @@
"created" = "Создано"; "created" = "Создано";
"everyone_can_create_topics" = "Все могут создавать темы"; "everyone_can_create_topics" = "Все могут создавать темы";
"display_list_of_topics_above_wall" = "Отображать список тем над стеной";
"topic_changes_saved_comment" = "Обновлённый заголовок и настройки появятся на странице с темой."; "topic_changes_saved_comment" = "Обновлённый заголовок и настройки появятся на странице с темой.";