Sanitise the component and Demo shell from embedded strings (#2474)

This commit is contained in:
Eugenio Romano
2017-10-14 14:27:41 +01:00
committed by Denys Vuika
parent bfe8fc8d15
commit 9663971256
17 changed files with 158 additions and 73 deletions

View File

@@ -16,7 +16,7 @@
*/
import { NgModule } from '@angular/core';
import { CoreModule } from 'ng2-alfresco-core';
import { CoreModule, TRANSLATION_PROVIDER } from 'ng2-alfresco-core';
import { DataTableModule } from 'ng2-alfresco-datatable';
import { WebscriptComponent } from './src/webscript.component';
@@ -30,6 +30,16 @@ export { WebscriptComponent } from './src/webscript.component';
declarations: [
WebscriptComponent
],
providers: [
{
provide: TRANSLATION_PROVIDER,
multi: true,
useValue: {
name: 'ng2-alfresco-webscript',
source: 'assets/ng2-alfresco-webscript'
}
}
],
exports: [
WebscriptComponent
]

View File

@@ -1,3 +1,5 @@
{
"WEBSCRIPT": {
"ERROR": "Error during the deserialization of {{data}} as {{contentType}}"
}
}

View File

@@ -0,0 +1,16 @@
<div *ngIf="showData">
<div *ngIf="contentType === 'JSON'" id="webscript-data-JSON">{{data | json}}</div>
<div *ngIf="contentType === 'HTML'" id="webscript-data-HTML" [innerHTML]="data"></div>
<div *ngIf="contentType === 'TEXT'" id="webscript-data-TEXT">{{data}}</div>
<div *ngIf="isDataTableContent()">
<alfresco-datatable id="webscript-datatable-wrapper" [data]="data"></alfresco-datatable>
<div>
<div *ngIf="showError" id="error">{{'WEBSCRIPT.ERROR' | translate: {
data: data,
contentType: contentType
}
}}
</div>
</div>
</div>
</div>

View File

@@ -42,15 +42,7 @@ import { ObjectDataTableAdapter } from 'ng2-alfresco-datatable';
*/
@Component({
selector: 'adf-webscript-get, alfresco-webscript-get',
template: `
<div *ngIf="showData">
<div *ngIf="contentType === 'JSON'" id="webscript-data-JSON">{{data | json}}</div>
<div *ngIf="contentType === 'HTML'" id="webscript-data-HTML" [innerHTML]="data"></div>
<div *ngIf="contentType === 'TEXT'" id="webscript-data-TEXT" >{{data}}</div>
<div *ngIf="isDataTableContent()"><alfresco-datatable id="webscript-datatable-wrapper" [data]="data"></alfresco-datatable><div>
<div *ngIf="showError" id="error">Error during the deserialization of {{data}} as {{contentType}}</div>
</div>
`
templateUrl: 'webscript.component.html'
})
export class WebscriptComponent implements OnChanges {