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

Доработка превью топика

This commit is contained in:
Denis Shakhov 2014-11-20 16:20:17 +07:00
parent 6bb2166ce0
commit 0788867489
5 changed files with 15 additions and 12 deletions

View file

@ -580,8 +580,9 @@ class ActionContent extends Action
* Рендерим шаблон для предпросмотра топика
*/
$oViewer = $this->Viewer_GetLocalViewer();
$oViewer->Assign('isPreview', true, true);
$oViewer->Assign('topic', $oTopic, true);
$sTemplate = 'components/topic/topic-preview.tpl';
$sTemplate = 'components/topic/topic-type.tpl';
$sTextResult = $oViewer->Fetch($sTemplate);
/**
* Передаем результат в ajax ответ

View file

@ -64,7 +64,7 @@
*
* @template topics/topic_preview_X.tpl
*/
.topic-preview { margin-top: 30px; border: 1px solid #eee; }
.topic-preview { margin-top: 30px; border: 1px solid #eee; display: none; }
.topic-preview-header { padding: 20px 30px; background: #fafafa; }
.topic-preview-title { margin: 0; }
.topic-preview-body { padding: 30px; }

View file

@ -26,6 +26,7 @@
// Селекторы
selectors: {
preview: '#topic-text-preview',
preview_content: '#topic-text-preview .js-topic-preview-content',
buttons: {
preview: '.js-topic-preview-text-button',
preview_hide: '.js-topic-preview-text-hide-button',
@ -45,6 +46,7 @@
this.elements = {
preview: $( this.option( 'selectors.preview' ) ),
preview_content: $( this.option( 'selectors.preview_content' ) ),
buttons: {
preview: this.element.find( this.option( 'selectors.buttons.preview' ) ),
preview_hide: $( this.option( 'selectors.buttons.preview_hide' ) ),
@ -53,6 +55,8 @@
}
};
console.log(this.elements)
// Иниц-ия формы
this.element.lsContent({
urls: {
@ -86,7 +90,8 @@
if ( response.bStateError ) {
ls.msg.error( null, response.sMsg );
} else {
this.elements.preview.show().html( response.sText );
this.elements.preview.show();
this.elements.preview_content.html( response.sText );
}
}.bind( this ), {
submitButton: this.elements.buttons.preview
@ -97,7 +102,8 @@
* Закрытие превью текста
*/
previewHide: function() {
this.elements.preview.hide().empty();
this.elements.preview.hide();
this.elements.preview_content.empty();
}
});
})(jQuery);

View file

@ -151,7 +151,7 @@
{* Блок с превью текста *}
<div style="display: none;" id="topic-text-preview"></div>
{include './topic-preview.tpl'}
{block 'add_topic_end'}{/block}
{hook run="add_topic_end"}

View file

@ -2,20 +2,16 @@
* Предпросмотр топика
*
* @param object $topic
*
* @styles css/topic.css
*}
<div class="topic-preview">
<div class="topic-preview" id="topic-text-preview">
<header class="topic-preview-header">
<h3 class="topic-preview-title">{$aLang.common.preview_text}</h3>
</header>
<div class="topic-preview-body">
{include './topic-type.tpl' topic=$smarty.local.topic isPreview=true}
</div>
<div class="topic-preview-body js-topic-preview-content"></div>
<footer class="topic-preview-footer">
<button type="button" name="submit_preview" class="button js-topic-preview-text-hide-button">{$aLang.common.cancel}</button>
{include 'components/button/button.tpl' type='button' classes='js-topic-preview-text-hide-button' text=$aLang.common.cancel}
</footer>
</div>