0
bozkan created
https://docs.abp.io/en/abp/latest/Settings
Is it possible to define a setting for storing the logo image and making it configurable over the settings page for each tenant? So that it can be changed in the settings page via a file browser dialog.
- ABP Framework version: v4.4.3
- UI type: Angular
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated (Angular): yes
1 Answer(s)
-
0
Hello,
Setting definitions does not support blob types. You can make this feature by following the steps below.
- Make an endpoint for file upload.
- Create your setting class like in the document (Note: You need to create SettingDefinition with
IsVisibleToClients
parameter's value true) - Add your component to the settings tab like in the document
- Make an input file and upload the file with your file upload endpoint in your setting component.
- Update setting value with image path
- Create logo component and replace logo component with existing, like the following example
import { ConfigStateService } from '@abp/ng.core'; import { Component } from '@angular/core'; @Component({ selector: 'app-my-logo', template: `<a class="navbar-brand" routerLink="/" alt="logo" [style.backgroundImage]="bgUrl" ></a>`, }) export class MyLogoComponent { bgUrl = `url("${this.configState.getSetting('YOUR_SETTING')}”)`; constructor(private configState: ConfigStateService) { } }
//app.component.ts import { Component } from '@angular/core'; import { eThemeLeptonComponents } from '@volo/abp.ng.theme.lepton'; import { MyLogoComponent } from './my-logo.component'; @Component({ selector: 'app-root', template: ` <abp-loader-bar></abp-loader-bar> <abp-dynamic-layout></abp-dynamic-layout> `, }) export class AppComponent { constructor( private replaceableComponentsService: ReplaceableComponentsService ) { replaceableComponentsService.add({ component: MyLogoComponent, key: eThemeLeptonComponents.Logo, }); } }