diff --git a/demo-shell/src/app.config.json b/demo-shell/src/app.config.json index 1808fd637c..06e2c6b74f 100644 --- a/demo-shell/src/app.config.json +++ b/demo-shell/src/app.config.json @@ -4,7 +4,8 @@ "bpmHost": "http://{hostname}:{port}", "contextRootBpm": "activiti-app", "application": { - "name": "Alfresco ADF Application" + "name": "Alfresco ADF Application", + "copyright": "© 2016 - 2018 Alfresco Software, Inc. All Rights Reserved." }, "languages": [ { diff --git a/demo-shell/src/app/components/login/login.component.html b/demo-shell/src/app/components/login/login.component.html index 0f8e36e545..84a2419c9b 100644 --- a/demo-shell/src/app/components/login/login.component.html +++ b/demo-shell/src/app/components/login/login.component.html @@ -52,7 +52,7 @@ [disableCsrf]="disableCsrf" [showLoginActions]="showFooter" [showRememberMe]="showFooter" - copyrightText="© 2016 Alfresco Software, Inc. All Rights Reserved. (customised text)" + copyrightText="{{ 'application.copyright' | adfAppConfig }}" (success)="onLogin($event)" (error)="onError($event)">
diff --git a/docs/core/app-config.pipe.md b/docs/core/app-config.pipe.md new file mode 100644 index 0000000000..3341801d63 --- /dev/null +++ b/docs/core/app-config.pipe.md @@ -0,0 +1,40 @@ +--- +Added: v2.4.0 +Status: Active +--- + +# App Config Pipe + +Retrieves values from the application configuration file directly. + +## Examples + +```html + + +``` + +## Fallback values + +You can use pipe parameters to pass fallback value: + +```html + + +``` + +## Chaining with other pipes + +You can also chain values with other pipes, for example `translation` one: + +```html + + +``` + +## See also + +- [App Config service](app-config.service.md) diff --git a/lib/core/app-config/app-config.module.ts b/lib/core/app-config/app-config.module.ts index f947c42121..cab0c81744 100644 --- a/lib/core/app-config/app-config.module.ts +++ b/lib/core/app-config/app-config.module.ts @@ -18,13 +18,20 @@ import { HttpClientModule } from '@angular/common/http'; import { NgModule } from '@angular/core'; import { AppConfigService } from './app-config.service'; +import { AppConfigPipe } from './app-config.pipe'; @NgModule({ imports: [ HttpClientModule ], + declarations: [ + AppConfigPipe + ], providers: [ AppConfigService + ], + exports: [ + AppConfigPipe ] }) export class AppConfigModule { diff --git a/lib/core/app-config/app-config.pipe.ts b/lib/core/app-config/app-config.pipe.ts new file mode 100644 index 0000000000..e05820a747 --- /dev/null +++ b/lib/core/app-config/app-config.pipe.ts @@ -0,0 +1,30 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Pipe, PipeTransform } from '@angular/core'; +import { AppConfigService } from './app-config.service'; + +@Pipe({ + name: 'adfAppConfig' +}) +export class AppConfigPipe implements PipeTransform { + constructor(private config: AppConfigService) {} + + transform(value: string, fallback: any): any { + return this.config.get(value, fallback); + } +} diff --git a/lib/core/app-config/public-api.ts b/lib/core/app-config/public-api.ts index f1eec1d6c2..3e7eeab9e5 100644 --- a/lib/core/app-config/public-api.ts +++ b/lib/core/app-config/public-api.ts @@ -16,5 +16,6 @@ */ export * from './app-config.service'; +export * from './app-config.pipe'; export * from './app-config.module';