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;
}
function isDisplayTopicsAboveWallEnabled(): bool
{
return (bool) $this->getRecord()->display_topics_above_wall;
}
function getType(): int
{
return $this->getRecord()->type;

View file

@ -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))

View file

@ -82,7 +82,8 @@
<span class="nobold">{_discussions}: </span>
</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>
</tr>
<tr>

View file

@ -41,36 +41,54 @@
</table>
</div>
<div n:if="$club->getFollowersCount() > 0">
{var followersCount = $club->getFollowersCount()}
<div class="content_title_expanded" onclick="hidePanel(this, {$followersCount});">
{_participants}
</div>
<div>
<div class="content_subtitle">
{tr("participants", $followersCount)}
<div style="float:right;">
<a href="/club{$club->getId()}/followers">{_all_title}</a>
</div>
{var followersCount = $club->getFollowersCount()}
<div class="content_title_expanded" onclick="hidePanel(this, {$followersCount});">
{_participants}
</div>
<div>
<div class="content_subtitle">
{tr("participants", $followersCount)}
<div style="float:right;">
<a href="/club{$club->getId()}/followers">{_all_title}</a>
</div>
<div style="padding-left: 5px;" class="content_list long">
<div class="cl_element" n:foreach="$club->getFollowers(1) as $follower">
<div class="cl_avatar">
<a href="{$follower->getURL()}">
<img class="ava" src="{$follower->getAvatarUrl()}" />
</a>
</div>
<a href="{$follower->getURL()}" class="cl_name">
<text class="cl_fname">{$follower->getFirstName()}</text>
<text class="cl_lname">{$follower->getLastName()}</text>
</a>
</div>
<div style="padding-left: 5px;" class="content_list long">
<div class="cl_element" n:foreach="$club->getFollowers(1) as $follower">
<div class="cl_avatar">
<a href="{$follower->getURL()}">
<img class="ava" src="{$follower->getAvatarUrl()}" />
</a>
</div>
<a href="{$follower->getURL()}" class="cl_name">
<text class="cl_fname">{$follower->getFirstName()}</text>
<text class="cl_lname">{$follower->getLastName()}</text>
</a>
</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()}
</div>
<div class="right_small_block">
<a href="{$club->getAvatarLink()|nocheck}">
@ -194,7 +212,7 @@
</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});">
{_discussions}
</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";
"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.";

View file

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