MOBILE-3807 usermenu: Hide usermenu button when the path is not main
parent
03b7660d68
commit
ed19df5c8e
|
@ -1,9 +1,3 @@
|
||||||
<core-user-avatar
|
<core-user-avatar *ngIf="isMainScreen && siteInfo" [user]="siteInfo" class="core-bar-button-image clickable" [linkProfile]="false"
|
||||||
*ngIf="siteInfo"
|
(ariaButtonClick)="openUserMenu($event)" role="button" tabindex="0" [attr.aria-label]="'core.user.account' | translate">
|
||||||
[user]="siteInfo"
|
</core-user-avatar>
|
||||||
class="core-bar-button-image clickable"
|
|
||||||
[linkProfile]="false"
|
|
||||||
(ariaButtonClick)="openUserMenu($event)"
|
|
||||||
role="button"
|
|
||||||
tabindex="0"
|
|
||||||
></core-user-avatar>
|
|
||||||
|
|
|
@ -12,8 +12,9 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import { Component } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { CoreSiteInfo } from '@classes/site';
|
import { CoreSiteInfo } from '@classes/site';
|
||||||
|
import { IonRouterOutlet } from '@ionic/angular';
|
||||||
import { CoreSites } from '@services/sites';
|
import { CoreSites } from '@services/sites';
|
||||||
import { CoreDomUtils } from '@services/utils/dom';
|
import { CoreDomUtils } from '@services/utils/dom';
|
||||||
import { CoreMainMenuUserMenuComponent } from '../user-menu/user-menu';
|
import { CoreMainMenuUserMenuComponent } from '../user-menu/user-menu';
|
||||||
|
@ -27,17 +28,24 @@ import { CoreMainMenuUserMenuComponent } from '../user-menu/user-menu';
|
||||||
selector: 'core-user-menu-button',
|
selector: 'core-user-menu-button',
|
||||||
templateUrl: 'user-menu-button.html',
|
templateUrl: 'user-menu-button.html',
|
||||||
})
|
})
|
||||||
export class CoreMainMenuUserButtonComponent {
|
export class CoreMainMenuUserButtonComponent implements OnInit {
|
||||||
|
|
||||||
siteInfo?: CoreSiteInfo;
|
siteInfo?: CoreSiteInfo;
|
||||||
|
isMainScreen = false;
|
||||||
|
|
||||||
constructor() {
|
constructor(protected routerOutlet: IonRouterOutlet) {
|
||||||
const currentSite = CoreSites.getRequiredCurrentSite();
|
const currentSite = CoreSites.getRequiredCurrentSite();
|
||||||
|
|
||||||
// @TODO: Check if the page where I currently am is at level 0.
|
|
||||||
this.siteInfo = currentSite.getInfo();
|
this.siteInfo = currentSite.getInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.isMainScreen = !this.routerOutlet.canGoBack();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open User menu
|
* Open User menu
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue