-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(metadata-editor): organize fields into pages and sections.
- Loading branch information
Romuald Caplier
committed
Jul 17, 2024
1 parent
55a2990
commit 1000d4a
Showing
42 changed files
with
936 additions
and
285 deletions.
There are no files selected for viewing
Empty file.
39 changes: 39 additions & 0 deletions
39
apps/metadata-editor/src/app/edit/components/breadcrumbs/page-selector.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,39 @@ | ||
<div class="w-full flex flex-row p-8 items-center gap-6"> | ||
<ng-container | ||
*ngFor="let page of pages; let index = index; let isLast = last" | ||
> | ||
<div class="flex flex-row items-center gap-4"> | ||
<div class="flex flex-row items-center gap-4 hover:cursor-pointer"> | ||
<gn-ui-button | ||
(buttonClick)="pageSectionClickHandler(index)" | ||
class="flex flex-row items-center" | ||
[type]="selectedPage === index ? 'primary' : 'default'" | ||
extraClass="bg-transparent border-none" | ||
> | ||
<div | ||
class="w-10 h-10 rounded-[8px] pt-3 text-center" | ||
[ngClass]=" | ||
selectedPage === index ? 'bg-primary font-bold' : 'bg-gray-200' | ||
" | ||
> | ||
{{ index }} | ||
</div> | ||
<div | ||
class="ms-4" | ||
[ngClass]=" | ||
selectedPage === index | ||
? 'text-center text-black font-bold' | ||
: 'text-gray-400' | ||
" | ||
translate | ||
> | ||
{{ page.labelKey }} | ||
</div> | ||
</gn-ui-button> | ||
</div> | ||
<div *ngIf="!isLast" class="w-10"> | ||
<hr class="border-t-[2px]" /> | ||
</div> | ||
</div> | ||
</ng-container> | ||
</div> |
26 changes: 26 additions & 0 deletions
26
apps/metadata-editor/src/app/edit/components/breadcrumbs/page-selector.component.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,26 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing' | ||
import { TranslateModule } from '@ngx-translate/core' | ||
import { PageSelectorComponent } from './page-selector.component' | ||
import { EDITOR_CONFIG } from '@geonetwork-ui/feature/editor' | ||
|
||
describe('BreadcrumbsComponent', () => { | ||
let component: PageSelectorComponent | ||
let fixture: ComponentFixture<PageSelectorComponent> | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [TranslateModule.forRoot()], | ||
providers: [], | ||
}).compileComponents() | ||
|
||
fixture = TestBed.createComponent(PageSelectorComponent) | ||
component = fixture.componentInstance | ||
component.pages = EDITOR_CONFIG().pages | ||
component.selectedPage = 0 | ||
fixture.detectChanges() | ||
}) | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy() | ||
}) | ||
}) |
30 changes: 30 additions & 0 deletions
30
apps/metadata-editor/src/app/edit/components/breadcrumbs/page-selector.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,30 @@ | ||
import { | ||
ChangeDetectionStrategy, | ||
Component, | ||
EventEmitter, | ||
Input, | ||
Output, | ||
} from '@angular/core' | ||
import { CommonModule } from '@angular/common' | ||
import { ButtonComponent } from '@geonetwork-ui/ui/inputs' | ||
import { TranslateModule } from '@ngx-translate/core' | ||
import { EditorFieldPage } from '@geonetwork-ui/feature/editor' | ||
|
||
@Component({ | ||
selector: 'md-editor-page-selector', | ||
standalone: true, | ||
imports: [CommonModule, ButtonComponent, TranslateModule], | ||
templateUrl: './page-selector.component.html', | ||
styleUrls: ['./page-selector.component.css'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class PageSelectorComponent { | ||
@Input() selectedPage = 0 | ||
@Input() pages: EditorFieldPage[] | ||
|
||
@Output() selectedPageChange = new EventEmitter<number>() | ||
|
||
pageSectionClickHandler(index: number) { | ||
this.selectedPageChange.emit(index) | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
apps/metadata-editor/src/app/edit/components/top-toolbar/top-toolbar.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
45 changes: 36 additions & 9 deletions
45
apps/metadata-editor/src/app/edit/edit-page.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 |
---|---|---|
@@ -1,11 +1,38 @@ | ||
<div class="flex flex-col h-full"> | ||
<div class="w-full h-auto shrink-0"> | ||
<md-editor-top-toolbar></md-editor-top-toolbar> | ||
</div> | ||
<div class="grow overflow-auto relative"> | ||
<div class="absolute top-0 left-0 w-2/3 z-10 pointer-events-none"> | ||
<gn-ui-notifications-container></gn-ui-notifications-container> | ||
<ng-container *ngIf="fields$ | async as fields"> | ||
<div class="flex flex-col h-full"> | ||
<div class="w-full h-auto shrink-0"> | ||
<md-editor-top-toolbar></md-editor-top-toolbar> | ||
<md-editor-page-selector | ||
[pages]="fields.pages" | ||
[selectedPage]="selectedPage" | ||
(selectedPageChange)="selectedPageChange($event)" | ||
></md-editor-page-selector> | ||
</div> | ||
<div class="grow overflow-auto relative"> | ||
<div class="absolute top-0 left-0 w-2/3 z-10 pointer-events-none"> | ||
<gn-ui-notifications-container></gn-ui-notifications-container> | ||
</div> | ||
<gn-ui-record-form | ||
[page]="getSelectedPageFields(fields.pages)" | ||
></gn-ui-record-form> | ||
</div> | ||
<div class="p-8 mt-auto flex flex-row justify-between"> | ||
<gn-ui-button | ||
type="secondary" | ||
(buttonClick)="previousPageButtonHandler()" | ||
translate | ||
> | ||
{{ | ||
selectedPage === 0 | ||
? ('editor.record.form.bottomButtons.comeBackLater' | translate) | ||
: ('editor.record.form.bottomButtons.previous' | translate) | ||
}} | ||
</gn-ui-button> | ||
<gn-ui-button type="primary" (buttonClick)="nextPageButtonHandler()" | ||
><span translate | ||
>editor.record.form.bottomButtons.next</span | ||
></gn-ui-button | ||
> | ||
</div> | ||
<gn-ui-record-form></gn-ui-record-form> | ||
</div> | ||
</div> | ||
</ng-container> |
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 was deleted.
Oops, something went wrong.
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
Oops, something went wrong.