Resource Service: Add target for links in resources.
This commit is contained in:
parent
e9a62e1f61
commit
4bec610237
|
@ -26,27 +26,27 @@ export class ResourcesService {
|
||||||
constructor(private http: HttpClient) {
|
constructor(private http: HttpClient) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getResourcesItemsAsync(prefix = '', portal: string = null): Promise<MenuItem[]> {
|
private async getResourcesItemsAsync(prefix = '', portal: string = null, target = '_self'): Promise<MenuItem[]> {
|
||||||
let items = [
|
let items = [
|
||||||
new MenuItem("methodology", "Methodology", "", "", false, [],
|
new MenuItem("methodology", "Methodology", "", "", false, [],
|
||||||
null, {}, null, null, null, null, '_self'),
|
null, {}, null, null, null, null, '_self'),
|
||||||
ResourcesService.setLink(new MenuItem("methodological-approach", "Methodological Approach",
|
ResourcesService.setLink(new MenuItem("methodological-approach", "Methodological Approach",
|
||||||
"", "", false, [], null, {}, null, null, null, null, '_self'),
|
"", "", false, [], null, {}, null, null, null, null, target),
|
||||||
prefix + "/methodology/methodological-approach", portal),
|
prefix + "/methodology/methodological-approach", portal),
|
||||||
ResourcesService.setLink(new MenuItem("terminology", "Terminology and construction",
|
ResourcesService.setLink(new MenuItem("terminology", "Terminology and construction",
|
||||||
"", "", false, [], null, {}, null, null, null, null, '_self'),
|
"", "", false, [], null, {}, null, null, null, null, target),
|
||||||
prefix + "/methodology/terminology", portal)];
|
prefix + "/methodology/terminology", portal)];
|
||||||
items.push(new MenuItem("indicators-page", "Indicators",
|
items.push(new MenuItem("indicators-page", "Indicators",
|
||||||
"", "", false, [], null, {}));
|
"", "", false, [], null, {}));
|
||||||
items.push(ResourcesService.setLink(new MenuItem("indicator-themes", "Indicator Themes",
|
items.push(ResourcesService.setLink(new MenuItem("indicator-themes", "Indicator Themes",
|
||||||
"", "", false, [], null, {}, null, null, null, null, '_self'), prefix + "/indicators/themes", portal));
|
"", "", false, [], null, {}, null, null, null, null, target), prefix + "/indicators/themes", portal));
|
||||||
let promise = new Promise<void>(resolve => {
|
let promise = new Promise<void>(resolve => {
|
||||||
this.isPagesEnabled().subscribe(status => {
|
this.isPagesEnabled().subscribe(status => {
|
||||||
ResourcesService.types.forEach((type, index) => {
|
ResourcesService.types.forEach((type, index) => {
|
||||||
if (status[index]) {
|
if (status[index]) {
|
||||||
items.push(ResourcesService.setLink(
|
items.push(ResourcesService.setLink(
|
||||||
new MenuItem("indicators-" + type.value, type.label,
|
new MenuItem("indicators-" + type.value, type.label,
|
||||||
"", "", false, [], null, {}, null, null, null, null, '_self'),
|
"", "", false, [], null, {}, null, null, null, null, target),
|
||||||
prefix + "/indicators/" + type.value, portal)
|
prefix + "/indicators/" + type.value, portal)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -61,13 +61,13 @@ export class ResourcesService {
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
setResources(items: MenuItem[], prefix = '', portal: string = null) {
|
setResources(items: MenuItem[], prefix = '', portal: string = null, target = '_self') {
|
||||||
if (this.subscription) {
|
if (this.subscription) {
|
||||||
this.subscription.unsubscribe();
|
this.subscription.unsubscribe();
|
||||||
}
|
}
|
||||||
let resources = new MenuItem('resources', 'Resources', "", "", false, [], null, {});
|
let resources = new MenuItem('resources', 'Resources', "", "", false, [], null, {});
|
||||||
let index = items.push(resources) - 1;
|
let index = items.push(resources) - 1;
|
||||||
this.subscription = from(this.getResourcesItemsAsync(prefix, portal)).subscribe(resourcesItems => {
|
this.subscription = from(this.getResourcesItemsAsync(prefix, portal, target)).subscribe(resourcesItems => {
|
||||||
items[index].items = resourcesItems;
|
items[index].items = resourcesItems;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue