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
- 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 #5621: Optimize footer views
- Fix #5616: Don't display oEmbed confirmation in text field

View File

@ -37,7 +37,7 @@ class PoweredBy extends Widget
public function run()
{
if (isset(Yii::$app->params['hidePoweredBy'])) {
if (static::isHidden()) {
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
*/
use humhub\modules\ui\menu\MenuLink;
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 */
?>
<?php if ($numItems > 0): ?>
<div class="text-center footer-nav">
<?php if (!empty($entries)): ?>
<div class="text-center footer-nav footer-nav-default">
<small>
<?php foreach ($items as $item): ?>
<?= Html::a($item['label'], $item['url']); ?>&nbsp;&middot;&nbsp;
<?php foreach ($entries as $k => $entry): ?>
<?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; ?>
<?= PoweredBy::widget(); ?>
</small>
</div>

View File

@ -5,23 +5,27 @@
* @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>
<?php foreach ($items as $item): ?>
<?php if ($item['label'] == '---'): ?>
<li class="divider visible-sm visible-xs"></li>
<?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>
<?php foreach ($entries as $k => $entry): ?>
<?php if ($entry instanceof MenuLink): ?>
<li class="visible-sm visible-xs footer-nav-entry">
<?= Html::a($entry->getIcon() . ' ' . $entry->getLabel(), $entry->getUrl(), $entry->getHtmlOptions()); ?>
</li>
<?php endif; ?>
<?php endforeach; ?>

View File

@ -5,21 +5,30 @@
* @license https://www.humhub.com/licences
*/
use humhub\modules\ui\menu\MenuLink;
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;
?>
<center>
<div class="text text-center powered">
<?php if ($numItems > 0): ?>
<?php foreach ($items as $item): ?>
<?= Html::a($item['label'], $item['url'], ['style' => 'text-decoration: none; color: '.$this->theme->variable('text-color-soft2', '#aeaeae').';']); ?>
<div class="text text-center powered footer-nav-email">
<?php if (!empty($entries)): ?>
<?php foreach ($entries as $k => $entry): ?>
<?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): ?>
&nbsp;&middot;&nbsp;
<?php if (array_key_last($entries) !== $k): ?>
&nbsp;&middot;&nbsp;
<?php endif; ?>
<?php endif; ?>
<?php endforeach; ?>
<br/>
<br/>

View File

@ -7,21 +7,29 @@
use yii\helpers\Html;
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">
<?php if ($numItems > 0): ?>
<?php foreach ($items as $item): ?>
<?= Html::a($item['label'], $item['url'], ['data-pjax-prevent' => true]); ?>
<?php if (!empty($entries)): ?>
<div class="footer-nav footer-nav-login">
<?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): ?>
&nbsp;&middot;&nbsp;
<?php endif; ?>
<?php endforeach; ?>
<br/><br/>
<?php if (array_key_last($entries) !== $k): ?>
&nbsp;&middot;&nbsp;
<?php endif; ?>
<?php endforeach; ?>
</div>
<?php endif; ?>
<br/>
<?= PoweredBy::widget(); ?>
</div>

View File

@ -5,26 +5,33 @@
* @license https://www.humhub.com/licences
*/
use yii\helpers\Html;
use humhub\modules\ui\menu\MenuLink;
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): ?>
<div class="footer-nav">
<?php if (!empty($entries)): ?>
<div class="footer-nav footer-nav-sidebar">
<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): ?>
<?= Html::a($item['label'], $item['url']); ?>
<?php if (++$i !== $numItems): ?>
<?php if (!PoweredBy::isHidden() || array_key_last($entries) !== $k): ?>
&nbsp;&middot;&nbsp;
<?php endif; ?>
<?php endforeach; ?>
&middot; <?= PoweredBy::widget(); ?>
<?= PoweredBy::widget(); ?>
</small>
</div>
<br />
<br/>
<?php endif; ?>