Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to configure privacy statement in config.json #458

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/app/core/config/config.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export interface Config {
useDataUrl?: any;
userProfile?: any;
stagingArea?: StagingAreaSettings;
privacyStatement: string;
}

export interface StagingAreaSettings {
Expand Down
21 changes: 15 additions & 6 deletions src/app/core/privacy-statement/privacy-statement.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { HttpClient } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import { ConfigService } from '@gsrs-core/config';

// tried this:
// import html from '../assets/data/privacy-policy.html';
Expand All @@ -22,13 +23,21 @@ export class PrivacyStatementComponent implements OnInit {
htmlText;
constructor(
private http:HttpClient,
private sanitizer:DomSanitizer
private sanitizer:DomSanitizer,
private configService: ConfigService
){ }
ngOnInit(){
this.http.get('assets/html/privacy-statement.html',{responseType:'text'}).subscribe(result=>{
this.htmlText = this.sanitizer.bypassSecurityTrustHtml(result);
}, error => {
this.htmlText = "Error fetching page content";
});
const privacyStatement = this.configService.configData.privacyStatement;
if(privacyStatement) {
// if used, privacyStatement should be a json encoded string in config.json
this.htmlText = this.sanitizer.bypassSecurityTrustHtml(privacyStatement);
} else {
// if used overwrite this file with a simple html version of your privacy statement.
this.http.get('assets/html/privacy-statement.html',{responseType:'text'}).subscribe(result=>{
this.htmlText = this.sanitizer.bypassSecurityTrustHtml(result);
}, error => {
this.htmlText = "Error fetching page content";
});
}
}
}
6 changes: 4 additions & 2 deletions src/app/fda/config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,8 @@
"Age Groups",
"Intervention Type",
"Study Results",
"Conditions"
"Conditions",
"Substance Role"
]
},
"clinicaltrialsus": {
Expand All @@ -1059,7 +1060,8 @@
"Age Groups",
"Intervention Type",
"Study Results",
"Conditions"
"Conditions",
"Substance Role"
]
},
"adverseeventpt": {
Expand Down
Loading