mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-16 23:00:51 +03:00
Доработка компонента talk
This commit is contained in:
parent
a85c76267f
commit
5b596358b3
|
@ -1063,7 +1063,7 @@ class ActionTalk extends Action {
|
|||
'sUserLink'=>$oUser->getUserWebPath(),
|
||||
'sUserWebPath'=>$oUser->getUserWebPath(),
|
||||
'sUserAvatar48'=>$oUser->getProfileAvatarPath(48),
|
||||
'sHtml'=>$oViewer->Fetch("components/user_list_small/user_list_small_item.message.tpl")
|
||||
'sHtml'=>$oViewer->Fetch("components/talk/talk-users-item.tpl")
|
||||
);
|
||||
$bState=true;
|
||||
} else {
|
||||
|
@ -1125,7 +1125,7 @@ class ActionTalk extends Action {
|
|||
'sMsgTitle'=>$this->Lang_Get('attention'),
|
||||
'sMsg'=>$this->Lang_Get('user_list_add.notices.success_add',array('login',htmlspecialchars($sUser))),
|
||||
'iUserId'=>$oUser->getId(),
|
||||
'sHtml'=>$oViewer->Fetch("components/user_list_small/user_list_small_item.message.tpl")
|
||||
'sHtml'=>$oViewer->Fetch("components/talk/talk-users-item.tpl")
|
||||
);
|
||||
$bState=true;
|
||||
} else {
|
||||
|
|
|
@ -384,6 +384,7 @@ return array(
|
|||
*/
|
||||
'talk' => array(
|
||||
'title' => 'Сообщения',
|
||||
'participants' => '%%count%% участник;%%count%% участника;%%count%% участников',
|
||||
|
||||
// Меню
|
||||
'nav' => array(
|
||||
|
|
|
@ -5,5 +5,5 @@
|
|||
{extends 'layouts/layout.user.messages.tpl'}
|
||||
|
||||
{block 'layout_content'}
|
||||
{include 'components/talk/talk-list.tpl'}
|
||||
{include 'components/talk/talk-list.tpl' talks=$aTalks}
|
||||
{/block}
|
|
@ -10,5 +10,5 @@
|
|||
|
||||
{block 'layout_content'}
|
||||
{include 'components/talk/talk-search-form.tpl'}
|
||||
{include 'components/talk/talk-list.tpl' bMessageListCheckboxes=true}
|
||||
{include 'components/talk/talk-list.tpl' talks=$aTalks selectable=true}
|
||||
{/block}
|
|
@ -1,77 +1,84 @@
|
|||
{**
|
||||
* Список диалогов
|
||||
*
|
||||
* @param array $talks
|
||||
* @param boolean $selectable
|
||||
*}
|
||||
|
||||
{if $aTalks}
|
||||
{if $smarty.local.talks}
|
||||
<form action="{router page='talk'}" method="post" id="talk-form">
|
||||
{* Скрытые поля *}
|
||||
{include 'components/field/field.hidden.security_key.tpl'}
|
||||
{include 'components/field/field.hidden.tpl' sName='form_action' sId='talk-form-action'}
|
||||
|
||||
{* Экшнбар *}
|
||||
{include 'components/actionbar/actionbar.item.select.tpl' sItemSelector='.js-message-list-item' assign=sMessagesSelect aItems=[
|
||||
[ 'text' => $aLang.talk.actionbar.read, 'filter' => ":not('.message-unread')" ],
|
||||
[ 'text' => $aLang.talk.actionbar.unread, 'filter' => ".message-unread" ]
|
||||
]}
|
||||
{if $smarty.local.selectable}
|
||||
{include 'components/actionbar/actionbar.item.select.tpl' sItemSelector='.js-message-list-item' assign=select aItems=[
|
||||
[ 'text' => $aLang.talk.actionbar.read, 'filter' => ":not('.message-unread')" ],
|
||||
[ 'text' => $aLang.talk.actionbar.unread, 'filter' => ".message-unread" ]
|
||||
]}
|
||||
|
||||
{include 'components/actionbar/actionbar.tpl' aItems=[
|
||||
[ 'html' => $sMessagesSelect ],
|
||||
[ 'icon' => 'icon-ok', 'classes' => 'js-talk-form-action', 'attributes' => 'data-action="mark_as_read"', 'text' => $aLang.talk.actionbar.mark_as_read ],
|
||||
[ 'icon' => 'icon-remove', 'classes' => 'js-talk-form-action', 'attributes' => 'data-action="remove"', 'text' => $aLang.common.remove ]
|
||||
]}
|
||||
{include 'components/actionbar/actionbar.tpl' aItems=[
|
||||
[ 'html' => $select ],
|
||||
[ 'icon' => 'icon-ok', 'classes' => 'js-talk-form-action', 'attributes' => 'data-action="mark_as_read"', 'text' => $aLang.talk.actionbar.mark_as_read ],
|
||||
[ 'icon' => 'icon-remove', 'classes' => 'js-talk-form-action', 'attributes' => 'data-action="remove"', 'text' => $aLang.common.remove ]
|
||||
]}
|
||||
{/if}
|
||||
|
||||
{* Список сообщений *}
|
||||
<table class="table table-talk message-list">
|
||||
<tbody>
|
||||
{foreach $aTalks as $oTalk}
|
||||
{foreach $smarty.local.talks as $talk}
|
||||
{* Создатель диалога *}
|
||||
{$oAuthor = $oTalk->getTalkUser()}
|
||||
{$author = $talk->getTalkUser()}
|
||||
|
||||
{* Все участники диалога *}
|
||||
{$aUsers = $oTalk->getTalkUsers()}
|
||||
{$users = $talk->getTalkUsers()}
|
||||
|
||||
{* Кол-во участников диалога *}
|
||||
{$iUsersCount = count($aUsers)}
|
||||
{$usersCount = count($users)}
|
||||
|
||||
<tr class="message-list-item {if $oAuthor->getCommentCountNew() or ! $oAuthor->getDateLast()}message-unread{/if} js-message-list-item" data-id="{$oTalk->getId()}">
|
||||
<tr class="message-list-item {if $author->getCommentCountNew() or ! $author->getDateLast()}message-unread{/if} js-message-list-item" data-id="{$talk->getId()}">
|
||||
{* Выделение *}
|
||||
<td class="cell-checkbox">
|
||||
<input type="checkbox" name="talk_select[{$oTalk->getId()}]" data-id="{$oTalk->getId()}" />
|
||||
</td>
|
||||
{if $smarty.local.selectable}
|
||||
<td class="cell-checkbox">
|
||||
<input type="checkbox" name="talk_select[{$talk->getId()}]" data-id="{$talk->getId()}" />
|
||||
</td>
|
||||
{/if}
|
||||
|
||||
{* Избранное *}
|
||||
<td class="cell-favourite">
|
||||
{include 'components/favourite/favourite.tpl' sClasses='js-favourite-talk' oObject=$oTalk}
|
||||
{include 'components/favourite/favourite.tpl' sClasses='js-favourite-talk' oObject=$talk}
|
||||
</td>
|
||||
|
||||
{* Основная информация о диалоге *}
|
||||
<td class="cell-info">
|
||||
<div class="message-list-info">
|
||||
{* Участники диалога *}
|
||||
{if $iUsersCount > 2}
|
||||
<a href="{router page='talk'}read/{$oTalk->getId()}/" class="message-list-info-avatar">
|
||||
{if $usersCount > 2}
|
||||
<a href="{router page='talk'}read/{$talk->getId()}/" class="message-list-info-avatar">
|
||||
<img src="{cfg name="path.skin.web"}/assets/images/avatars/avatar_male_64x64.png" />
|
||||
</a>
|
||||
|
||||
{$iUsersCount} участника
|
||||
{lang name='talk.participants' count=$usersCount plural=true}
|
||||
{else}
|
||||
{* Если участников двое, то отображаем только собеседника *}
|
||||
{foreach $aUsers as $oUser}
|
||||
{$oUser = $oUser->getUser()}
|
||||
{foreach $users as $user}
|
||||
{$user = $user->getUser()}
|
||||
|
||||
{if $oUser->getUserId() != $oUserCurrent->getId()}
|
||||
<a href="{$oUser->getUserWebPath()}" class="message-list-info-avatar">
|
||||
<img src="{$oUser->getProfileAvatarPath(64)}" alt="{$oUser->getLogin()}" />
|
||||
{if $user->getUserId() != $oUserCurrent->getId()}
|
||||
<a href="{$user->getUserWebPath()}" class="message-list-info-avatar">
|
||||
<img src="{$user->getProfileAvatarPath(64)}" alt="{$user->getLogin()}" />
|
||||
</a>
|
||||
|
||||
<a href="{$oUser->getUserWebPath()}" class="word-wrap">{$oUser->getDisplayName()}</a>
|
||||
<a href="{$user->getUserWebPath()}" class="word-wrap">{$user->getDisplayName()}</a>
|
||||
{/if}
|
||||
{/foreach}
|
||||
{/if}
|
||||
|
||||
{* Дата *}
|
||||
<time class="message-list-info-date" datetime="{date_format date=$oTalk->getDate() format='c'}" title="{date_format date=$oTalk->getDate() format='j F Y, H:i'}">
|
||||
{date_format date=$oTalk->getDate() hours_back="12" minutes_back="60" now="60" day="day H:i" format="j F Y, H:i"}
|
||||
<time class="message-list-info-date" datetime="{date_format date=$talk->getDate() format='c'}" title="{date_format date=$talk->getDate() format='j F Y, H:i'}">
|
||||
{date_format date=$talk->getDate() hours_back="12" minutes_back="60" now="60" day="day H:i" format="j F Y, H:i"}
|
||||
</time>
|
||||
</div>
|
||||
</td>
|
||||
|
@ -81,23 +88,23 @@
|
|||
<div class="message-list-item-extra">
|
||||
{* Заголовок *}
|
||||
<h2 class="message-list-item-title">
|
||||
<a href="{router page='talk'}read/{$oTalk->getId()}/">
|
||||
{$oTalk->getTitle()|escape:'html'}
|
||||
<a href="{router page='talk'}read/{$talk->getId()}/">
|
||||
{$talk->getTitle()|escape}
|
||||
</a>
|
||||
</h2>
|
||||
|
||||
{* Текст последнего сообщения *}
|
||||
<div class="message-list-item-text">
|
||||
{(($oTalk->getCommentLast()) ? $oTalk->getCommentLast()->getText() : $oTalk->getText())|strip_tags|truncate:120:"..."|escape}
|
||||
{(($talk->getCommentLast()) ? $talk->getCommentLast()->getText() : $talk->getText())|strip_tags|truncate:120:"..."|escape}
|
||||
</div>
|
||||
|
||||
{* Кол-во сообщений *}
|
||||
{if $oTalk->getCountComment()}
|
||||
{if $talk->getCountComment()}
|
||||
<div class="message-list-item-count">
|
||||
{$oTalk->getCountComment()}
|
||||
{$talk->getCountComment()}
|
||||
|
||||
{if $oAuthor->getCommentCountNew()}
|
||||
<strong>+{$oAuthor->getCommentCountNew()}</strong>
|
||||
{if $author->getCommentCountNew()}
|
||||
<strong>+{$author->getCommentCountNew()}</strong>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
|
Loading…
Reference in a new issue