diff --git a/src/app.config.json b/src/app.config.json
index 0673d0896..7d6ef8fba 100644
--- a/src/app.config.json
+++ b/src/app.config.json
@@ -9,7 +9,8 @@
"© 2017 - 2018 Alfresco Software, Inc. All rights reserved."
},
"experimental": {
- "libraries": false
+ "libraries": false,
+ "comments": false
},
"headerColor": "#2196F3",
"languagePicker": false,
diff --git a/src/app/components/info-drawer/info-drawer.component.html b/src/app/components/info-drawer/info-drawer.component.html
index 985ebec34..a051dac50 100644
--- a/src/app/components/info-drawer/info-drawer.component.html
+++ b/src/app/components/info-drawer/info-drawer.component.html
@@ -12,21 +12,29 @@
-
-
-
-
-
+
+
+
+
+
-
-
- face
- {{ 'VERSION.SELECTION.EMPTY' | translate }}
-
-
-
+
+
+
+
+
+
+
+
+
+ face
+ {{ 'VERSION.SELECTION.EMPTY' | translate }}
+
+
+
+
diff --git a/src/app/components/settings/settings.component.html b/src/app/components/settings/settings.component.html
index c17358f9e..1e2a554ed 100644
--- a/src/app/components/settings/settings.component.html
+++ b/src/app/components/settings/settings.component.html
@@ -59,10 +59,19 @@
{{ 'APP.SETTINGS.EXPERIMENTAL-FEATURES' | translate }}
-
- Library Management
-
+
+
+ Library Management
+
+
+
+
+ Comments
+
+
diff --git a/src/app/components/settings/settings.component.ts b/src/app/components/settings/settings.component.ts
index e2ff08280..ae4de7c52 100644
--- a/src/app/components/settings/settings.component.ts
+++ b/src/app/components/settings/settings.component.ts
@@ -49,6 +49,7 @@ export class SettingsComponent implements OnInit {
headerColor$: Observable;
languagePicker$: Observable;
libraries: boolean;
+ comments: boolean;
constructor(
private store: Store,
@@ -74,6 +75,9 @@ export class SettingsComponent implements OnInit {
const libraries = this.appConfig.get('experimental.libraries');
this.libraries = (libraries === true || libraries === 'true');
+
+ const comments = this.appConfig.get('experimental.comments');
+ this.comments = (comments === true || comments === 'true');
}
apply(model: any, isValid: boolean) {
@@ -97,4 +101,8 @@ export class SettingsComponent implements OnInit {
onChangeLibrariesFeature(event: MatCheckboxChange) {
this.storage.setItem('experimental.libraries', event.checked.toString());
}
+
+ onChangeCommentsFeature(event: MatCheckboxChange) {
+ this.storage.setItem('experimental.comments', event.checked.toString());
+ }
}
diff --git a/src/app/directives/experimental.directive.ts b/src/app/directives/experimental.directive.ts
index 3546f8c50..09c30bed9 100644
--- a/src/app/directives/experimental.directive.ts
+++ b/src/app/directives/experimental.directive.ts
@@ -23,7 +23,7 @@
* along with Alfresco. If not, see .
*/
-import { Directive, TemplateRef, ViewContainerRef, Input } from '@angular/core';
+import { Directive, TemplateRef, ViewContainerRef, Input, EmbeddedViewRef } from '@angular/core';
import { AppConfigService, StorageService } from '@alfresco/adf-core';
import { environment } from '../../environments/environment';
@@ -32,6 +32,10 @@ import { environment } from '../../environments/environment';
selector: '[ifExperimental]'
})
export class ExperimentalDirective {
+ private elseTemplateRef: TemplateRef;
+ private elseViewRef: EmbeddedViewRef;
+ private shouldRender: boolean;
+
constructor(
private templateRef: TemplateRef,
private viewContainerRef: ViewContainerRef,
@@ -43,19 +47,49 @@ export class ExperimentalDirective {
const key = `experimental.${featureKey}`;
const override = this.storage.getItem(key);
+
if (override === 'true') {
- this.viewContainerRef.createEmbeddedView(this.templateRef);
- return;
+ this.shouldRender = true;
}
if (!environment.production) {
const value = this.config.get(key);
if (value === true || value === 'true') {
- this.viewContainerRef.createEmbeddedView(this.templateRef);
- return;
+ this.shouldRender = true;
}
}
- this.viewContainerRef.clear();
+ if (override !== 'true' && environment.production) {
+ this.shouldRender = false;
+ }
+
+ this.updateView();
+ }
+
+ @Input() set ifExperimentalElse(templateRef: TemplateRef) {
+ this.elseTemplateRef = templateRef;
+ this.elseViewRef = null;
+ this.updateView();
+ }
+
+ private updateView() {
+ if (this.shouldRender) {
+ this.viewContainerRef.clear();
+ this.elseViewRef = null;
+
+ if (this.templateRef) {
+ this.viewContainerRef.createEmbeddedView(this.templateRef);
+ }
+ } else {
+ if (this.elseViewRef) {
+ return;
+ }
+
+ this.viewContainerRef.clear();
+
+ if (this.elseTemplateRef) {
+ this.elseViewRef = this.viewContainerRef.createEmbeddedView(this.elseTemplateRef);
+ }
+ }
}
}
diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json
index 189470c16..a9dfa968d 100644
--- a/src/assets/i18n/en.json
+++ b/src/assets/i18n/en.json
@@ -232,7 +232,8 @@
"TITLE": "Details",
"TABS": {
"PROPERTIES": "Properties",
- "VERSIONS": "Versions"
+ "VERSIONS": "Versions",
+ "COMMENTS": "Comments"
}
}
},