chg: [layout:user_profile] Improved UI
parent
2c840c7d4f
commit
71164e5135
|
@ -18,22 +18,22 @@ class SocialProviderHelper extends Helper
|
||||||
return !empty($identity['social_profile']);
|
return !empty($identity['social_profile']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getIcon($identity)
|
public function getIcon($identity, array $classes=[])
|
||||||
{
|
{
|
||||||
if (!empty($identity['social_profile'])) {
|
if (!empty($identity['social_profile'])) {
|
||||||
$provider = $identity['social_profile']['provider'];
|
$provider = $identity['social_profile']['provider'];
|
||||||
if (!empty($this->providerImageMapping[$provider])) {
|
if (!empty($this->providerImageMapping[$provider])) {
|
||||||
return $this->genImage($this->providerImageMapping[$provider], h($provider));
|
return $this->genImage($this->providerImageMapping[$provider], h($provider), $classes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
private function genImage($url, $alt)
|
private function genImage($url, $alt, array $classes=[])
|
||||||
{
|
{
|
||||||
return $this->Bootstrap->node('img', [
|
return $this->Bootstrap->node('img', [
|
||||||
'src' => $url,
|
'src' => $url,
|
||||||
'class' => ['img-fluid'],
|
'class' => array_merge(['img-fluid'], $classes),
|
||||||
'width' => '16',
|
'width' => '16',
|
||||||
'height' => '16',
|
'height' => '16',
|
||||||
'alt' => $alt,
|
'alt' => $alt,
|
||||||
|
|
|
@ -20,14 +20,14 @@ use Cake\Routing\Router;
|
||||||
</h6>
|
</h6>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item" href="<?= Router::url(['controller' => 'users', 'action' => 'view', 'plugin' => null, h($this->request->getAttribute('identity')['id'])]) ?>">
|
<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') ?>
|
<?= __('My Account') ?>
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
class="dropdown-item"
|
class="dropdown-item"
|
||||||
href="<?= Router::url(['controller' => 'users', 'action' => 'settings', 'plugin' => null, h($this->request->getAttribute('identity')['id'])]) ?>"
|
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') ?>
|
<?= __('Account Settings') ?>
|
||||||
</a>
|
</a>
|
||||||
<?php
|
<?php
|
||||||
|
@ -49,16 +49,16 @@ use Cake\Routing\Router;
|
||||||
); ?>"
|
); ?>"
|
||||||
>
|
>
|
||||||
<?php if (!empty($this->SocialProvider->getIcon($this->request->getAttribute('identity')))): ?>
|
<?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: ?>
|
<?php else: ?>
|
||||||
<i class="me-1 <?= $this->FontAwesome->getClass('key') ?>"></i>
|
<i class="me-1 fa-fw <?= $this->FontAwesome->getClass('key') ?>"></i>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?= __('SSO Account') ?>
|
<?= __('SSO Account') ?>
|
||||||
</a>
|
</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item dropdown-item-outline-danger" href="<?= Router::url(['controller' => 'users', 'action' => 'logout', 'plugin' => null]) ?>">
|
<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') ?>
|
<?= __('Logout') ?>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -203,7 +203,8 @@ main.content {
|
||||||
margin: auto 0;
|
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;
|
min-width: 25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue