Fix layout service change header-height variable only in browser. Fix formControlName in helptext forms. Change resources menu item structure.
This commit is contained in:
parent
a42140bb1c
commit
c1e1a3508c
|
@ -1,7 +1,7 @@
|
|||
<div page-content>
|
||||
<div header>
|
||||
<div class="uk-flex uk-flex-middle uk-margin-top uk-margin-bottom info">
|
||||
<a routerLink="../" [queryParams]=" { 'pageId': pageId }" class="uk-button uk-button-link uk-margin-right">
|
||||
<a routerLink="../" [queryParams]=" { 'pageId': pageId }" class="uk-button uk-button-link uk-margin-medium-right">
|
||||
<icon name="west" ratio="2" [flex]="true"></icon>
|
||||
</a>
|
||||
<div>
|
||||
|
@ -57,7 +57,7 @@
|
|||
<ckeditor (change)="contentChanged()"
|
||||
[readonly]="false"
|
||||
debounce="500"
|
||||
formControlName="content"
|
||||
[formControl]="myForm.get('content')"
|
||||
[config]="{ extraAllowedContent: '* [uk-*](*) ; span', disallowedContent: 'script; *[on*]',
|
||||
removeButtons: 'Save,NewPage,DocProps,Preview,Print,' +
|
||||
'Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,' +
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div page-content>
|
||||
<div header>
|
||||
<div class="uk-flex uk-flex-middle uk-margin-top info">
|
||||
<a routerLink="../pages" class="uk-button uk-button-link uk-margin-right">
|
||||
<a routerLink="../pages" class="uk-button uk-button-link uk-margin-medium-right">
|
||||
<icon name="west" ratio="2" [flex]="true"></icon>
|
||||
</a>
|
||||
<div>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div page-content>
|
||||
<div header>
|
||||
<div class="uk-flex uk-flex-middle uk-margin-top uk-margin-bottom info">
|
||||
<a routerLink="../" [queryParams]=" { 'pageId': pageId }" class="uk-button uk-button-link uk-margin-right">
|
||||
<a routerLink="../" [queryParams]=" { 'pageId': pageId }" class="uk-button uk-button-link uk-margin-medium-right">
|
||||
<icon name="west" ratio="2" [flex]="true"></icon>
|
||||
</a>
|
||||
<div>
|
||||
|
@ -61,7 +61,7 @@
|
|||
<ckeditor (change)="contentChanged()"
|
||||
[readonly]="false"
|
||||
debounce="500"
|
||||
formControlName="content"
|
||||
[formControl]="myForm.get('content')"
|
||||
[config]="{ extraAllowedContent: '* [uk-*](*) ; span', disallowedContent: 'script; *[on*]',
|
||||
removeButtons: 'Save,NewPage,DocProps,Preview,Print,' +
|
||||
'Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,' +
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div page-content>
|
||||
<div header>
|
||||
<div class="uk-flex uk-flex-middle uk-margin-top info">
|
||||
<a routerLink="../pages" class="uk-button uk-button-link uk-margin-right">
|
||||
<a routerLink="../pages" class="uk-button uk-button-link uk-margin-medium-right">
|
||||
<icon name="west" ratio="2" [flex]="true"></icon>
|
||||
</a>
|
||||
<div>
|
||||
|
|
|
@ -3,7 +3,6 @@ import {Session, User} from "../../../login/utils/helper.class";
|
|||
import {UserManagementService} from "../../../services/user-management.service";
|
||||
import {Subscriber} from "rxjs";
|
||||
import {ActivatedRoute} from "@angular/router";
|
||||
import { properties } from 'src/environments/environment';
|
||||
|
||||
@Component({
|
||||
selector: 'admin-tabs',
|
||||
|
|
|
@ -66,10 +66,14 @@ export class LayoutService {
|
|||
if (data['hasHeader'] !== undefined &&
|
||||
data['hasHeader'] === false) {
|
||||
this.setHasHeader(false);
|
||||
document.documentElement.style.setProperty('--header-height', '0');
|
||||
if(typeof document !== "undefined") {
|
||||
document.documentElement.style.setProperty('--header-height', '0');
|
||||
}
|
||||
} else {
|
||||
this.setHasHeader(true);
|
||||
document.documentElement.style.setProperty('--header-height', LayoutService.HEADER_HEIGHT);
|
||||
if(typeof document !== "undefined") {
|
||||
document.documentElement.style.setProperty('--header-height', LayoutService.HEADER_HEIGHT);
|
||||
}
|
||||
}
|
||||
if (data['hasAdminMenu'] !== undefined &&
|
||||
data['hasAdminMenu'] === true) {
|
||||
|
|
|
@ -9,7 +9,9 @@ import {ResourcesService} from "../services/resources.service";
|
|||
|
||||
@Component({
|
||||
selector: 'indicators-page',
|
||||
template: `<helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0" [texts]="pageContents['top']"></helper>`
|
||||
template: `
|
||||
<helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0" [texts]="pageContents['top']"></helper>
|
||||
`
|
||||
})
|
||||
export class IndicatorsComponent implements OnInit, OnDestroy {
|
||||
private subscriptions: any[] = [];
|
||||
|
@ -32,8 +34,8 @@ export class IndicatorsComponent implements OnInit, OnDestroy {
|
|||
let type = this.types.find(type => type.value === params['type']);
|
||||
if(type) {
|
||||
this.getPageContents(type.value);
|
||||
const description = "Monitor | Indicators " + type.label;
|
||||
const title = "Monitor | Indicators " + type.label;
|
||||
const description = "Monitor | Indicators for " + type.label;
|
||||
const title = "Monitor | Indicators for " + type.label;
|
||||
this.metaTags(title, description);
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +62,8 @@ export class IndicatorsComponent implements OnInit, OnDestroy {
|
|||
|
||||
public getPageContents(type: string) {
|
||||
this.subscriptions.push(this.resourcesService.isPagesEnabled().subscribe(status => {
|
||||
if(status[0]) {
|
||||
let index = this.types.findIndex(t => t.value === type);
|
||||
if(index !== -1 && status[index]) {
|
||||
this.subscriptions.push(this.helper.getPageHelpContents(this.properties, 'monitor', '/indicators/' + type, 'monitor').subscribe(contents => {
|
||||
this.pageContents = contents;
|
||||
}));
|
||||
|
|
|
@ -27,24 +27,23 @@ export class ResourcesService {
|
|||
}
|
||||
|
||||
private async getResourcesItemsAsync(prefix = '', portal: string = null): Promise<MenuItem[]> {
|
||||
let items = [];
|
||||
let methodology = ResourcesService.setLink(new MenuItem("methodology", "Methodology", "", "", false, [],
|
||||
let items = [
|
||||
new MenuItem("methodology", "Methodology", "", "", false, [],
|
||||
null, {}, null, null, null, null, '_self'),
|
||||
prefix + "/methodology", portal);
|
||||
methodology.items = [ResourcesService.setLink(new MenuItem("methodology", "Terminology and construction",
|
||||
"", "", false, [], null, {}, null, null, null, null, '_self'),
|
||||
prefix + "/methodology", portal),
|
||||
ResourcesService.setLink(new MenuItem("methodology", "Terminology and construction",
|
||||
"", "", false, [], null, {}, null, null, null, null, '_self'),
|
||||
prefix + "/methodology", portal),
|
||||
ResourcesService.setLink(new MenuItem("methodology", "See how it works",
|
||||
"", "", false, [], null, {}, null, "how", null, null, '_self'),
|
||||
prefix + "/methodology", portal)];
|
||||
items.push(methodology);
|
||||
let indicators = new MenuItem("indicators-page", "Indicators",
|
||||
let indicators = new MenuItem("indicators-page", "Indicators",
|
||||
"", "", false, [], null, {}, null, null, null, null, '_self');
|
||||
let indicatorsItems = [];
|
||||
let promise = new Promise(resolve => {
|
||||
this.isPagesEnabled().subscribe(status => {
|
||||
ResourcesService.types.forEach((type, index) => {
|
||||
if(status[index]) {
|
||||
indicators.items.push(ResourcesService.setLink(
|
||||
if (status[index]) {
|
||||
indicatorsItems.push(ResourcesService.setLink(
|
||||
new MenuItem("indicators-" + type.value, type.label,
|
||||
"", "", false, [], null, {}, null, null, null, null, '_self'),
|
||||
prefix + "/indicators/" + type.value, portal)
|
||||
|
@ -58,10 +57,9 @@ export class ResourcesService {
|
|||
});
|
||||
})
|
||||
await promise;
|
||||
if(indicators.items.length > 0) {
|
||||
indicators.url = indicators.items[0].url;
|
||||
indicators.route = indicators.items[0].route;
|
||||
if (indicatorsItems.length > 0) {
|
||||
items.push(indicators);
|
||||
indicatorsItems.forEach(item => items.push(item));
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
@ -70,7 +68,7 @@ export class ResourcesService {
|
|||
* @deprecated
|
||||
* */
|
||||
setResourcesDeprecated(items: RootMenuItem[], prefix = '', portal: string = null) {
|
||||
if(this.subscription) {
|
||||
if (this.subscription) {
|
||||
this.subscription.unsubscribe();
|
||||
}
|
||||
let resources = new MenuItem('resources', 'Resources', "", "", false, [], null, {});
|
||||
|
@ -81,13 +79,13 @@ export class ResourcesService {
|
|||
}
|
||||
|
||||
setResources(items: MenuItem[], prefix = '', portal: string = null) {
|
||||
if(this.subscription) {
|
||||
if (this.subscription) {
|
||||
this.subscription.unsubscribe();
|
||||
}
|
||||
let resources = new MenuItem('resources', 'Resources', "", "", false, [], null, {});
|
||||
let index = items.push(resources) - 1;
|
||||
this.subscription = from(this.getResourcesItemsAsync(prefix, portal)).subscribe(resourcesItems => {
|
||||
items[index].items = resourcesItems;
|
||||
items[index].items = resourcesItems;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -98,7 +96,7 @@ export class ResourcesService {
|
|||
let result = this.routes.map(() => false);
|
||||
pages.forEach(page => {
|
||||
let index = this.routes.findIndex(route => route === page.route && page.isEnabled);
|
||||
if(index !== -1) {
|
||||
if (index !== -1) {
|
||||
result[index] = true;
|
||||
}
|
||||
});
|
||||
|
@ -107,8 +105,8 @@ export class ResourcesService {
|
|||
}
|
||||
|
||||
private static setLink(item: MenuItem, route: string, portal: string = null) {
|
||||
if(portal) {
|
||||
item.url = portal + route + (item.fragment?'#' + item.fragment:'');
|
||||
if (portal) {
|
||||
item.url = portal + route + (item.fragment ? '#' + item.fragment : '');
|
||||
} else {
|
||||
item.route = route;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue