From 96639712567d752883cc6bb8a4ff734ff9811571 Mon Sep 17 00:00:00 2001 From: Eugenio Romano Date: Sat, 14 Oct 2017 14:27:41 +0100 Subject: [PATCH] Sanitise the component and Demo shell from embedded strings (#2474) --- .../app-layout/app-layout.component.html | 12 ++-- .../datatable/datatable-demo.component.html | 14 ++--- .../app/components/files/files.component.html | 38 +++++++------ .../login/login-demo.component.html | 12 ++-- .../components/search/search.component.html | 2 +- .../settings/settings.component.html | 4 +- .../components/social/social.component.html | 8 ++- .../app/components/tag/tag.component.html | 10 +++- demo-shell-ng2/config/webpack.common.js | 12 +--- demo-shell-ng2/resources/i18n/en.json | 55 ++++++++++++++++++- ng2-components/ng2-alfresco-viewer/index.ts | 16 ++++-- .../unknown-format.component.html | 2 +- .../ng2-alfresco-viewer/src/i18n/en.json | 4 +- .../ng2-alfresco-webscript/index.ts | 12 +++- .../ng2-alfresco-webscript/src/i18n/en.json | 4 +- .../src/webscript.component.html | 16 ++++++ .../src/webscript.component.ts | 10 +--- 17 files changed, 158 insertions(+), 73 deletions(-) create mode 100644 ng2-components/ng2-alfresco-webscript/src/webscript.component.html diff --git a/demo-shell-ng2/app/components/app-layout/app-layout.component.html b/demo-shell-ng2/app/components/app-layout/app-layout.component.html index 5f0f5131ea..db06c2839b 100644 --- a/demo-shell-ng2/app/components/app-layout/app-layout.component.html +++ b/demo-shell-ng2/app/components/app-layout/app-layout.component.html @@ -3,7 +3,7 @@ {{link.icon}} - {{link.title}} + {{link.title | translate }} exit_to_app @@ -19,15 +19,15 @@ [menuPositionY]="'above'"> - ADF Demo Application + {{'APP_LAYOUT.APP_NAME' | translate }}
-
Home - Content Services - Process Services + {{'APP_LAYOUT.HOME' | translate }} + {{'APP_LAYOUT.CONTENT_SERVICES' | translate }} + {{'APP_LAYOUT.PROCESS_SERVICES' | translate }} Login @@ -46,4 +46,4 @@ - \ No newline at end of file + diff --git a/demo-shell-ng2/app/components/datatable/datatable-demo.component.html b/demo-shell-ng2/app/components/datatable/datatable-demo.component.html index 1feceb707b..792443cf1f 100644 --- a/demo-shell-ng2/app/components/datatable/datatable-demo.component.html +++ b/demo-shell-ng2/app/components/datatable/datatable-demo.component.html @@ -22,10 +22,10 @@
- Multiselect + {{ 'DATATABLE.MULTISELECT'| translate }}
-

For 'Multiple' selection mode use Cmd (macOS) or Ctrl (Win) to toggle selection of multiple items.

+

{{ 'DATATABLE.MULTISELECT_DESCRIPTION'| translate }}

{{mode.viewValue}} @@ -33,9 +33,9 @@
- - - - - + + + + +
diff --git a/demo-shell-ng2/app/components/files/files.component.html b/demo-shell-ng2/app/components/files/files.component.html index 290b3c41cc..7ed6968777 100644 --- a/demo-shell-ng2/app/components/files/files.component.html +++ b/demo-shell-ng2/app/components/files/files.component.html @@ -92,7 +92,7 @@ delete Delete - +

Current folder ID: {{ documentList.currentFolderId }}

- +
Selected Nodes:
    @@ -241,28 +241,28 @@
- +
- Multiselect (with checkboxes) + {{'DOCUMENT_LIST.MULTISELECT_CHECKBOXES' | translate}}
- +
- Multiple File Upload + {{'DOCUMENT_LIST.MULTIPLE_FILE_UPLOAD' | translate}}
- +
- Folder upload + {{'DOCUMENT_LIST.FOLDER_UPLOAD' | translate}}
- +
- Custom extensions filter + {{'DOCUMENT_LIST.CUSTOM_FILTER' | translate}}
- +
- Enable versioning + {{'DOCUMENT_LIST.ENABLE_VERSIONING' | translate}}
- +
Upload
@@ -301,18 +301,22 @@
- Enable upload (demoing enabled/disabled state only if the permission are not checked dynamically) + + {{'DOCUMENT_LIST.DESCRIPTION_UPLOAD' | translate}} +
- +
-

For 'Multiple' selection mode use Cmd (macOS) or Ctrl (Win) to toggle selection of multiple items.

+

+ {{'DOCUMENT_LIST.MULTISELECT_DESCRIPTION' | translate}} +

{{mode.viewValue}} -
+ diff --git a/demo-shell-ng2/app/components/login/login-demo.component.html b/demo-shell-ng2/app/components/login/login-demo.component.html index d1c4bc48b3..f9caff270c 100644 --- a/demo-shell-ng2/app/components/login/login-demo.component.html +++ b/demo-shell-ng2/app/components/login/login-demo.component.html @@ -7,7 +7,7 @@ [color]="'primary'" (change)="toggleECM()" [checked]="isECM"> - Content Services + {{ 'LOGIN.CONTENT_SERVICES'| translate }}

@@ -16,7 +16,7 @@ [color]="'primary'" (change)="toggleBPM()" [checked]="isBPM"> - Process Services + {{ 'LOGIN.PROCESS_SERVICES'| translate }}

@@ -34,7 +34,7 @@ [color]="'primary'" (change)="toggleFooter()" [checked]="showFooter"> - Login footer + {{ 'LOGIN.LOGIN_FOOTER'| translate }}

@@ -62,7 +62,7 @@ [color]="'primary'" (change)="toggleECM()" [checked]="isECM"> - Content Services + {{ 'LOGIN.CONTENT_SERVICES'| translate }}

@@ -71,7 +71,7 @@ [color]="'primary'" (change)="toggleBPM()" [checked]="isBPM"> - Process Services + {{ 'LOGIN.PROCESS_SERVICES'| translate }}

@@ -89,7 +89,7 @@ [color]="'primary'" (change)="toggleFooter()" [checked]="showFooter"> - Login footer + {{ 'LOGIN.LOGIN_FOOTER'| translate }}

diff --git a/demo-shell-ng2/app/components/search/search.component.html b/demo-shell-ng2/app/components/search/search.component.html index a606f50dcc..940f62267e 100644 --- a/demo-shell-ng2/app/components/search/search.component.html +++ b/demo-shell-ng2/app/components/search/search.component.html @@ -1,5 +1,5 @@
-
Search results
+
{{ 'SEARCH.RESULTS'| translate }}
diff --git a/demo-shell-ng2/app/components/settings/settings.component.html b/demo-shell-ng2/app/components/settings/settings.component.html index ced5a98a59..04a65ddf6a 100644 --- a/demo-shell-ng2/app/components/settings/settings.component.html +++ b/demo-shell-ng2/app/components/settings/settings.component.html @@ -21,7 +21,7 @@ value="{{ecmHost}}" placeholder="http(s)://host|ip:port(/path)"> - ECM host is not valid! http(s)://host|ip:port(/path) + {{ 'SETTINGS.NOT_VALID'| translate }}

@@ -40,7 +40,7 @@ value="{{bpmHost}}" placeholder="http(s)://host|ip:port(/path)"> - BPM host is not valid! http(s)://host|ip:port(/path) + {{ 'SETTINGS.NOT_VALID'| translate }} diff --git a/demo-shell-ng2/app/components/social/social.component.html b/demo-shell-ng2/app/components/social/social.component.html index 07a4990cff..f7f2b5878d 100644 --- a/demo-shell-ng2/app/components/social/social.component.html +++ b/demo-shell-ng2/app/components/social/social.component.html @@ -4,13 +4,17 @@

-
Like component
+
+ {{'SOCIAL.LIKE' | translate }} +
-
Rating component
+
+ {{'SOCIAL.RATING' | translate }} +
diff --git a/demo-shell-ng2/app/components/tag/tag.component.html b/demo-shell-ng2/app/components/tag/tag.component.html index 6a26d0fe3e..de2e60e9ff 100644 --- a/demo-shell-ng2/app/components/tag/tag.component.html +++ b/demo-shell-ng2/app/components/tag/tag.component.html @@ -1,4 +1,4 @@ -
+

@@ -8,13 +8,17 @@
-
List Tags Content Services
+
+ {{'TAG.LIST' | translate }} +
-
Tag list By Node ID
+
+ {{'TAG.NODE_LIST' | translate }} +
diff --git a/demo-shell-ng2/config/webpack.common.js b/demo-shell-ng2/config/webpack.common.js index 99dffd6cf7..e18fd4f7fe 100644 --- a/demo-shell-ng2/config/webpack.common.js +++ b/demo-shell-ng2/config/webpack.common.js @@ -145,11 +145,7 @@ module.exports = { inline: true, proxy: { '/ecm': { - target: { - host: "0.0.0.0", - protocol: 'http:', - port: 8080 - }, + target: 'http://adfdev.lab.alfresco.me/', pathRewrite: { '^/ecm': '' }, @@ -164,11 +160,7 @@ module.exports = { } }, '/bpm': { - target: { - host: "0.0.0.0", - protocol: 'http:', - port: 9999 - }, + target: 'http://adfdev.lab.alfresco.me/', pathRewrite: { '^/bpm': '' }, diff --git a/demo-shell-ng2/resources/i18n/en.json b/demo-shell-ng2/resources/i18n/en.json index aa0f551d0a..bb6bc66fdc 100644 --- a/demo-shell-ng2/resources/i18n/en.json +++ b/demo-shell-ng2/resources/i18n/en.json @@ -1,6 +1,30 @@ { "title": "Welcome", + "APP_LAYOUT": { + "APP_NAME": "ADF Demo Application", + "HOME": "Home", + "CONTENT_SERVICES": "Content Services", + "PROCESS_SERVICES": "Process Services", + "LOGIN": "Login", + "CUSTOM_SOURCES": "DL: Custom Sources", + "DATATABLE": "Datatable", + "FORM": "Form", + "FORM_LIST": "Form List", + "UPLOADER": "Uploader", + "WEBSCRIPT": "Webscript", + "TAG": "Tag", + "SOCIAL": "Social", + "SETTINGS": "Settings", + "ABOUT": "About" + }, "DOCUMENT_LIST": { + "MULTISELECT_CHECKBOXES" :"Multiselect (with checkboxes)", + "MULTIPLE_FILE_UPLOAD" :"Multiple File Upload", + "FOLDER_UPLOAD" :"Folder upload", + "CUSTOM_FILTER" :"Custom extensions filter", + "ENABLE_VERSIONING" :"Enable versioning", + "MULTISELECT_DESCRIPTION" : "Enable upload (demoing enabled/disabled state only if the permission are not checked dynamically)", + "DESCRIPTION_" : "For 'Multiple' selection mode use Cmd (macOS) or Ctrl (Win) to toggle selection of multiple items.", "COLUMNS": { "DISPLAY_NAME": "Display name", "TAG": "Tag", @@ -22,6 +46,15 @@ } } }, + "DATATABLE" :{ + "RESET_DEFAULT":"Reset to default", + "ADD_ROW":"Add row", + "REPLACE_ROWS":"Replace rows", + "REPLACE_COLUMNS":"Replace columns", + "LOAD_NODE":"Load Node", + "MULTISELECT":"Multiselect", + "MULTISELECT_DESCRIPTION":"For 'Multiple' selection mode use Cmd (macOS) or Ctrl (Win) to toggle selection of multiple items." + }, "ANALYTICS_REPORT": { "NO_REPORT_MESSAGE": "No report selected. Choose a report from the list" }, @@ -38,10 +71,28 @@ "CS-HOST": "Content Services host URL configuration", "BP-HOST": "Process Services host URL configuration", "BACK": "Back", - "APPLY": "APPLY" + "APPLY": "APPLY", + "NOT_VALID": "Host not valid! http(s)://host|ip:port(/path)" }, - "FORM-LIST":{ + "FORM-LIST": { "STORE": "Store", "RESTORE": "Restore" + }, + "LOGIN": { + "CONTENT_SERVICES": "Content Services", + "PROCESS_SERVICES": "Process Services", + "LOGIN_FOOTER": "Login footer" + }, + "SEARCH": { + "RESULTS": "Search results" + }, + "SOCIAL": { + "LIKE":"Like component", + "RATING":"Rating component" + }, + "TAG": { + "LIST":"List Tags Content Services", + "INSERT":"Insert Node Id", + "NODE_LIST":"Tag list By Node ID" } } diff --git a/ng2-components/ng2-alfresco-viewer/index.ts b/ng2-components/ng2-alfresco-viewer/index.ts index ecad9dd17e..c6f2c11686 100644 --- a/ng2-components/ng2-alfresco-viewer/index.ts +++ b/ng2-components/ng2-alfresco-viewer/index.ts @@ -16,8 +16,7 @@ */ import { NgModule } from '@angular/core'; -import { CoreModule } from 'ng2-alfresco-core'; - +import { CoreModule, TRANSLATION_PROVIDER } from 'ng2-alfresco-core'; import { MaterialModule } from './src/material.module'; export { ViewerComponent } from './src/components/viewer.component'; @@ -49,11 +48,20 @@ export function declarations() { ], declarations: declarations(), providers: [ - RenderingQueueServices + RenderingQueueServices, + { + provide: TRANSLATION_PROVIDER, + multi: true, + useValue: { + name: 'ng2-alfresco-viewer', + source: 'assets/ng2-alfresco-viewer' + } + } ], exports: [ MaterialModule, ...declarations() ] }) -export class ViewerModule {} +export class ViewerModule { +} diff --git a/ng2-components/ng2-alfresco-viewer/src/components/unknown-format/unknown-format.component.html b/ng2-components/ng2-alfresco-viewer/src/components/unknown-format/unknown-format.component.html index 74de545144..86547bd4cc 100644 --- a/ng2-components/ng2-alfresco-viewer/src/components/unknown-format/unknown-format.component.html +++ b/ng2-components/ng2-alfresco-viewer/src/components/unknown-format/unknown-format.component.html @@ -1,6 +1,6 @@
wifi_tethering -
Document preview could not be loaded.
+
{{'VIEWER.UNKNOWN' | translate}}
diff --git a/ng2-components/ng2-alfresco-viewer/src/i18n/en.json b/ng2-components/ng2-alfresco-viewer/src/i18n/en.json index 0db3279e44..9fec03f441 100644 --- a/ng2-components/ng2-alfresco-viewer/src/i18n/en.json +++ b/ng2-components/ng2-alfresco-viewer/src/i18n/en.json @@ -1,3 +1,5 @@ { - + "VIEWER": { + "UNKNOWN": "Document preview could not be loaded" + } } diff --git a/ng2-components/ng2-alfresco-webscript/index.ts b/ng2-components/ng2-alfresco-webscript/index.ts index f56acb06f9..fe50ba288e 100644 --- a/ng2-components/ng2-alfresco-webscript/index.ts +++ b/ng2-components/ng2-alfresco-webscript/index.ts @@ -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 ] diff --git a/ng2-components/ng2-alfresco-webscript/src/i18n/en.json b/ng2-components/ng2-alfresco-webscript/src/i18n/en.json index 0db3279e44..ff00d02fdf 100644 --- a/ng2-components/ng2-alfresco-webscript/src/i18n/en.json +++ b/ng2-components/ng2-alfresco-webscript/src/i18n/en.json @@ -1,3 +1,5 @@ { - + "WEBSCRIPT": { + "ERROR": "Error during the deserialization of {{data}} as {{contentType}}" + } } diff --git a/ng2-components/ng2-alfresco-webscript/src/webscript.component.html b/ng2-components/ng2-alfresco-webscript/src/webscript.component.html new file mode 100644 index 0000000000..3643b1cfda --- /dev/null +++ b/ng2-components/ng2-alfresco-webscript/src/webscript.component.html @@ -0,0 +1,16 @@ +
+
{{data | json}}
+
+
{{data}}
+
+ +
+
{{'WEBSCRIPT.ERROR' | translate: { + data: data, + contentType: contentType + } + }} +
+
+
+
diff --git a/ng2-components/ng2-alfresco-webscript/src/webscript.component.ts b/ng2-components/ng2-alfresco-webscript/src/webscript.component.ts index 30bf7be736..27a5493cc1 100644 --- a/ng2-components/ng2-alfresco-webscript/src/webscript.component.ts +++ b/ng2-components/ng2-alfresco-webscript/src/webscript.component.ts @@ -42,15 +42,7 @@ import { ObjectDataTableAdapter } from 'ng2-alfresco-datatable'; */ @Component({ selector: 'adf-webscript-get, alfresco-webscript-get', - template: ` -
-
{{data | json}}
-
-
{{data}}
-
-
Error during the deserialization of {{data}} as {{contentType}}
-
- ` + templateUrl: 'webscript.component.html' }) export class WebscriptComponent implements OnChanges {