used label as the title on dmp and description editor
This commit is contained in:
parent
8a16098fc1
commit
30d338bbbd
|
@ -147,15 +147,19 @@ export class AppComponent implements OnInit, AfterViewInit {
|
|||
while (child.firstChild) {
|
||||
child = child.firstChild;
|
||||
}
|
||||
if (child.snapshot.data['title']) {
|
||||
return child.snapshot.data['title'];
|
||||
const usePrefix = child.snapshot.data['usePrefix'] ?? true;
|
||||
if (child.snapshot.data['getFromTitleService']) {
|
||||
return { title: this.titleService.getTitle(), usePrefix: usePrefix };
|
||||
}
|
||||
else if (child.snapshot.data['title']) {
|
||||
return { title: child.snapshot.data['title'], usePrefix: usePrefix };
|
||||
}
|
||||
}
|
||||
return appTitle;
|
||||
return { title: appTitle, usePrefix: true};
|
||||
})
|
||||
).subscribe((ttl: string) => {
|
||||
this.translateTitle(ttl);
|
||||
this.translate.onLangChange.subscribe(() => this.translateTitle(ttl));
|
||||
).subscribe((titleOptions: { title: string, usePrefix: boolean}) => {
|
||||
this.translateTitle(titleOptions.title, titleOptions.usePrefix);
|
||||
this.translate.onLangChange.subscribe(() => this.translateTitle(titleOptions.title, titleOptions.usePrefix));
|
||||
});
|
||||
|
||||
this.statusChangeSubscription = this.ccService.statusChange$.subscribe((event: NgcStatusChangeEvent) => {
|
||||
|
@ -186,12 +190,16 @@ export class AppComponent implements OnInit, AfterViewInit {
|
|||
});
|
||||
}
|
||||
|
||||
translateTitle(ttl: string) {
|
||||
translateTitle(ttl: string, usePrefix: boolean) {
|
||||
if (ttl.length > 0) {
|
||||
this.translate.get(ttl).subscribe((translated: string) => {
|
||||
this.translate.get('GENERAL.TITLES.PREFIX').subscribe((titlePrefix: string) => {
|
||||
this.titleService.setTitle(titlePrefix + translated);
|
||||
});
|
||||
if (usePrefix) {
|
||||
this.translate.get('GENERAL.TITLES.PREFIX').subscribe((titlePrefix: string) => {
|
||||
this.titleService.setTitle(titlePrefix + translated);
|
||||
});
|
||||
} else {
|
||||
this.titleService.setTitle(translated);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.translate.get('GENERAL.TITLES.GENERAL').subscribe((translated: string) => {
|
||||
|
|
|
@ -50,6 +50,7 @@ import { FileTransformerEntityType } from '@app/core/common/enum/file-transforme
|
|||
import { nameof } from 'ts-simple-nameof';
|
||||
import { AbstractControl, UntypedFormArray, UntypedFormGroup } from '@angular/forms';
|
||||
import { TableOfContentsValidationService } from './table-of-contents/services/table-of-contents-validation-service';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
|
||||
@Component({
|
||||
selector: 'app-description-editor-component',
|
||||
|
@ -101,9 +102,15 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
|||
private dmpService: DmpService,
|
||||
public visibilityRulesService: VisibilityRulesService,
|
||||
public fileTransformerService: FileTransformerService,
|
||||
public tocValidationService: TableOfContentsValidationService
|
||||
|
||||
public tocValidationService: TableOfContentsValidationService,
|
||||
public titleService: Title
|
||||
) {
|
||||
const descriptionLabel:string = route.snapshot.data['entity']?.label;
|
||||
if (descriptionLabel) {
|
||||
titleService.setTitle(descriptionLabel);
|
||||
} else {
|
||||
titleService.setTitle('DESCRIPTION-EDITOR.TITLE-EDIT-DESCRIPTION');
|
||||
}
|
||||
super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, datePipe, route, queryParamsService, lockService, authService, configurationService);
|
||||
}
|
||||
|
||||
|
@ -210,6 +217,7 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
|||
});
|
||||
dialogRef.afterClosed().subscribe((result: Description) => {
|
||||
if (result) {
|
||||
this.titleService.setTitle(result.label);
|
||||
result.dmp = this.item.dmp;
|
||||
result.dmpDescriptionTemplate = this.item.dmpDescriptionTemplate;
|
||||
|
||||
|
|
|
@ -22,7 +22,9 @@ const routes: Routes = [
|
|||
...BreadcrumbService.generateRouteDataConfiguration({
|
||||
title: 'BREADCRUMBS.EDIT-DESCRIPTION'
|
||||
}),
|
||||
title: 'DESCRIPTION-EDITOR.TITLE-EDIT-DESCRIPTION'
|
||||
getFromTitleService: true,
|
||||
usePrefix: false
|
||||
//title: 'DESCRIPTION-EDITOR.TITLE-EDIT-DESCRIPTION'
|
||||
// ,
|
||||
// authContext: {
|
||||
// permissions: [AppPermission.EditDescription]
|
||||
|
|
|
@ -51,6 +51,7 @@ import { map, takeUntil } from 'rxjs/operators';
|
|||
import { DmpEditorModel, DmpFieldIndicator } from './dmp-editor.model';
|
||||
import { DmpEditorResolver } from './dmp-editor.resolver';
|
||||
import { DmpEditorService } from './dmp-editor.service';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dmp-editor',
|
||||
|
@ -164,9 +165,15 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
|
|||
public enumUtils: EnumUtils,
|
||||
public descriptionTemplateService: DescriptionTemplateService,
|
||||
public userService: UserService,
|
||||
public descriptionService: DescriptionService
|
||||
|
||||
public descriptionService: DescriptionService,
|
||||
public titleService: Title
|
||||
) {
|
||||
const descriptionLabel:string = route.snapshot.data['entity']?.label;
|
||||
if (descriptionLabel) {
|
||||
titleService.setTitle(descriptionLabel);
|
||||
} else {
|
||||
titleService.setTitle('DMP-EDITOR.TITLE-EDIT');
|
||||
}
|
||||
super(dialog, language, formService, router, uiNotificationService, httpErrorHandlingService, filterService, datePipe, route, queryParamsService, lockService, authService, configurationService);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,9 @@ const routes: Routes = [
|
|||
data: {
|
||||
...BreadcrumbService.generateRouteDataConfiguration({
|
||||
title: 'BREADCRUMBS.EDIT-DMP'
|
||||
})
|
||||
}),
|
||||
getFromTitleService: true,
|
||||
usePrefix: false
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue