mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-26 03:30:48 +03:00
Доработка компонента more
This commit is contained in:
parent
1666bd6048
commit
9440a51c8a
|
@ -119,7 +119,7 @@ class ActionBlogs extends Action {
|
|||
/**
|
||||
* Для подгрузки
|
||||
*/
|
||||
$this->Viewer_AssignAjax('iCountLoaded',count($aResult['collection']));
|
||||
$this->Viewer_AssignAjax('count_loaded',count($aResult['collection']));
|
||||
$this->Viewer_AssignAjax('pageNext',count($aResult['collection'])>0 ? $iPage+1 : $iPage);
|
||||
$this->Viewer_AssignAjax('bHideMore',$bHideMore);
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ class ActionPeople extends Action {
|
|||
/**
|
||||
* Для подгрузки
|
||||
*/
|
||||
$this->Viewer_AssignAjax('iCountLoaded',count($aResult['collection']));
|
||||
$this->Viewer_AssignAjax('count_loaded',count($aResult['collection']));
|
||||
$this->Viewer_AssignAjax('pageNext',count($aResult['collection'])>0 ? $iPage+1 : $iPage);
|
||||
$this->Viewer_AssignAjax('bHideMore',$bHideMore);
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ class ActionStream extends Action {
|
|||
/**
|
||||
* Необходимо передать последний просмотренный ID событий
|
||||
*/
|
||||
$iFromId = getRequestStr('iLastId');
|
||||
$iFromId = getRequestStr('last_id');
|
||||
if (!$iFromId) {
|
||||
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
|
||||
return;
|
||||
|
@ -174,16 +174,16 @@ class ActionStream extends Action {
|
|||
$oViewer=$this->Viewer_GetLocalViewer();
|
||||
$oViewer->Assign('aStreamEvents', $aEvents);
|
||||
$oViewer->Assign('sDateLast', getRequestStr('sDateLast'));
|
||||
$this->Viewer_AssignAjax('iCountLoaded', count($aEvents));
|
||||
$this->Viewer_AssignAjax('count_loaded', count($aEvents));
|
||||
|
||||
if (count($aEvents)) {
|
||||
$oEvenLast=end($aEvents);
|
||||
$this->Viewer_AssignAjax('iLastId', $oEvenLast->getId());
|
||||
$this->Viewer_AssignAjax('last_id', $oEvenLast->getId());
|
||||
}
|
||||
/**
|
||||
* Возвращаем данные в ajax ответе
|
||||
*/
|
||||
$this->Viewer_AssignAjax('sHtml', $oViewer->Fetch('actions/ActionStream/events.tpl'));
|
||||
$this->Viewer_AssignAjax('html', $oViewer->Fetch('actions/ActionStream/events.tpl'));
|
||||
}
|
||||
/**
|
||||
* Погрузка событий для всего сайта
|
||||
|
@ -197,7 +197,7 @@ class ActionStream extends Action {
|
|||
/**
|
||||
* Необходимо передать последний просмотренный ID событий
|
||||
*/
|
||||
$iFromId = getRequestStr('iLastId');
|
||||
$iFromId = getRequestStr('last_id');
|
||||
if (!$iFromId) {
|
||||
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
|
||||
return;
|
||||
|
@ -210,16 +210,16 @@ class ActionStream extends Action {
|
|||
$oViewer=$this->Viewer_GetLocalViewer();
|
||||
$oViewer->Assign('aStreamEvents', $aEvents);
|
||||
$oViewer->Assign('sDateLast', getRequestStr('sDateLast'));
|
||||
$this->Viewer_AssignAjax('iCountLoaded', count($aEvents));
|
||||
$this->Viewer_AssignAjax('count_loaded', count($aEvents));
|
||||
|
||||
if (count($aEvents)) {
|
||||
$oEvenLast=end($aEvents);
|
||||
$this->Viewer_AssignAjax('iLastId', $oEvenLast->getId());
|
||||
$this->Viewer_AssignAjax('last_id', $oEvenLast->getId());
|
||||
}
|
||||
/**
|
||||
* Возвращаем данные в ajax ответе
|
||||
*/
|
||||
$this->Viewer_AssignAjax('sHtml', $oViewer->Fetch('actions/ActionStream/events.tpl'));
|
||||
$this->Viewer_AssignAjax('html', $oViewer->Fetch('actions/ActionStream/events.tpl'));
|
||||
}
|
||||
/**
|
||||
* Подгрузка событий для пользователя
|
||||
|
@ -233,7 +233,7 @@ class ActionStream extends Action {
|
|||
/**
|
||||
* Необходимо передать последний просмотренный ID событий
|
||||
*/
|
||||
$iFromId = getRequestStr('iLastId');
|
||||
$iFromId = getRequestStr('last_id');
|
||||
if (!$iFromId) {
|
||||
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
|
||||
return;
|
||||
|
@ -250,16 +250,16 @@ class ActionStream extends Action {
|
|||
$oViewer=$this->Viewer_GetLocalViewer();
|
||||
$oViewer->Assign('aStreamEvents', $aEvents);
|
||||
$oViewer->Assign('sDateLast', getRequestStr('sDateLast'));
|
||||
$this->Viewer_AssignAjax('iCountLoaded', count($aEvents));
|
||||
$this->Viewer_AssignAjax('count_loaded', count($aEvents));
|
||||
|
||||
if (count($aEvents)) {
|
||||
$oEvenLast=end($aEvents);
|
||||
$this->Viewer_AssignAjax('iLastId', $oEvenLast->getId());
|
||||
$this->Viewer_AssignAjax('last_id', $oEvenLast->getId());
|
||||
}
|
||||
/**
|
||||
* Возвращаем данные в ajax ответе
|
||||
*/
|
||||
$this->Viewer_AssignAjax('sHtml', $oViewer->Fetch('actions/ActionStream/events.tpl'));
|
||||
$this->Viewer_AssignAjax('html', $oViewer->Fetch('actions/ActionStream/events.tpl'));
|
||||
}
|
||||
/**
|
||||
* Подписка на пользователя по ID
|
||||
|
|
|
@ -92,7 +92,7 @@ class ActionUserfeed extends Action {
|
|||
/**
|
||||
* Проверяем последний просмотренный ID топика
|
||||
*/
|
||||
$iFromId = getRequestStr('iLastId');
|
||||
$iFromId = getRequestStr('last_id');
|
||||
if (!$iFromId) {
|
||||
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
|
||||
return;
|
||||
|
@ -110,11 +110,11 @@ class ActionUserfeed extends Action {
|
|||
*/
|
||||
$oViewer=$this->Viewer_GetLocalViewer();
|
||||
$oViewer->Assign('aTopics', $aTopics);
|
||||
$this->Viewer_AssignAjax('sHtml', $oViewer->Fetch('topics/topic_list.tpl'));
|
||||
$this->Viewer_AssignAjax('iCountLoaded', count($aTopics));
|
||||
$this->Viewer_AssignAjax('html', $oViewer->Fetch('topics/topic_list.tpl'));
|
||||
$this->Viewer_AssignAjax('count_loaded', count($aTopics));
|
||||
|
||||
if (count($aTopics)) {
|
||||
$this->Viewer_AssignAjax('iLastId', end($aTopics)->getId());
|
||||
$this->Viewer_AssignAjax('last_id', end($aTopics)->getId());
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
// Ссылка
|
||||
url: null,
|
||||
// Название переменной с результатом
|
||||
result: 'sHtml',
|
||||
result: 'html',
|
||||
// Параметры запроса
|
||||
params: {},
|
||||
// Проксирующие параметры
|
||||
|
@ -69,6 +69,20 @@
|
|||
this.element.removeClass(ls.options.classes.states.loading);
|
||||
},
|
||||
|
||||
/**
|
||||
* Получает значение счетчика
|
||||
*/
|
||||
getCount: function () {
|
||||
return this.counter.length && parseInt( this.counter.text(), 10 );
|
||||
},
|
||||
|
||||
/**
|
||||
* Устанавливает значение счетчика
|
||||
*/
|
||||
setCount: function ( number ) {
|
||||
this.counter.length && this.counter.text( number );
|
||||
},
|
||||
|
||||
/**
|
||||
* Подгрузка
|
||||
*/
|
||||
|
@ -81,7 +95,7 @@
|
|||
var params=$.extend({}, this.options.params, this.options.proxy);
|
||||
|
||||
ls.ajax.load(this.options.url, params, function (oResponse) {
|
||||
if (oResponse.iCountLoaded > 0) {
|
||||
if (oResponse.count_loaded > 0) {
|
||||
var html = $('<div></div>').html( $.trim( oResponse[this.options.result] ) );
|
||||
|
||||
if ( html.find( this.options.target ).length ) {
|
||||
|
@ -89,16 +103,16 @@
|
|||
}
|
||||
|
||||
this.target[ this.options.append ? 'append' : 'prepend' ]( html.html() );
|
||||
this.element.data( 'param-i-last-id', oResponse.iLastId );
|
||||
this.element.attr( 'data-param-last_id', oResponse.last_id );
|
||||
|
||||
// Обновляем счетчик
|
||||
if (this.counter.length) {
|
||||
var iCountLeft = parseInt( this.counter.text(), 10 ) - oResponse.iCountLoaded;
|
||||
var iCountLeft = this.getCount() - oResponse.count_loaded;
|
||||
|
||||
if (iCountLeft <= 0) {
|
||||
this.element.remove();
|
||||
} else {
|
||||
this.counter.text(iCountLeft);
|
||||
this.setCount( iCountLeft );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
{if ! $bDisableGetMoreButton}
|
||||
{include 'components/more/more.tpl'
|
||||
sClasses = "js-more-activity-$sActivityType"
|
||||
sAttributes = " data-proxy-i-last-id=\"{$iStreamLastId}\" data-param-i-target-id=\"{$iLoadTargetId}\" "
|
||||
sAttributes = " data-proxy-last_id=\"{$iStreamLastId}\" data-param-i-target-id=\"{$iLoadTargetId}\" "
|
||||
}
|
||||
{/if}
|
||||
{else}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
</div>
|
||||
|
||||
{if ! $bDisableGetMoreButton}
|
||||
{include 'components/more/more.tpl' sClasses="js-more-userfeed" sAttributes="data-proxy-i-last-id=\"{$iUserfeedLastId}\""}
|
||||
{include 'components/more/more.tpl' sClasses="js-more-userfeed" sAttributes="data-proxy-last_id=\"{$iUserfeedLastId}\""}
|
||||
{/if}
|
||||
{else}
|
||||
{include 'components/alert/alert.tpl' mAlerts=$aLang.common.empty sMods='empty'}
|
||||
|
|
Loading…
Reference in a new issue