mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-26 03:30:48 +03:00
Доработка превью топика
This commit is contained in:
parent
86e840c7f2
commit
e06bbadd17
|
@ -508,6 +508,7 @@ class ActionContent extends Action {
|
|||
$oTopic->setDateAdd(date("Y-m-d H:i:s"));
|
||||
$oTopic->setUserId($this->oUserCurrent->getId());
|
||||
$oTopic->setType($sType);
|
||||
$oTopic->setPublish(1);
|
||||
/**
|
||||
* Валидируем необходимые поля топика
|
||||
*/
|
||||
|
@ -527,11 +528,8 @@ class ActionContent extends Action {
|
|||
* Рендерим шаблон для предпросмотра топика
|
||||
*/
|
||||
$oViewer=$this->Viewer_GetLocalViewer();
|
||||
$oViewer->Assign('oTopic',$oTopic);
|
||||
$sTemplate="topics/topic_preview_{$oTopic->getType()}.tpl";
|
||||
if (!$this->Viewer_TemplateExists($sTemplate)) {
|
||||
$sTemplate='topics/topic_preview.tpl';
|
||||
}
|
||||
$oViewer->Assign('topic',$oTopic,true);
|
||||
$sTemplate='components/topic/topic-preview.tpl';
|
||||
$sTextResult=$oViewer->Fetch($sTemplate);
|
||||
/**
|
||||
* Передаем результат в ajax ответ
|
||||
|
|
|
@ -64,6 +64,8 @@
|
|||
*
|
||||
* @template topics/topic_preview_X.tpl
|
||||
*/
|
||||
.topic-preview { margin-top: 30px; }
|
||||
.topic-preview .profile-page-header { border-top: 1px solid #ddd; }
|
||||
.topic-preview .topic { margin-bottom: 20px; }
|
||||
.topic-preview { margin-top: 30px; border: 1px solid #eee; }
|
||||
.topic-preview-header { padding: 20px 30px; background: #fafafa; }
|
||||
.topic-preview-title { margin: 0; }
|
||||
.topic-preview-body { padding: 30px; }
|
||||
.topic-preview-footer { padding: 0 30px 30px; }
|
|
@ -9,6 +9,7 @@
|
|||
{$component = 'article'}
|
||||
|
||||
{block 'article_options'}
|
||||
{$isPreview = $smarty.local.isPreview}
|
||||
{$user = $article->getUser()}
|
||||
{$type = ($article->getType()) ? $article->getType() : $smarty.local.type}
|
||||
{$isList = $smarty.local.isList}
|
||||
|
@ -50,7 +51,7 @@
|
|||
</ul>
|
||||
|
||||
{* Управление *}
|
||||
{if $article->getIsAllowAction()}
|
||||
{if $article->getIsAllowAction() && ! $isPreview}
|
||||
{block 'article_header_actions'}
|
||||
{$items = [
|
||||
[ 'icon' => 'icon-edit', 'url' => $article->getUrlEdit(), 'text' => $aLang.common.edit, 'show' => $article->getIsAllowEdit() ],
|
||||
|
|
|
@ -153,7 +153,7 @@
|
|||
|
||||
|
||||
{* Блок с превью текста *}
|
||||
<div class="topic-preview" style="display: none;" id="topic-text-preview"></div>
|
||||
<div style="display: none;" id="topic-text-preview"></div>
|
||||
|
||||
{block name='add_topic_end'}{/block}
|
||||
{hook run="add_topic_end"}
|
|
@ -1,22 +1,21 @@
|
|||
{**
|
||||
* Предпросмотр топика
|
||||
*
|
||||
* @param object $topic
|
||||
*
|
||||
* @styles css/topic.css
|
||||
*}
|
||||
|
||||
{$oUser = $oTopic->getUser()}
|
||||
<div class="topic-preview">
|
||||
<header class="topic-preview-header">
|
||||
<h3 class="topic-preview-title">{$aLang.common.preview_text}</h3>
|
||||
</header>
|
||||
|
||||
<h3 class="profile-page-header">{$aLang.common.preview_text}</h3>
|
||||
<div class="topic-preview-body">
|
||||
{include './topic-type.tpl' topic=$smarty.local.topic isPreview=true}
|
||||
</div>
|
||||
|
||||
{include './topic-type.tpl' topic=$oTopic}
|
||||
|
||||
{* TODO: Пофиксить кнопки сабмита *}
|
||||
<button type="submit" name="submit_topic_publish" class="button button-primary fl-r" onclick="jQuery('#submit_topic_publish').trigger('click');">
|
||||
{if $sEvent == 'add' or ($oTopicEdit and $oTopicEdit->getPublish() == 0)}
|
||||
{$aLang.topic_create_submit_publish}
|
||||
{else}
|
||||
{$aLang.topic_create_submit_update}
|
||||
{/if}
|
||||
</button>
|
||||
<button type="button" name="submit_preview" class="button js-topic-preview-text-hide-button">{$aLang.common.cancel}</button>
|
||||
<button type="submit" name="submit_topic_save" class="button" onclick="jQuery('#submit_topic_save').trigger('click');">{$aLang.topic_create_submit_save}</button>
|
||||
<footer class="topic-preview-footer">
|
||||
<button type="button" name="submit_preview" class="button js-topic-preview-text-hide-button">{$aLang.common.cancel}</button>
|
||||
</footer>
|
||||
</div>
|
|
@ -1,7 +1,8 @@
|
|||
{**
|
||||
* Подключение шаблона топика определенного типа
|
||||
*
|
||||
* @param object $topic
|
||||
* @param object $topic
|
||||
* @param boolean $isPreview
|
||||
*}
|
||||
|
||||
{$topic = $smarty.local.topic}
|
||||
|
@ -16,5 +17,5 @@
|
|||
{$template = './topic.tpl'}
|
||||
{/if}
|
||||
|
||||
{include "$template" topic=$topic isList=$smarty.local.isList}
|
||||
{include "$template" topic=$topic isList=$smarty.local.isList isPreview=$smarty.local.isPreview}
|
||||
{/if}
|
|
@ -1,7 +1,10 @@
|
|||
{**
|
||||
* Базовый шаблон топика
|
||||
* Используется также для отображения превью топика
|
||||
*
|
||||
* @param object $topic
|
||||
* @param object $topic
|
||||
* @param boolean $isList
|
||||
* @param boolean $isPreview
|
||||
*
|
||||
* @styles assets/css/topic.css
|
||||
* @scripts <framework>/js/livestreet/topic.js
|
||||
|
@ -31,9 +34,11 @@
|
|||
{block 'article_header_info' prepend}
|
||||
{$blog = $topic->getBlog()}
|
||||
|
||||
<li class="{$component}-info-item {$component}-info-item--blog">
|
||||
<a href="{$blog->getUrlFull()}">{$blog->getTitle()|escape}</a>
|
||||
</li>
|
||||
{if ! $isPreview}
|
||||
<li class="{$component}-info-item {$component}-info-item--blog">
|
||||
<a href="{$blog->getUrlFull()}">{$blog->getTitle()|escape}</a>
|
||||
</li>
|
||||
{/if}
|
||||
{/block}
|
||||
|
||||
|
||||
|
@ -72,45 +77,51 @@
|
|||
{if ! $isList and $topic->getTypeObject()->getParam('allow_tags')}
|
||||
{$favourite = $topic->getFavourite()}
|
||||
|
||||
{include 'components/tags/tag_list.tpl'
|
||||
aTags = $topic->getTagsArray()
|
||||
bTagsUseFavourite = true
|
||||
aTagsFavourite = ($favourite) ? $favourite->getTagsArray() : []
|
||||
sTagsFavouriteType = 'topic'
|
||||
iTagsFavouriteId = $topic->getId()}
|
||||
{if ! $isPreview}
|
||||
{include 'components/tags/tag_list.tpl'
|
||||
aTags = $topic->getTagsArray()
|
||||
bTagsUseFavourite = true
|
||||
aTagsFavourite = ($favourite) ? $favourite->getTagsArray() : []
|
||||
sTagsFavouriteType = 'topic'
|
||||
iTagsFavouriteId = $topic->getId()}
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{$smarty.block.parent}
|
||||
|
||||
{* Всплывающий блок появляющийся при нажатии на кнопку Поделиться *}
|
||||
<div class="tooltip" id="topic_share_{$topic->getId()}">
|
||||
<div class="tooltip-content js-tooltip-content">
|
||||
{hookb run="topic_share" topic=$topic isList=$isList}
|
||||
<div class="yashare-auto-init" data-yashareTitle="{$topic->getTitle()|escape}" data-yashareLink="{$topic->getUrl()}" data-yashareL10n="ru" data-yashareType="button" data-yashareQuickServices="yaru,vkontakte,facebook,twitter,odnoklassniki,moimir,lj,gplus"></div>
|
||||
{/hookb}
|
||||
{if ! $isPreview}
|
||||
<div class="tooltip" id="topic_share_{$topic->getId()}">
|
||||
<div class="tooltip-content js-tooltip-content">
|
||||
{hookb run="topic_share" topic=$topic isList=$isList}
|
||||
<div class="yashare-auto-init" data-yashareTitle="{$topic->getTitle()|escape}" data-yashareLink="{$topic->getUrl()}" data-yashareL10n="ru" data-yashareType="button" data-yashareQuickServices="yaru,vkontakte,facebook,twitter,odnoklassniki,moimir,lj,gplus"></div>
|
||||
{/hookb}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/block}
|
||||
|
||||
|
||||
{* Информация *}
|
||||
{block 'article_footer_info_items'}
|
||||
{* Голосование *}
|
||||
<li class="{$component}-info-item {$component}-info-item--vote">
|
||||
{$isExpired = strtotime($topic->getDateAdd()) < $smarty.now - Config::Get('acl.vote.topic.limit_time')}
|
||||
{if ! $isPreview}
|
||||
<li class="{$component}-info-item {$component}-info-item--vote">
|
||||
{$isExpired = strtotime($topic->getDateAdd()) < $smarty.now - Config::Get('acl.vote.topic.limit_time')}
|
||||
|
||||
{include 'components/vote/vote.tpl'
|
||||
oObject = $topic
|
||||
sClasses = 'js-vote-topic'
|
||||
sMods = 'small white topic'
|
||||
bUseAbstain = true
|
||||
bIsLocked = ( $oUserCurrent && $topic->getUserId() == $oUserCurrent->getId() ) || $isExpired
|
||||
bShowRating = $topic->getVote() || ($oUserCurrent && $topic->getUserId() == $oUserCurrent->getId()) || $isExpired}
|
||||
</li>
|
||||
{include 'components/vote/vote.tpl'
|
||||
oObject = $topic
|
||||
sClasses = 'js-vote-topic'
|
||||
sMods = 'small white topic'
|
||||
bUseAbstain = true
|
||||
bIsLocked = ( $oUserCurrent && $topic->getUserId() == $oUserCurrent->getId() ) || $isExpired
|
||||
bShowRating = $topic->getVote() || ($oUserCurrent && $topic->getUserId() == $oUserCurrent->getId()) || $isExpired}
|
||||
</li>
|
||||
{/if}
|
||||
|
||||
{$smarty.block.parent}
|
||||
|
||||
{if ! $isList}
|
||||
{if ! $isList && ! $isPreview}
|
||||
{* Избранное *}
|
||||
<li class="{$component}-info-item {$component}-info-item--favourite">
|
||||
{include 'components/favourite/favourite.tpl' sClasses="js-favourite-{$type}" oObject=$article}
|
||||
|
|
Loading…
Reference in a new issue