diff --git a/packages/integration/src/lib/about/about-tool/about-tool.component.html b/packages/integration/src/lib/about/about-tool/about-tool.component.html
index 3a413cbf0d..7cba5d9316 100644
--- a/packages/integration/src/lib/about/about-tool/about-tool.component.html
+++ b/packages/integration/src/lib/about/about-tool/about-tool.component.html
@@ -7,18 +7,33 @@
[discoverTitleInLocale$]="discoverTitleInLocale$">
-
+
+
+
+
+
+
diff --git a/packages/integration/src/lib/about/about-tool/about-tool.component.ts b/packages/integration/src/lib/about/about-tool/about-tool.component.ts
index 6a8643005b..20688d571d 100644
--- a/packages/integration/src/lib/about/about-tool/about-tool.component.ts
+++ b/packages/integration/src/lib/about/about-tool/about-tool.component.ts
@@ -37,7 +37,7 @@ export class AboutToolComponent implements OnInit {
this.discoverTitleInLocale$ = of(value);
}
- public trainingGuideURLs;
+ @Input() trainingGuideURLs;
public version: Version;
private _html: string = 'igo.integration.aboutTool.html';
@@ -56,28 +56,37 @@ export class AboutToolComponent implements OnInit {
}
ngOnInit() {
- this.http.get(this.baseUrlProfil).subscribe((profil) => {
- const recast = profil as any;
- this.trainingGuideURLs = recast.guides;
- this.cdRef.detectChanges();
+ if (this.auth.authenticated && this.configService.getConfig('context.url')) {
+ this.http.get(this.baseUrlProfil).subscribe((profil) => {
+ const recast = profil as any;
+ this.trainingGuideURLs = recast.guides;
+ this.cdRef.detectChanges();
+ });
+ } else if (
+ this.auth.authenticated &&
+ !this.configService.getConfig('context.url') &&
+ this.configService.getConfig('depot.trainingGuides')) {
+ this.trainingGuideURLs = this.configService.getConfig('depot.trainingGuides');
+ }
+ }
+
+ openGuide(guide?) {
+ const url = guide ?
+ this.baseUrlGuide + guide + '?' :
+ this.baseUrlGuide + this.trainingGuideURLs[0] + '?';
+ this.http
+ .get(url, {
+ responseType: 'blob'
+ })
+ .subscribe(() => {
+ window.open(url, '_blank');
});
}
- openGuide() {
- for (const trainingGuideURL of this.trainingGuideURLs) {
- this.http
- .get(this.baseUrlGuide + trainingGuideURL + '?', {
- responseType: 'blob'
- })
- .subscribe((response) => {
- const blob = new Blob([response]);
- const url = window.URL.createObjectURL(blob);
- const anchor = document.createElement('a');
- anchor.href = url;
- anchor.download = trainingGuideURL;
- anchor.click();
- URL.revokeObjectURL(url);
- });
- }
+ formatFileName(name: string) {
+ name = name.split('_').join(' ');
+ const index = name.indexOf('.');
+ name = name.slice(0, index);
+ return name;
}
}
diff --git a/packages/integration/src/lib/about/about.module.ts b/packages/integration/src/lib/about/about.module.ts
index 30acf7ed28..9b3d8f5af6 100644
--- a/packages/integration/src/lib/about/about.module.ts
+++ b/packages/integration/src/lib/about/about.module.ts
@@ -7,6 +7,7 @@ import { CommonModule } from '@angular/common';
import { MatTooltipModule } from '@angular/material/tooltip';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
+import { MatMenuModule } from '@angular/material/menu';
import { IgoLanguageModule } from '@igo2/core';
import { IgoCustomHtmlModule, IgoInteractiveTourModule } from '@igo2/common';
@@ -20,6 +21,7 @@ import { AboutToolComponent } from './about-tool/about-tool.component';
MatButtonModule,
MatTooltipModule,
MatIconModule,
+ MatMenuModule,
IgoInteractiveTourModule,
CommonModule
],