Footer View Optimization (#5621)

* Optimized Footer Views

* Update CHANGELOG_DEV.md
This commit is contained in:
Lucas Bartholemy 2022-03-30 18:56:42 +02:00 committed by GitHub
parent 9f7574c883
commit f5b4301383
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 93 additions and 46 deletions

View File

@ -5,6 +5,7 @@
- Fix #5612: Fix RichText post process event pass data - Fix #5612: Fix RichText post process event pass data
- Enh #5610: Show menu item "Add Licence Key" for purchased modules - Enh #5610: Show menu item "Add Licence Key" for purchased modules
- Enh #5599: Introduce a variables in the Space model to call ProfileImage and ProfileBannerImage classes - Enh #5599: Introduce a variables in the Space model to call ProfileImage and ProfileBannerImage classes
- Enh #5621: Optimize footer views
- Fix #5616: Don't display oEmbed confirmation in text field - Fix #5616: Don't display oEmbed confirmation in text field

View File

@ -37,7 +37,7 @@ class PoweredBy extends Widget
public function run() public function run()
{ {
if (isset(Yii::$app->params['hidePoweredBy'])) { if (static::isHidden()) {
return ''; return '';
} }
@ -54,4 +54,9 @@ class PoweredBy extends Widget
]); ]);
} }
public static function isHidden()
{
return isset(Yii::$app->params['hidePoweredBy']);
}
} }

View File

@ -5,17 +5,30 @@
* @license https://www.humhub.com/licences * @license https://www.humhub.com/licences
*/ */
use humhub\modules\ui\menu\MenuLink;
use humhub\widgets\PoweredBy; use humhub\widgets\PoweredBy;
use yii\helpers\Html; use yii\helpers\Html;
/* @var $this \humhub\modules\ui\view\components\View */
/* @var $entries MenuLink[] */
/* @var $options array */
/* @var $menu \humhub\widgets\FooterMenu */
?> ?>
<?php if ($numItems > 0): ?> <?php if (!empty($entries)): ?>
<div class="text-center footer-nav"> <div class="text-center footer-nav footer-nav-default">
<small> <small>
<?php foreach ($items as $item): ?> <?php foreach ($entries as $k => $entry): ?>
<?= Html::a($item['label'], $item['url']); ?>&nbsp;&middot;&nbsp; <?php if ($entry instanceof MenuLink): ?>
<?= Html::a($entry->getLabel(), $entry->getUrl(), $entry->getHtmlOptions()); ?>
<?php if (!PoweredBy::isHidden() || array_key_last($entries) !== $k): ?>
&nbsp;&middot;&nbsp;
<?php endif; ?>
<?php endif; ?>
<?php endforeach; ?> <?php endforeach; ?>
<?= PoweredBy::widget(); ?> <?= PoweredBy::widget(); ?>
</small> </small>
</div> </div>

View File

@ -5,23 +5,27 @@
* @license https://www.humhub.com/licences * @license https://www.humhub.com/licences
*/ */
$i = 0; use humhub\libs\Html;
use humhub\modules\ui\menu\MenuLink;
/* @var $this \humhub\modules\ui\view\components\View */
/* @var $entries MenuLink[] */
/* @var $options array */
/* @var $menu \humhub\widgets\FooterMenu */
/**
* NOTE: This template is used only in mobile view ports!
*/
?> ?>
<?php if ($numItems > 0): ?> <?php if (!empty($entries)): ?>
<li class="divider visible-sm visible-xs"></li> <li class="divider visible-sm visible-xs"></li>
<?php foreach ($entries as $k => $entry): ?>
<?php foreach ($items as $item): ?> <?php if ($entry instanceof MenuLink): ?>
<?php if ($item['label'] == '---'): ?> <li class="visible-sm visible-xs footer-nav-entry">
<li class="divider visible-sm visible-xs"></li> <?= Html::a($entry->getIcon() . ' ' . $entry->getLabel(), $entry->getUrl(), $entry->getHtmlOptions()); ?>
<?php else: ?>
<li class="visible-sm visible-xs">
<a <?= isset($item['id']) ? 'id="' . $item['id'] . '"' : '' ?>
href="<?= $item['url']; ?>" <?= isset($item['pjax']) && $item['pjax'] === false ? 'data-pjax-prevent' : '' ?>>
<small>
<?= $item['icon'] . ' ' . $item['label']; ?>
</small>
</a>
</li> </li>
<?php endif; ?> <?php endif; ?>
<?php endforeach; ?> <?php endforeach; ?>

View File

@ -5,21 +5,30 @@
* @license https://www.humhub.com/licences * @license https://www.humhub.com/licences
*/ */
use humhub\modules\ui\menu\MenuLink;
use yii\helpers\Html; use yii\helpers\Html;
/* @var $this \humhub\modules\ui\view\components\View */
/* @var $entries MenuLink[] */
/* @var $options array */
/* @var $menu \humhub\widgets\FooterMenu */
$i = 0; $i = 0;
?> ?>
<center> <center>
<div class="text text-center powered"> <div class="text text-center powered footer-nav-email">
<?php if ($numItems > 0): ?> <?php if (!empty($entries)): ?>
<?php foreach ($items as $item): ?> <?php foreach ($entries as $k => $entry): ?>
<?= Html::a($item['label'], $item['url'], ['style' => 'text-decoration: none; color: '.$this->theme->variable('text-color-soft2', '#aeaeae').';']); ?> <?php if ($entry instanceof MenuLink): ?>
<?= Html::a($entry->getLabel(), $entry->getUrl(), $entry->getHtmlOptions([
'style' => 'text-decoration: none; color: ' . $this->theme->variable('text-color-soft2', '#aeaeae')
])); ?>
<?php if (++$i !== $numItems): ?> <?php if (array_key_last($entries) !== $k): ?>
&nbsp;&middot;&nbsp; &nbsp;&middot;&nbsp;
<?php endif; ?>
<?php endif; ?> <?php endif; ?>
<?php endforeach; ?> <?php endforeach; ?>
<br/> <br/>
<br/> <br/>

View File

@ -7,21 +7,29 @@
use yii\helpers\Html; use yii\helpers\Html;
use humhub\widgets\PoweredBy; use humhub\widgets\PoweredBy;
use humhub\modules\ui\menu\MenuLink;
/* @var $this \humhub\modules\ui\view\components\View */
/* @var $entries MenuLink[] */
/* @var $options array */
/* @var $menu \humhub\widgets\FooterMenu */
$i = 0;
?> ?>
<div class="text text-center powered"> <div class="text text-center powered">
<?php if ($numItems > 0): ?> <?php if (!empty($entries)): ?>
<?php foreach ($items as $item): ?> <div class="footer-nav footer-nav-login">
<?= Html::a($item['label'], $item['url'], ['data-pjax-prevent' => true]); ?> <?php foreach ($entries as $k => $entry): ?>
<?php if ($entry instanceof MenuLink): ?>
<?= Html::a($entry->getLabel(), $entry->getUrl(), $entry->getHtmlOptions(['data-pjax-prevent' => true])); ?>
<?php endif; ?>
<?php if (++$i !== $numItems): ?> <?php if (array_key_last($entries) !== $k): ?>
&nbsp;&middot;&nbsp; &nbsp;&middot;&nbsp;
<?php endif; ?> <?php endif; ?>
<?php endforeach; ?>
<?php endforeach; ?> </div>
<br/><br/>
<?php endif; ?> <?php endif; ?>
<br/>
<?= PoweredBy::widget(); ?> <?= PoweredBy::widget(); ?>
</div> </div>

View File

@ -5,26 +5,33 @@
* @license https://www.humhub.com/licences * @license https://www.humhub.com/licences
*/ */
use yii\helpers\Html; use humhub\modules\ui\menu\MenuLink;
use humhub\widgets\PoweredBy; use humhub\widgets\PoweredBy;
use yii\helpers\Html;
/* @var $this \humhub\modules\ui\view\components\View */
/* @var $entries MenuLink[] */
/* @var $options array */
/* @var $menu \humhub\widgets\FooterMenu */
$i = 0;
?> ?>
<?php if ($numItems > 0): ?> <?php if (!empty($entries)): ?>
<div class="footer-nav"> <div class="footer-nav footer-nav-sidebar">
<small> <small>
<?php foreach ($entries as $k => $entry): ?>
<?php if ($entry instanceof MenuLink): ?>
<?= Html::a($entry->getLabel(), $entry->getUrl(), $entry->getHtmlOptions()); ?>
<?php endif; ?>
<?php foreach ($items as $item): ?> <?php if (!PoweredBy::isHidden() || array_key_last($entries) !== $k): ?>
<?= Html::a($item['label'], $item['url']); ?>
<?php if (++$i !== $numItems): ?>
&nbsp;&middot;&nbsp; &nbsp;&middot;&nbsp;
<?php endif; ?> <?php endif; ?>
<?php endforeach; ?> <?php endforeach; ?>
&middot; <?= PoweredBy::widget(); ?>
<?= PoweredBy::widget(); ?>
</small> </small>
</div> </div>
<br /> <br/>
<?php endif; ?> <?php endif; ?>