Merge pull request #1568 from abpframework/fix/theme-basic/current-user-modal

Fix/theme basic/current user modal
pull/1573/head
Yasin Aydın 6 years ago committed by GitHub
commit 33550ada98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4,3 +4,8 @@ export class LayoutAddNavigationElement {
static readonly type = '[Layout] Add Navigation Element';
constructor(public payload: Layout.NavigationElement | Layout.NavigationElement[]) {}
}
export class LayoutRemoveNavigationElementByName {
static readonly type = '[Layout] Remove Navigation ElementByName';
constructor(public name: string) {}
}

@ -89,10 +89,6 @@
</ul>
</abp-layout>
<abp-change-password [(visible)]="isOpenChangePassword"></abp-change-password>
<abp-profile [(visible)]="isOpenProfile"></abp-profile>
<ng-template #language>
<li class="nav-item dropdown" ngbDropdown>
<a ngbDropdownToggle class="nav-link dropdown-toggle" data-toggle="dropdown">
@ -120,4 +116,8 @@
<a class="dropdown-item pointer" (click)="logout()">Logout</a>
</div>
</li>
<abp-change-password [(visible)]="isOpenChangePassword"></abp-change-password>
<abp-profile [(visible)]="isOpenProfile"></abp-profile>
</ng-template>

@ -1,5 +1,5 @@
import { State, Action, StateContext, Selector } from '@ngxs/store';
import { LayoutAddNavigationElement } from '../actions/layout.actions';
import { LayoutAddNavigationElement, LayoutRemoveNavigationElementByName } from '../actions/layout.actions';
import { Layout } from '../models/layout';
import { TemplateRef } from '@angular/core';
import snq from 'snq';
@ -15,7 +15,7 @@ export class LayoutState {
}
@Action(LayoutAddNavigationElement)
layoutAction({ getState, patchState }: StateContext<Layout.State>, { payload = [] }: LayoutAddNavigationElement) {
layoutAddAction({ getState, patchState }: StateContext<Layout.State>, { payload = [] }: LayoutAddNavigationElement) {
let { navigationElements } = getState();
if (!Array.isArray(payload)) {
@ -42,4 +42,22 @@ export class LayoutState {
navigationElements,
});
}
@Action(LayoutRemoveNavigationElementByName)
layoutRemoveAction(
{ getState, patchState }: StateContext<Layout.State>,
{ name }: LayoutRemoveNavigationElementByName,
) {
let { navigationElements } = getState();
const index = navigationElements.findIndex(element => element.name === name);
if (index > -1) {
navigationElements = navigationElements.splice(index, 1);
}
return patchState({
navigationElements,
});
}
}

Loading…
Cancel
Save