1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-01 05:55:02 +03:00

Оптимизация стены

This commit is contained in:
Denis Shakhov 2014-01-13 13:33:20 +07:00
parent 32d3f990be
commit 75bb572f14
9 changed files with 383 additions and 324 deletions

View file

@ -11,236 +11,281 @@
var ls = ls || {};
ls.wall = (function ($) {
"use strict";
this.options = {
login: ''
};
this.iIdForReply=null;
/**
* Добавление записи
* Дефолтные опции
*
* @private
*/
this.add = function(sText, iPid) {
$('.js-button-wall-submit').attr('disabled',true);
var url = aRouter['profile']+this.options.login+'/wall/add/';
var params = {sText: sText, iPid: iPid};
ls.hook.marker('addBefore');
$('#wall-text').addClass('loader');
ls.ajax.load(url, params, function(result) {
$('.js-button-wall-submit').attr('disabled',false);
if (result.bStateError) {
ls.msg.error(null, result.sMsg);
} else {
$('.js-wall-reply-parent-text').val('');
$('#wall-note-list-empty').hide();
this.loadNew();
ls.hook.run('ls_wall_add_after',[sText, iPid, result]);
}
$('#wall-text').removeClass('loader');
}.bind(this));
return false;
};
this.addReply = function(sText, iPid) {
$('.js-button-wall-submit').attr('disabled',true);
var url = aRouter['profile']+this.options.login+'/wall/add/';
var params = {sText: sText, iPid: iPid};
ls.hook.marker('addReplyBefore');
$('#wall-reply-text-' + iPid).addClass('loader');
ls.ajax.load(url, params, function(result) {
$('.js-button-wall-submit').attr('disabled',false);
if (result.bStateError) {
ls.msg.error(null, result.sMsg);
} else {
$('.js-wall-reply-text').val('');
this.loadReplyNew(iPid);
ls.hook.run('ls_wall_addreply_after',[sText, iPid, result]);
}
$('#wall-reply-text-' + iPid).removeClass('loader');
}.bind(this));
return false;
};
this.load = function(iIdLess,iIdMore,callback) {
var url = aRouter['profile']+this.options.login+'/wall/load/';
var params = {iIdLess: iIdLess ? iIdLess : '', iIdMore: iIdMore ? iIdMore : ''};
ls.hook.marker('loadBefore');
ls.ajax.load(url, params, callback);
return false;
};
this.loadReply = function(iIdLess,iIdMore,iPid,callback) {
var url = aRouter['profile']+this.options.login+'/wall/load-reply/';
var params = {iIdLess: iIdLess ? iIdLess : '', iIdMore: iIdMore ? iIdMore : '', iPid: iPid};
ls.hook.marker('loadReplyBefore');
ls.ajax.load(url, params, callback);
return false;
};
this.loadNext = function() {
var divLast=$('#wall-container').find('.js-wall-item:last-child');
if (divLast.length) {
var idLess=divLast.attr('id').replace('wall-item-','');
} else {
return false;
var _defaults = {
// Селекторы
selectors: {
entry: {
self: '.js-wall-comment',
remove: '.js-wall-comment-remove',
reply: '.js-wall-comment-reply'
},
form: {
self: '.js-wall-form',
text: '.js-wall-form-text',
submit: '.js-wall-form-submit'
},
get_more: {
self: '.js-wall-get-more',
count: '.js-wall-get-more-count'
},
comment_wrapper: '.js-wall-comment-wrapper',
entry_container: '.js-wall-entry-container',
empty: '#wall-empty'
},
// Роуты
routers: {
add: aRouter['profile'] + USER_PROFILE_LOGIN + '/wall/add/',
remove: aRouter['profile'] + USER_PROFILE_LOGIN + '/wall/remove/',
load: aRouter['profile'] + USER_PROFILE_LOGIN + '/wall/load/',
load_comments: aRouter['profile'] + USER_PROFILE_LOGIN + '/wall/load-reply/'
}
$('#wall-button-next').addClass('loading');
this.load(idLess,'',function(result) {
if (result.bStateError) {
ls.msg.error(null, result.sMsg);
} else {
if (result.iCountWall) {
$('#wall-container').append(result.sText);
}
var iCount=result.iCountWall-result.iCountWallReturn;
if (iCount) {
$('#wall-count-next').text(iCount);
} else {
$('#wall-button-next').detach();
}
ls.hook.run('ls_wall_loadnext_after',[idLess, result]);
}
$('#wall-button-next').removeClass('loading');
}.bind(this));
return false;
};
this.loadNew = function() {
var divFirst=$('#wall-container').find('.js-wall-item:first-child');
if (divFirst.length) {
var idMore=divFirst.attr('id').replace('wall-item-','');
} else {
var idMore=-1;
/**
* Инициализация
*
* @param {Object} options Опции
*/
this.init = function(options) {
// Иниц-ем модуль только на странице профиля юзера
if ( ! USER_PROFILE_LOGIN ) return;
var _this = this;
this.options = $.extend({}, _defaults, options);
this.elements = {
document: $(document),
empty: $(this.options.selectors.empty)
}
this.load('',idMore,function(result) {
if (result.bStateError) {
ls.msg.error(null, result.sMsg);
} else {
if (result.iCountWall) {
$('#wall-container').prepend(result.sText);
// Добавление
this.elements.document.on('submit', this.options.selectors.form.self, function(e) {
_this.add( $(this) );
e.preventDefault();
});
this.elements.document
.on('keyup', this.options.selectors.form.text, function(e) {
if (e.ctrlKey && (e.keyCode || e.which) == 13) {
$(this).closest('form').submit();
}
ls.hook.run('ls_wall_loadnew_after',[idMore, result]);
}
}.bind(this));
return false;
};
this.loadReplyNew = function(iPid) {
var divFirst=$('#wall-reply-container-'+iPid).find('.js-wall-reply-item:last-child');
if (divFirst.length) {
var idMore=divFirst.attr('id').replace('wall-reply-item-','');
} else {
var idMore=-1;
}
this.loadReply('',idMore,iPid,function(result) {
if (result.bStateError) {
ls.msg.error(null, result.sMsg);
} else {
if (result.iCountWall) {
$('#wall-reply-container-'+iPid).append(result.sText);
})
.on('click', this.options.selectors.form.text, function(e) {
// TODO: IE8 support
if (e.which == 1) {
_this.form.open($(this).closest('form'));
}
ls.hook.run('ls_wall_loadreplynew_after',[iPid, idMore, result]);
}
}.bind(this));
return false;
};
});
this.loadReplyNext = function(iPid) {
var divLast=$('#wall-reply-container-'+iPid).find('.js-wall-reply-item:first-child');
if (divLast.length) {
var idLess=divLast.attr('id').replace('wall-reply-item-','');
} else {
return false;
}
$('#wall-reply-button-next-' + iPid).addClass('loading');
this.loadReply(idLess,'',iPid,function(result) {
if (result.bStateError) {
ls.msg.error(null, result.sMsg);
} else {
if (result.iCountWall) {
$('#wall-reply-container-'+iPid).prepend(result.sText);
}
var iCount=result.iCountWall-result.iCountWallReturn;
if (iCount) {
$('#wall-reply-count-next-'+iPid).text(iCount);
} else {
$('#wall-reply-button-next-'+iPid).detach();
}
ls.hook.run('ls_wall_loadreplynext_after',[iPid, idLess, result]);
}
$('#wall-reply-button-next-' + iPid).removeClass('loading');
}.bind(this));
return false;
};
// Показать/скрыть форму добавления комментария
this.elements.document.on('click', this.options.selectors.entry.reply, function(e) {
_this.form.toggle( $(_this.options.selectors.form.self + '[data-id=' + $(this).data('id') + ']') );
e.preventDefault();
});
this.toggleReply = function(iId) {
$('#wall-item-' + iId + ' .wall-submit-reply').addClass('active').toggle().children('textarea').focus();
return false;
};
// Удаление записи
this.elements.document.on('click', this.options.selectors.entry.remove, function(e) {
_this.remove( $(this).data('id') );
e.preventDefault();
});
this.expandReply = function(iId) {
$('#wall-item-' + iId + ' .wall-submit-reply').addClass('active');
return false;
};
// Подгрузка записей
this.elements.document.on('click', this.options.selectors.get_more.self, function(e) {
_this.loadNext( $(this).data('id') );
e.preventDefault();
});
this.init = function(opt) {
if (opt) {
$.extend(true,this.options,opt);
}
jQuery(function($){
$(document).click(function(e) {
if (e.which==1) {
$('.wall-submit-reply.active').each(function(k,v){
if (!$(v).find('.js-wall-reply-text').val()) {
$(v).removeClass('active');
// Сворачиваем открытые формы
this.elements.document.on('click', function(e) {
// TODO: IE8 support
if (e.which == 1) {
$(_this.options.selectors.form.self + '.' + ls.options.classes.states.open).each(function(key, value) {
var oForm = $(value),
iId = oForm.data('id'),
oReply = $(_this.options.selectors.entry.reply + '[data-id=' + iId + ']');
if ( ! oForm.is(event.target) &&
oForm.has(event.target).length === 0 &&
! oReply.is(event.target) &&
! oForm.find(_this.options.selectors.form.text).val() ) {
if ( $(_this.options.selectors.entry_container + '[data-id=' + iId + ']' ).find(_this.options.selectors.entry.self).length ) {
_this.form.close(oForm);
} else {
_this.form.toggle(oForm);
}
});
}
});
$('body').on("click", ".wall-submit-reply, .link-dotted", function(e) {
e.stopPropagation();
});
$('.js-wall-reply-text').bind('keyup', function(e) {
key = e.keyCode || e.which;
if(e.ctrlKey && (key == 13)) {
var id=$(e.target).attr('id').replace('wall-reply-text-','');
this.addReply($(e.target).val(), id);
return false;
}
}.bind(this));
$('.js-wall-reply-parent-text').bind('keyup', function(e) {
key = e.keyCode || e.which;
if(e.ctrlKey && (key == 13)) {
this.add($(e.target).val(), 0);
return false;
}
}.bind(this));
}.bind(this));
};
this.remove = function(iId) {
var url = aRouter['profile']+this.options.login+'/wall/remove/';
var params = {iId: iId};
ls.hook.marker('removeBefore');
ls.ajax.load(url, params, function(result){
if (result.bStateError) {
ls.msg.error(null, result.sMsg);
} else {
$('#wall-item-'+iId).fadeOut('slow', function() {
ls.hook.run('ls_wall_remove_item_fade',[iId, result],this);
}
});
$('#wall-reply-item-'+iId).fadeOut('slow', function() {
ls.hook.run('ls_wall_remove_reply_item_fade',[iId, result],this);
});
ls.hook.run('ls_wall_remove_after',[iId, result]);
}
});
return false;
};
/**
* Добавляет комментарий к записи
*/
this.add = function(oForm) {
var oTextarea = oForm.find(this.options.selectors.form.text),
oButton = oForm.find(this.options.selectors.form.submit),
iId = oForm.data('id'),
sText = oTextarea.val();
ls.hook.marker('addBefore');
oButton.prop('disabled', true).addClass(ls.options.classes.states.loading);
oTextarea.prop('disabled', true);
ls.ajax.load(this.options.routers.add, { sText: sText, iPid: iId }, function(result) {
if (result.bStateError) {
ls.msg.error(null, result.sMsg);
} else {
if (iId === 0) this.elements.empty.hide();
oTextarea.val('');
this.loadNew(iId);
ls.hook.run('ls_wall_add_after', [sText, iId, result]);
}
oButton.prop('disabled', false).removeClass(ls.options.classes.states.loading);
oTextarea.prop('disabled', false);
}.bind(this));
};
/**
* Удаление записи/комментария
*
* @param {Number} iId ID записи
*/
this.remove = function(iId) {
var _this = this;
ls.hook.marker('removeBefore');
ls.ajax.load(this.options.routers.remove, { iId: iId }, function(result) {
if (result.bStateError) {
ls.msg.error(null, result.sMsg);
} else {
var entry = $(_this.options.selectors.entry.self + '[data-id=' + iId + ']');
entry.fadeOut('slow', function() {
if ( ! $(_this.options.selectors.entry.self).length ) _this.elements.empty.show();
ls.hook.run('ls_wall_remove_item_fade', [iId, result], this);
});
entry.next(_this.options.selectors.comment_wrapper).fadeOut('slow');
ls.hook.run('ls_wall_remove_after', [iId, result]);
}
});
};
/**
* Подгрузка
*/
this.load = function(iIdLess, iIdMore, iPid, callback) {
var params = { iIdLess: iIdLess ? iIdLess : '', iIdMore: iIdMore ? iIdMore : '', iPid: iPid };
ls.hook.marker('loadBefore');
ls.ajax.load(iPid === 0 ? this.options.routers.load : this.options.routers.load_comments, params, callback);
};
/**
* Подгрузка новых записей
*/
this.loadNew = function(iPid) {
var oContainer = $(this.options.selectors.entry_container + '[data-id=' + iPid + ']'),
iMoreId = oContainer.find(' > ' + this.options.selectors.entry.self + ':' + (iPid === 0 ? 'first' : 'last')).data('id') || -1;
this.load('', iMoreId, iPid, function(result) {
if (result.bStateError) {
ls.msg.error(null, result.sMsg);
} else {
if (result.iCountWall) {
oContainer[iPid === 0 ? 'prepend' : 'append'](result.sText);
}
this.form.close( $(this.options.selectors.form.self + '[data-id=' + iPid + ']') );
ls.hook.run('ls_wall_loadnew_after', [iPid, iMoreId, result]);
}
}.bind(this));
};
/**
* Подгрузка записей
*/
this.loadNext = function(iPid) {
var oContainer = $(this.options.selectors.entry_container + '[data-id=' + iPid + ']'),
oGetMore = $(this.options.selectors.get_more.self + '[data-id=' + iPid + ']'),
iLessId = oContainer.find(' > ' + this.options.selectors.entry.self + ':' + (iPid === 0 ? 'last' : 'first')).data('id') || undefined;
oGetMore.addClass(ls.options.classes.states.loading);
this.load(iLessId, '', iPid, function(result) {
if (result.bStateError) {
ls.msg.error(null, result.sMsg);
} else {
if (result.iCountWall) {
oContainer[ iPid === 0 ? 'append' : 'prepend' ](result.sText);
}
var iCount = result.iCountWall - result.iCountWallReturn;
if (iCount) {
oGetMore.find(this.options.selectors.get_more.count).text(iCount);
} else {
oGetMore.remove();
}
ls.hook.run('ls_wall_loadnext_after', [iLessId, result]);
}
oGetMore.removeClass(ls.options.classes.states.loading);
}.bind(this));
};
/**
* Форма
*/
this.form = function(_this) {
/**
* Разворачивает форму
*/
this.open = function(oForm) {
oForm.addClass(ls.options.classes.states.open);
};
/**
* Сворачивает форму
*/
this.close = function(oForm) {
oForm.removeClass(ls.options.classes.states.open);
};
/**
* Сворачивает/разворачивает форму
*/
this.expandToggle = function(oForm) {
this.form[ oForm.hasClass(ls.options.classes.states.open) ? 'close' : 'open' ](oForm);
}.bind(_this);
/**
* Показывает/скрывает форму комментирования
*/
this.toggle = function(oForm) {
oForm.toggle().find(this.options.selectors.form.text).focus();
this.form.expandToggle(oForm);
}.bind(_this);
return this;
}.call({}, this);
return this;
}).call(ls.wall || {},jQuery);
}).call(ls.wall || {}, jQuery);

View file

@ -1,28 +1,9 @@
{**
* Список комментариев к записи на стене
*
* @param array $aReplyWall Список комментариев
*}
{foreach $aReplyWall as $oReplyWall}
{$oReplyUser = $oReplyWall->getUser()}
<div id="wall-reply-item-{$oReplyWall->getId()}" class="js-wall-reply-item comment wall-comment-reply">
<a href="{$oReplyUser->getUserWebPath()}"><img src="{$oReplyUser->getProfileAvatarPath(48)}" alt="avatar" class="comment-avatar" /></a>
<ul class="comment-info">
<li class="comment-author"><a href="{$oReplyUser->getUserWebPath()}">{$oReplyUser->getDisplayName()}</a></li>
<li class="comment-date">
<time datetime="{date_format date=$oReplyWall->getDateAdd() format='c'}">
{date_format date=$oReplyWall->getDateAdd() hours_back="12" minutes_back="60" now="60" day="day H:i" format="j F Y, H:i"}
</time>
</li>
{if $oReplyWall->isAllowDelete()}
<li><a href="#" onclick="return ls.wall.remove({$oReplyWall->getId()});" class="link-dotted">{$aLang.wall_action_delete}</a></li>
{/if}
</ul>
<div class="comment-content text">
{$oReplyWall->getText()}
</div>
</div>
{foreach $aReplyWall as $oWallComment}
{include 'actions/ActionProfile/wall.entry.tpl' oWallEntry=$oWallComment bWallEntryShowReply=false sWallEntryClasses='wall-comment'}
{/foreach}

View file

@ -0,0 +1,42 @@
{**
* Стена / Запись (Пост / Комментарий)
*
* @param object $oWallEntry Комментарий
* @param boolean $bWallEntryShowReply Показывать или нет кнопку комментирования
* @param string $sWallEntryClasses Классы
*
* TODO: Унаследовать от базового шаблона комментария
*}
{$oUser = $oWallEntry->getUser()}
<div class="comment js-wall-comment {$sWallEntryClasses}" data-id="{$oWallEntry->getId()}">
<a href="{$oUser->getUserWebPath()}">
<img src="{$oUser->getProfileAvatarPath(48)}" alt="avatar" class="comment-avatar" />
</a>
<ul class="comment-info">
<li class="comment-author"><a href="{$oUser->getUserWebPath()}">{$oUser->getDisplayName()}</a></li>
<li class="comment-date">
<time datetime="{date_format date=$oWallEntry->getDateAdd() format='c'}">
{date_format date=$oWallEntry->getDateAdd() hours_back="12" minutes_back="60" now="60" day="day H:i" format="j F Y, H:i"}
</time>
</li>
</ul>
<div class="comment-content text">
{$oWallEntry->getText()}
</div>
{if ( $oUserCurrent && $bWallEntryShowReply ) || $oWallEntry->isAllowDelete()}
<ul class="comment-actions">
{if $bWallEntryShowReply}
<li><a href="#" class="link-dotted js-wall-comment-reply" data-id="{$oWallEntry->getId()}">{$aLang.wall_action_reply}</a></li>
{/if}
{if $oWallEntry->isAllowDelete()}
<li><a href="#" class="link-dotted js-wall-comment-remove" data-id="{$oWallEntry->getId()}">{$aLang.wall_action_delete}</a></li>
{/if}
</ul>
{/if}
</div>

View file

@ -0,0 +1,25 @@
{**
* Стена / Форма добавления записи
*
* @param integer $iWallFormId ID родительского поста
* @param boolean $bWallFormDisplay Отображать форму или нет
* @param string $sWallFormPlaceholder Плейсхолдер
*}
{if ! isset($iWallFormId)}{$iWallFormId = 0}{/if}
{if ! isset($bWallFormDisplay)}{$bWallFormDisplay = true}{/if}
<form class="wall-form js-wall-form {$sWallFormClasses}" data-id="{$iWallFormId}" {if ! $bWallFormDisplay}style="display: none"{/if}>
{* Текст *}
{include 'forms/fields/form.field.textarea.tpl'
sFieldPlaceholder = "{if $sWallFormPlaceholder}{$sWallFormPlaceholder}{else}{$aLang.wall_add_title}{/if}"
sFieldClasses = 'width-full js-wall-form-text'}
{* Подвал формы *}
<footer class="wall-form-footer">
{include 'forms/fields/form.field.button.tpl'
sFieldStyle = 'primary'
sFieldClasses = 'js-wall-form-submit'
sFieldText = $aLang.wall_add_submit}
</footer>
</form>

View file

@ -1,66 +1,33 @@
{**
* Список записей на стене
* Список постов на стене
*
* @param array $aWall Список постов
*}
{foreach $aWall as $oWall}
{$oWallUser = $oWall->getUser()}
{$aReplyWall = $oWall->getLastReplyWall()}
{foreach $aWall as $oPost}
{$aPostComments = $oPost->getLastReplyWall()}
<div id="wall-item-{$oWall->getId()}" class="js-wall-item comment-wrapper">
<div class="comment">
<a href="{$oWallUser->getUserWebPath()}">
<img src="{$oWallUser->getProfileAvatarPath(48)}" alt="avatar" class="comment-avatar" />
</a>
{* Запись *}
{include 'actions/ActionProfile/wall.entry.tpl' oWallEntry=$oPost bWallEntryShowReply=!$aPostComments sWallEntryClasses='wall-post'}
<ul class="comment-info">
<li class="comment-author"><a href="{$oWallUser->getUserWebPath()}">{$oWallUser->getDisplayName()}</a></li>
<li class="comment-date">
<time datetime="{date_format date=$oWall->getDateAdd() format='c'}">
{date_format date=$oWall->getDateAdd() hours_back="12" minutes_back="60" now="60" day="day H:i" format="j F Y, H:i"}
</time>
</li>
{if $oWall->isAllowDelete()}
<li><a href="#" onclick="return ls.wall.remove({$oWall->getId()});" class="link-dotted">{$aLang.wall_action_delete}</a></li>
{/if}
</ul>
<div class="comment-content text">
{$oWall->getText()}
<div class="wall-comments js-wall-comment-wrapper" data-id="{$oPost->getId()}">
{* Кнопка подгрузки комментариев *}
{if count($aPostComments) < $oPost->getCountReply()}
<div class="get-more get-more-wall-comments js-wall-get-more" data-id="{$oPost->getId()}">
{$aLang.wall_load_reply_more} <span class="js-wall-get-more-count">{$oPost->getCountReply()}</span> {$oPost->getCountReply()|declension:$aLang.comment_declension}
</div>
{if $oUserCurrent and ! $aReplyWall}
<ul class="comment-actions">
<li><a href="#" class="link-dotted" onclick="return ls.wall.toggleReply({$oWall->getId()});">{$aLang.wall_action_reply}</a></li>
</ul>
{/if}
</div>
{if count($aReplyWall) < $oWall->getCountReply()}
<a href="#" onclick="return ls.wall.loadReplyNext({$oWall->getId()});" id="wall-reply-button-next-{$oWall->getId()}" class="get-more get-more-wall-comments">
<span class="wall-more-inner">
{$aLang.wall_load_reply_more}
<span id="wall-reply-count-next-{$oWall->getId()}">{$oWall->getCountReply()}</span>
{$oWall->getCountReply()|declension:$aLang.comment_declension}
</span>
</a>
{/if}
<div id="wall-reply-container-{$oWall->getId()}" class="comment-wrapper">
{if $aReplyWall}
{include file='actions/ActionProfile/wall.comments.tpl'}
{* Комментарии *}
<div class="js-wall-entry-container" data-id="{$oPost->getId()}">
{if $aPostComments}
{include 'actions/ActionProfile/wall.comments.tpl' aReplyWall=$aPostComments}
{/if}
</div>
{* Форма добавления комментария *}
{if $oUserCurrent}
<form class="wall-submit wall-submit-reply" {if !$aReplyWall}style="display: none"{/if}>
<textarea rows="4"
id="wall-reply-text-{$oWall->getId()}"
class="input-text width-full js-wall-reply-text"
placeholder="{$aLang.wall_reply_placeholder}"
onclick="return ls.wall.expandReply({$oWall->getId()});"></textarea>
<button type="button" onclick="ls.wall.addReply(jQuery('#wall-reply-text-{$oWall->getId()}').val(), {$oWall->getId()});" class="button button-primary js-button-wall-submit">{$aLang.wall_reply_submit}</button>
</form>
{include 'actions/ActionProfile/wall.form.tpl' iWallFormId=$oPost->getId() bWallFormDisplay=$aPostComments sWallFormPlaceholder=$aLang.wall_reply_placeholder}
{/if}
</div>
{/foreach}

View file

@ -7,34 +7,26 @@
{block name='layout_user_page_title'}{$aLang.user_menu_profile_wall}{/block}
{block name='layout_content'}
<script>
ls.wall.init({
login:'{$oUserProfile->getLogin()}'
});
</script>
{* Форма добавления записи *}
{if $oUserCurrent}
<form class="wall-submit">
<label for="wall-text">{$aLang.wall_add_title}:</label>
<p><textarea rows="4" id="wall-text" class="width-full js-wall-reply-parent-text"></textarea></p>
<button type="button" onclick="ls.wall.add(jQuery('#wall-text').val(),0);" class="button button-primary js-button-wall-submit">{$aLang.wall_add_submit}</button>
</form>
{include 'actions/ActionProfile/wall.form.tpl'}
{else}
{include file='alert.tpl' sAlertStyle='info' mAlerts=$aLang.wall_add_quest sAlertAttributes='id="wall-note-list-empty"'}
{include 'alert.tpl' sAlertStyle='info' mAlerts=$aLang.wall_add_quest}
{/if}
{if ! count($aWall)}
{include file='alert.tpl' mAlerts=$aLang.wall_list_empty sAlertStyle='empty' sAlertAttributes='id="wall-note-list-empty"'}
{include 'alert.tpl' mAlerts=$aLang.wall_list_empty sAlertStyle='empty' sAlertAttributes='id="wall-empty"'}
{/if}
<div id="wall-container" class="comments wall">
{include file='actions/ActionProfile/wall.posts.tpl'}
{* Список записей *}
<div class="js-wall-entry-container" data-id="0">
{include 'actions/ActionProfile/wall.posts.tpl'}
</div>
{* Кнопка подгрузки записей *}
{if $iCountWall - count($aWall)}
<div onclick="return ls.wall.loadNext();" id="wall-button-next" class="get-more">
{$aLang.wall_load_more} (<span id="wall-count-next">{$iCountWall-count($aWall)}</span>)
<div class="get-more js-wall-get-more" data-id="0">
{$aLang.wall_load_more} (<span class="js-wall-get-more-count">{$iCountWall - count($aWall)}</span>)
</div>
{/if}
{/block}

View file

@ -1,7 +1,7 @@
/**
* Стена
*
* @template actions/ActionProfile/wall_*.tpl
* @template actions/ActionProfile/wall.*.tpl
* @scripts <frontend>/common/js/wall.js
*
* @license GNU General Public License, version 2
@ -13,32 +13,32 @@
/**
* Форма добавления сообщения на стену
*/
.wall-submit { margin-bottom: 30px; }
.wall-submit.wall-submit-reply { margin: 2px 0 2px 25px; padding: 7px; background: #fafafa; }
.wall-submit.wall-submit-reply textarea { height: 28px; margin: 0; }
.wall-submit.wall-submit-reply button { display: none; }
.wall-submit.wall-submit-reply.active textarea { height: 80px; margin-bottom: 5px; }
.wall-submit.wall-submit-reply.active button { display: block; }
.wall-submit p { margin-bottom: 5px; }
.wall-form { margin-bottom: 0; padding: 15px; background: #fafafa; }
.wall-form .form-field { margin-bottom: 0; }
.wall-form textarea { height: 30px; min-height: 30px; max-height: 30px; resize: none; }
.wall-form-footer { display: none; }
/* Open */
.wall-form.open .form-field { margin-bottom: 15px; }
.wall-form.open textarea { height: 90px; max-height: 300px; resize: vertical; }
.wall-form.open .wall-form-footer { display: block; }
/**
* Сообщения
*/
.comments.wall,
.wall .comment { margin-bottom: 2px; }
.wall .comment .comment-info { padding-bottom: 0; }
.wall .comment .comment-content { margin-bottom: 3px; }
.comment.wall-post { padding-left: 70px; }
.comment.wall-comment { padding-left: 50px; }
.comment.wall-comment .comment-content { margin-bottom: 3px; }
.comment.wall-comment .comment-avatar { width: 30px; height: 30px; }
/**
* Комментарии
*/
.comment.wall-comment-reply { min-height: 0; padding-left: 48px; }
.comment.wall-comment-reply .comment-avatar { width: 30px; height: 30px; }
.wall-comments { padding-left: 70px; }
/**
* Кнопка подгрузки комментариев
*/
.get-more.get-more-wall-comments { border: none; margin: 0 0 0 25px; }
.get-more.get-more-wall-comments { border: none; margin: 0; }

View file

@ -242,6 +242,12 @@ jQuery(document).ready(function($){
//ls.media.init();
/**
* Стена
*/
ls.wall.init();
// Временный костыль для сабмита форм
// TODO: Перенести в плагин button
$('button[data-button-submit-form]').on('click', function () {

View file

@ -58,7 +58,8 @@
SESSION_ID = '{$_sPhpSessionId}',
SESSION_NAME = '{$_sPhpSessionName}',
LANGUAGE = '{$oConfig->GetValue('lang.current')}',
WYSIWYG = {if $oConfig->GetValue('view.wysiwyg')}true{else}false{/if};
WYSIWYG = {if $oConfig->GetValue('view.wysiwyg')}true{else}false{/if},
USER_PROFILE_LOGIN = {if $oUserProfile}'{$oUserProfile->getLogin()}'{else}''{/if};
var aRouter = [];
{foreach $aRouter as $sPage => $sPath}