1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-16 14:50:48 +03:00

Доработка личных сообщений

This commit is contained in:
Denis Shakhov 2015-06-09 23:39:50 +07:00
parent 4ca2ac364d
commit 4a0e2099f0
6 changed files with 91 additions and 22 deletions

View file

@ -192,6 +192,17 @@ class ModuleTalk_EntityTalk extends Entity
}
/**
* Возвращает полный URL для удаления сообщения
*
* @return string
*/
public function getUrlDelete()
{
return Router::GetPath('talk') . 'delete/' . $this->getId() . '/';
}
/**
* Устанавливает ID сообщения
*

View file

@ -30,6 +30,7 @@
"talk": "js/talk.js"
},
"styles": {
"talk": "css/talk.css"
"talk": "css/talk.css",
"message-root": "css/message-root.css"
}
}

View file

@ -0,0 +1,21 @@
/**
* Первое сообщение в диалоге
*
* @license GNU General Public License, version 2
* @copyright 2013 OOO "ЛС-СОФТ" {@link http://livestreetcms.com}
* @author Denis Shakhov <denis.shakhov@gmail.com>
*/
.ls-talk-message-root,
.ls-talk-message-root-info,
.ls-talk-message-root-actionbar,
.ls-talk-message-root-text {
margin-bottom: 15px;
}
.ls-talk-message-root-info-item {
display: inline-block;
}
.ls-talk-message-root-info-item--author {
margin-right: 15px;
}

View file

@ -15,6 +15,10 @@
margin-bottom: 0;
}
.ls-talk-participants-details {
margin-bottom: 30px;
}
/**
* Message user list
*/

View file

@ -2,21 +2,47 @@
* Первое сообщение в диалоге
*}
{extends 'Component@article.article'}
{$component = 'ls-talk-message-root'}
{block 'article_options'}
{$article = $smarty.local.talk}
{* Генерируем копии локальных переменных, *}
{* чтобы их можно было изменять в дочерних шаблонах *}
{foreach [ 'talk', 'mods', 'classes', 'attributes' ] as $param}
{assign var="$param" value=$smarty.local.$param}
{/foreach}
{$smarty.block.parent}
{$type = 'talk'}
{$classes = "{$classes} talk"}
{/block}
<div class="{$component} {cmods name=$component mods=$mods} {$classes}" {cattr list=$attributes}>
{* Заголовок *}
<h2 class="{$component}-title">
{$talk->getTitle()}
</h2>
{* Информация *}
{block 'article_footer_info_items' append}
{* Избранное *}
<li class="{$component}-info-item {$component}-info-item--favourite">
{component 'favourite' classes="js-favourite-{$type}" target=$article}
</li>
{/block}
{* Информация *}
<ul class="{$component}-info">
{* Автор *}
<li class="{$component}-info-item {$component}-info-item--author">
{component 'user' template='avatar' user=$talk->getUser() size='xxsmall' mods='inline'}
</li>
<li class="{$component}-info-item {$component}-info-item--date">
<time 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>
</li>
</ul>
{* Содержимое *}
<div class="{$component}-text ls-text">
{$talk->getText()}
</div>
{* Действия *}
{component 'actionbar' classes="{$component}-actionbar" items=[
[ 'buttons' => [
[ 'text' => {component 'favourite' classes="js-favourite-talk" target=$talk}, 'mods' => 'icon', 'classes' => 'js-talk-message-root-favourite' ]
]],
[ 'buttons' => [
[ 'icon' => 'trash', 'url' => "{$talk->getUrlDelete()}?security_ls_key={$LIVESTREET_SECURITY_KEY}", 'text' => {lang 'common.remove'}, 'show' => $oUserCurrent->getId() == $talk->getUser()->getId() || $oUserCurrent->isAdministrator() ]
]]
]}
</div>

View file

@ -13,13 +13,19 @@
{if ! $bNoComments}
{* Участники личного сообщения *}
{include './participants/participants.tpl'
users = $talk->getTalkUsers()
classes = 'message-users js-message-users'
attributes = [ 'data-param-target_id' => $talk->getId() ]
editable = $talk->getUserId() == $oUserCurrent->getId() || $oUserCurrent->isAdministrator()
title = $aLang.talk.users.title
excludeRemove = [ $oUserCurrent->getId() ]}
{capture 'talk_message_root_participants'}
{include './participants/participants.tpl'
users = $talk->getTalkUsers()
classes = 'message-users js-message-users'
attributes = [ 'data-param-target_id' => $talk->getId() ]
editable = $talk->getUserId() == $oUserCurrent->getId() || $oUserCurrent->isAdministrator()
excludeRemove = [ $oUserCurrent->getId() ]}
{/capture}
{component 'details'
classes = 'js-details-default ls-talk-participants-details'
title = "{lang 'talk.users.title'} ({count($talk->getTalkUsers())})"
content = $smarty.capture.talk_message_root_participants}
{* Вывод комментариев к сообщению *}
{component 'comment' template='comments'