mirror of
https://github.com/humhub/humhub.git
synced 2025-01-16 21:58:17 +01:00
Removed deprecated show more pager widget (#7231)
* Removed depricated ShowMorePager widget * Removed deprecated ShowMorePager widget * Update MIGRATE-DEV.md --------- Co-authored-by: Lucas Bartholemy <luke-@users.noreply.github.com>
This commit is contained in:
parent
3f8c26323a
commit
f3800ac9d1
@ -35,6 +35,7 @@ HumHub Changelog
|
||||
- Enh #7214: Replace theme variables with CSS variables
|
||||
- Enh #7221: Increase language column size for new language codes
|
||||
- Enh #7224: Added `user\Module::$invitesTimeToLiveInDays` to automatically clean up User Invites after a specified number of days
|
||||
- Enh #7231: Removed deprecated `ShowMorePager` widget
|
||||
|
||||
1.16.3 (Unreleased)
|
||||
--------------------------
|
||||
|
@ -14,6 +14,7 @@ Version 1.17 (Unreleased)
|
||||
#### Removed
|
||||
|
||||
- Removed obsolete property `humhub\modules\content\widgets\richtext\AbstractRichText::$record`
|
||||
- Removed `\humhub\widgets\ShowMorePager` widget
|
||||
|
||||
|
||||
Version 1.17 (Unreleased)
|
||||
|
@ -1,108 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @link https://www.humhub.org/
|
||||
* @copyright Copyright (c) 2016 HumHub GmbH & Co. KG
|
||||
* @license https://www.humhub.com/licences
|
||||
*/
|
||||
|
||||
namespace humhub\widgets;
|
||||
|
||||
use Yii;
|
||||
use yii\helpers\Html;
|
||||
use yii\web\JsExpression;
|
||||
|
||||
/**
|
||||
* ShowMore ajax pager
|
||||
*
|
||||
* @inheritdoc
|
||||
* @since 1.1.1
|
||||
* @author luke
|
||||
*
|
||||
* @todo should be deleted
|
||||
*/
|
||||
class ShowMorePager extends \humhub\widgets\LinkPager
|
||||
{
|
||||
/**
|
||||
* @var Pagination the pagination object that this pager is associated with.
|
||||
* You must set this property in order to make LinkPager work.
|
||||
*/
|
||||
public $pagination;
|
||||
|
||||
/**
|
||||
* AjaxButton widget options
|
||||
*
|
||||
* @see AjaxButton
|
||||
* @var array
|
||||
*/
|
||||
public $ajaxButtonOptions = [];
|
||||
|
||||
/**
|
||||
* @var string element id
|
||||
*/
|
||||
public $id = 'btnShowMore';
|
||||
|
||||
/**
|
||||
* Initializes the pager.
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
if ($this->pagination === null) {
|
||||
throw new InvalidConfigException('The "pagination" property must be set.');
|
||||
}
|
||||
|
||||
if (!isset($this->ajaxButtonOptions['htmlOptions']['id'])) {
|
||||
$this->ajaxButtonOptions['htmlOptions']['id'] = $this->id . '_btn';
|
||||
}
|
||||
|
||||
if (!isset($this->ajaxButtonOptions['ajaxOptions']['type'])) {
|
||||
$this->ajaxButtonOptions['ajaxOptions']['type'] = 'POST';
|
||||
}
|
||||
|
||||
if (!isset($this->ajaxButtonOptions['ajaxOptions']['beforeSend'])) {
|
||||
$this->ajaxButtonOptions['ajaxOptions']['beforeSend'] = new JsExpression('function(){ $("#' . $this->ajaxButtonOptions['htmlOptions']['id'] . '").remove(); $("#' . $this->id . '_loader").removeClass("hidden"); }');
|
||||
}
|
||||
|
||||
if (!isset($this->ajaxButtonOptions['ajaxOptions']['success'])) {
|
||||
$this->ajaxButtonOptions['ajaxOptions']['success'] = new JsExpression('function(html){ $("#globalModal").html(html); }');
|
||||
}
|
||||
|
||||
if (!isset($this->ajaxButtonOptions['label'])) {
|
||||
$this->ajaxButtonOptions['label'] = Yii::t('base', 'Show more');
|
||||
}
|
||||
|
||||
if (!isset($this->ajaxButtonOptions['htmlOptions']['class'])) {
|
||||
$this->ajaxButtonOptions['htmlOptions']['class'] = 'btn btn-default';
|
||||
$this->ajaxButtonOptions['htmlOptions']['data-ui-loader'] = '1';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
echo $this->renderMoreButton();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function renderMoreButton()
|
||||
{
|
||||
$pageCount = $this->pagination->getPageCount();
|
||||
$currentPage = $this->pagination->getPage() + 1;
|
||||
|
||||
if ($currentPage >= $pageCount) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (!isset($this->ajaxButtonOptions['ajaxOptions']['url'])) {
|
||||
$this->ajaxButtonOptions['ajaxOptions']['url'] = $this->pagination->createUrl($currentPage);
|
||||
}
|
||||
|
||||
$moreButton = AjaxButton::widget($this->ajaxButtonOptions);
|
||||
return Html::tag('div', Html::tag('br') . $moreButton . LoaderWidget::widget(['id' => $this->id . '_loader', 'cssClass' => 'hidden']), ['id' => $this->id, 'class' => 'pagination-container']);
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user