-
-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new acore_string editor (#3210)
Co-authored-by: Francesco Borzì <[email protected]>
- Loading branch information
1 parent
fb5d4fe
commit eeb0d78
Showing
33 changed files
with
710 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
libs/features/texts/src/acore-string/acore-string-handler.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { TestBed } from '@angular/core/testing'; | ||
import { AcoreStringHandlerService } from './acore-string-handler.service'; | ||
import { ACORE_STRING_TABLE } from '@keira/shared/acore-world-model'; | ||
|
||
describe(AcoreStringHandlerService.name, () => { | ||
beforeEach(() => | ||
TestBed.configureTestingModule({ | ||
providers: [AcoreStringHandlerService], | ||
}), | ||
); | ||
|
||
const setup = () => { | ||
const service = TestBed.inject(AcoreStringHandlerService); | ||
return { service }; | ||
}; | ||
|
||
it('isUnsaved should return the value of the statusMap for the broadcast_text table', () => { | ||
const { service } = setup(); | ||
expect(service.isUnsaved).toBe(false); // defaults to false | ||
|
||
service.statusMap[ACORE_STRING_TABLE] = true; | ||
expect(service.isUnsaved).toBe(true); | ||
|
||
service.statusMap[ACORE_STRING_TABLE] = false; | ||
expect(service.isUnsaved).toBe(false); | ||
}); | ||
}); |
18 changes: 18 additions & 0 deletions
18
libs/features/texts/src/acore-string/acore-string-handler.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { HandlerService } from '@keira/shared/base-abstract-classes'; | ||
import { ACORE_STRING_TABLE, AcoreString } from '@keira/shared/acore-world-model'; | ||
|
||
@Injectable({ | ||
providedIn: 'root', | ||
}) | ||
export class AcoreStringHandlerService extends HandlerService<AcoreString> { | ||
protected readonly mainEditorRoutePath = 'texts/acore-string'; | ||
|
||
get isUnsaved(): boolean { | ||
return this.statusMap[ACORE_STRING_TABLE]; | ||
} | ||
|
||
protected _statusMap = { | ||
[ACORE_STRING_TABLE]: false, | ||
}; | ||
} |
73 changes: 73 additions & 0 deletions
73
libs/features/texts/src/acore-string/acore-string.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<keira-top-bar [selected]="handlerService.selected" [selectedName]="handlerService.selectedName" [isNew]="handlerService.isNew" /> | ||
|
||
<div class="container-fluid"> | ||
@if (editorService.loading) { | ||
<span [translate]="'LOADING'"></span> | ||
} | ||
|
||
@if (editorService.form && !!editorService.loadedEntityId && !editorService.loading) { | ||
<div> | ||
<div class="content-block"> | ||
<keira-query-output [docUrl]="docUrl" [editorService]="editorService" (executeQuery)="save($event)" /> | ||
</div> | ||
<form [formGroup]="editorService.form" class="form-group edit-form"> | ||
<div class="content-block"> | ||
<div class="row"> | ||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3 col-xl-2"> | ||
<label class="control-label" for="entry">Entry</label> | ||
<i class="fas fa-info-circle ms-1" placement="auto" [tooltip]="'OTHER_TEXTS.BROADCAST_TEXT.ID' | translate"></i> | ||
<input [formControlName]="'entry'" id="entry" type="text" class="form-control form-control-sm" /> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="form-group col-12"> | ||
<label class="control-label" for="content_default">Content Default</label> | ||
<textarea [formControlName]="'content_default'" id="content_default" class="form-control form-control-sm" rows="5"></textarea> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="form-group col-12 col-sm-6 col-md-6 col-lg-6 col-xl-6"> | ||
<label class="control-label" for="locale_koKR">Locale koKR</label> | ||
<textarea [formControlName]="'locale_koKR'" id="locale_koKR" class="form-control form-control-sm" rows="5"></textarea> | ||
</div> | ||
<div class="form-group col-12 col-sm-6 col-md-6 col-lg-6 col-xl-6"> | ||
<label class="control-label" for="locale_frFR">Locale frFr</label> | ||
<textarea [formControlName]="'locale_frFR'" id="locale_frFR" class="form-control form-control-sm" rows="5"></textarea> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="form-group col-12 col-sm-6 col-md-6 col-lg-6 col-xl-6"> | ||
<label class="control-label" for="locale_deDE">Locale deDe</label> | ||
<textarea [formControlName]="'locale_deDE'" id="locale_deDE" class="form-control form-control-sm" rows="5"></textarea> | ||
</div> | ||
<div class="form-group col-12 col-sm-6 col-md-6 col-lg-6 col-xl-6"> | ||
<label class="control-label" for="locale_zhCN">Locale zhCN</label> | ||
<textarea [formControlName]="'locale_zhCN'" id="locale_zhCN" class="form-control form-control-sm" rows="5"></textarea> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="form-group col-12 col-sm-6 col-md-6 col-lg-6 col-xl-6"> | ||
<label class="control-label" for="locale_zhTW">Locale zhTW</label> | ||
<textarea [formControlName]="'locale_zhTW'" id="locale_zhTW" class="form-control form-control-sm" rows="5"></textarea> | ||
</div> | ||
<div class="form-group col-12 col-sm-6 col-md-6 col-lg-6 col-xl-6"> | ||
<label class="control-label" for="locale_esES">Locale esES</label> | ||
<textarea [formControlName]="'locale_esES'" id="locale_esES" class="form-control form-control-sm" rows="5"></textarea> | ||
</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="form-group col-12 col-sm-6 col-md-6 col-lg-6 col-xl-6"> | ||
<label class="control-label" for="locale_esMX">Locale esMX</label> | ||
<textarea [formControlName]="'locale_esMX'" id="locale_esMX" class="form-control form-control-sm" rows="5"></textarea> | ||
</div> | ||
<div class="form-group col-12 col-sm-6 col-md-6 col-lg-6 col-xl-6"> | ||
<label class="control-label" for="locale_ruRU">Locale ruRU</label> | ||
<textarea [formControlName]="'locale_ruRU'" id="locale_ruRU" class="form-control form-control-sm" rows="5"></textarea> | ||
</div> | ||
</div> | ||
</div> | ||
</form> | ||
</div> | ||
} | ||
</div> |
20 changes: 20 additions & 0 deletions
20
libs/features/texts/src/acore-string/acore-string.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; | ||
import { ReactiveFormsModule } from '@angular/forms'; | ||
import { AcoreString } from '@keira/shared/acore-world-model'; | ||
import { SingleRowEditorComponent } from '@keira/shared/base-abstract-classes'; | ||
import { TranslateModule } from '@ngx-translate/core'; | ||
import { TooltipModule } from 'ngx-bootstrap/tooltip'; | ||
import { AcoreStringHandlerService } from './acore-string-handler.service'; | ||
import { AcoreStringService } from './acore-string.service'; | ||
import { QueryOutputComponent, TopBarComponent } from '@keira/shared/base-editor-components'; | ||
|
||
@Component({ | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
templateUrl: './acore-string.component.html', | ||
standalone: true, | ||
imports: [TranslateModule, ReactiveFormsModule, TooltipModule, QueryOutputComponent, TopBarComponent], | ||
}) | ||
export class AcoreStringComponent extends SingleRowEditorComponent<AcoreString> { | ||
override readonly editorService = inject(AcoreStringService); | ||
protected override readonly handlerService = inject(AcoreStringHandlerService); | ||
} |
Oops, something went wrong.