chg: [layout:user_profile] Improved UI

develop-unstable
Sami Mokaddem 2022-11-28 08:37:00 +01:00
parent 2c840c7d4f
commit 71164e5135
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
3 changed files with 11 additions and 10 deletions

View File

@ -18,22 +18,22 @@ class SocialProviderHelper extends Helper
return !empty($identity['social_profile']);
}
public function getIcon($identity)
public function getIcon($identity, array $classes=[])
{
if (!empty($identity['social_profile'])) {
$provider = $identity['social_profile']['provider'];
if (!empty($this->providerImageMapping[$provider])) {
return $this->genImage($this->providerImageMapping[$provider], h($provider));
return $this->genImage($this->providerImageMapping[$provider], h($provider), $classes);
}
}
return '';
}
private function genImage($url, $alt)
private function genImage($url, $alt, array $classes=[])
{
return $this->Bootstrap->node('img', [
'src' => $url,
'class' => ['img-fluid'],
'class' => array_merge(['img-fluid'], $classes),
'width' => '16',
'height' => '16',
'alt' => $alt,

View File

@ -20,14 +20,14 @@ use Cake\Routing\Router;
</h6>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="<?= Router::url(['controller' => 'users', 'action' => 'view', 'plugin' => null, h($this->request->getAttribute('identity')['id'])]) ?>">
<i class="me-1 <?= $this->FontAwesome->getClass('user-circle') ?>"></i>
<i class="me-1 fa-fw <?= $this->FontAwesome->getClass('user-circle') ?>"></i>
<?= __('My Account') ?>
</a>
<a
class="dropdown-item"
href="<?= Router::url(['controller' => 'users', 'action' => 'settings', 'plugin' => null, h($this->request->getAttribute('identity')['id'])]) ?>"
>
<i class="me-1 <?= $this->FontAwesome->getClass('user-cog') ?>"></i>
<i class="me-1 fa-fw <?= $this->FontAwesome->getClass('user-cog') ?>"></i>
<?= __('Account Settings') ?>
</a>
<?php
@ -49,16 +49,16 @@ use Cake\Routing\Router;
); ?>"
>
<?php if (!empty($this->SocialProvider->getIcon($this->request->getAttribute('identity')))): ?>
<?= $this->SocialProvider->getIcon($this->request->getAttribute('identity')) ?>
<?= $this->SocialProvider->getIcon($this->request->getAttribute('identity'), ['me-1']) ?>
<?php else: ?>
<i class="me-1 <?= $this->FontAwesome->getClass('key') ?>"></i>
<i class="me-1 fa-fw <?= $this->FontAwesome->getClass('key') ?>"></i>
<?php endif; ?>
<?= __('SSO Account') ?>
</a>
<?php endif; ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item dropdown-item-outline-danger" href="<?= Router::url(['controller' => 'users', 'action' => 'logout', 'plugin' => null]) ?>">
<i class="me-1 <?= $this->FontAwesome->getClass('sign-out-alt') ?>"></i>
<i class="me-1 fa-fw <?= $this->FontAwesome->getClass('sign-out-alt') ?>"></i>
<?= __('Logout') ?>
</a>
</div>

View File

@ -203,7 +203,8 @@ main.content {
margin: auto 0;
}
.right-navbar .header-menu .dropdown-menu a.dropdown-item > i {
.right-navbar .header-menu .dropdown-menu a.dropdown-item > i,
.right-navbar .header-menu .dropdown-menu a.dropdown-item > img {
min-width: 25px;
}