-
-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3469ad5
commit d6002bf
Showing
13 changed files
with
190 additions
and
115 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
10 changes: 10 additions & 0 deletions
10
templates/angular/app/components/common/alert/alert.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,10 @@ | ||
<div class="rounded py-4 px-4 text-sm mt-2" | ||
[class]="type === 'loading' ? 'bg-blue-100 text-blue-700' : 'bg-red-100 text-red-700'"> | ||
@if (type === 'loading') { | ||
Loading ... | ||
} | ||
@if (type === 'error') { | ||
<h3 class="text-lg">\{{ error()?.['name'] }} <span class="text-sm">\{{ error()?.['status'] }}</span></h3> | ||
<p>\{{ error()?.['message'] }}</p> | ||
} | ||
</div> |
13 changes: 13 additions & 0 deletions
13
templates/angular/app/components/common/alert/alert.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,13 @@ | ||
import {Component, Input, WritableSignal} from '@angular/core'; | ||
import {SubmissionErrors} from "@interface/api"; | ||
|
||
@Component({ | ||
selector: 'app-alert', | ||
standalone: true, | ||
imports: [], | ||
templateUrl: './alert.component.html' | ||
}) | ||
export class AlertComponent { | ||
@Input() type!: 'loading' | 'error'; | ||
@Input() error!: WritableSignal<SubmissionErrors | null>; | ||
} |
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
24 changes: 14 additions & 10 deletions
24
templates/angular/app/components/foo/edit/edit.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,16 +1,20 @@ | ||
<div class="px-4 mt-4"> | ||
<div class="flex items-center justify-end"> | ||
<app-back-to-list url="/{{lc}}s" /> | ||
<app-back-to-list url="/{{lc}}s"/> | ||
</div> | ||
@if (isLoading()) { | ||
<div class="bg-blue-100 rounded py-4 px-4 text-blue-700 text-sm">Loading ...</div> | ||
} @else if (error()) { | ||
<div class="bg-red-100 rounded py-4 px-4 text-blue-700 text-sm">Error ...</div> | ||
} @else { | ||
<h1 class="text-3xl my-4">Edit \{{ item()['name'] }} <span class="text-xl">\{{ item()["@id"] }} </span></h1> | ||
<app-form-{{lc}} [item]="item()" | ||
(submit)="onSubmit($event)" | ||
(delete)="delete()" | ||
/> | ||
<app-alert type="loading"/> | ||
} | ||
@if (error()) { | ||
<app-alert type="error" [error]="error"/> | ||
} | ||
<h1 class="text-3xl my-4"> | ||
Edit \{{ item()['name'] }} | ||
<span class="text-xl">\{{ item()["@id"] }}</span> | ||
</h1> | ||
<app-form-{{lc}} | ||
[item]="item()" | ||
(submit)="onSubmit($event)" | ||
(delete)="delete()" | ||
/> | ||
</div> |
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.