-
-
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
0658abc
commit 8a7abd3
Showing
34 changed files
with
329 additions
and
213 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,11 @@ | ||
import {Routes} from '@angular/router'; | ||
import {ListComponent} from "@components/foo/list/list.component"; | ||
import {ShowComponent} from "@components/foo/show/show.component"; | ||
import {EditComponent} from "@components/foo/edit/edit.component"; | ||
import {CreateComponent} from "@components/foo/create/create.component"; | ||
import {LayoutComponent} from "@components/common/layout/layout.component"; | ||
import { Routes } from "@angular/router"; | ||
import { LayoutComponent } from "@components/common/layout/layout.component"; | ||
import { allRoutes } from "@router"; | ||
|
||
export const routes: Routes = [ | ||
{ | ||
path: '', | ||
path: "", | ||
component: LayoutComponent, | ||
children: [ | ||
{ | ||
path: '{{lc}}', | ||
component: ListComponent | ||
}, | ||
{ | ||
path: '{{lc}}/add', | ||
component: CreateComponent | ||
}, | ||
{ | ||
path: '{{lc}}/:id', | ||
component: ShowComponent, | ||
}, | ||
{ | ||
path: '{{lc}}/:id/edit', | ||
component: EditComponent | ||
}, | ||
] | ||
} | ||
children: allRoutes, | ||
}, | ||
]; |
7 changes: 6 additions & 1 deletion
7
templates/angular/app/components/common/delete/delete.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
2 changes: 1 addition & 1 deletion
2
templates/angular/app/components/common/header/header.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
4 changes: 2 additions & 2 deletions
4
templates/angular/app/components/common/layout/layout.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
Empty file.
49 changes: 49 additions & 0 deletions
49
templates/angular/app/components/common/pagination/pagination.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,49 @@ | ||
<div class="flex justify-center mt-8"> | ||
<nav aria-label="Page navigation"> | ||
<ul class="flex list-style-none"> | ||
<li> | ||
<a [routerLink]="['/books']" | ||
[routerLinkActive]="'bg-gray-200 text-gray-500 pointer-events-none'" | ||
(click)="changeUri(pagination()['hydra:first'])" | ||
class="bg-gray block py-2 px-3 rounded" | ||
aria-label="First page"> | ||
<span aria-hidden="true">⇐</span>First | ||
</a> | ||
</li> | ||
@if (pagination()['hydra:previous']) { | ||
<li> | ||
<a [routerLink]="['/books']" | ||
[queryParams]="pageParamValue('hydra:previous')" | ||
[routerLinkActive]="'bg-gray-200 text-gray-500 pointer-events-none'" | ||
(click)="changeUri(pagination()['hydra:previous'])" | ||
class="bg-gray block py-2 px-3 rounded" | ||
aria-label="Previous page"> | ||
Previous | ||
</a> | ||
</li> | ||
} | ||
@if (pagination()['hydra:next']) { | ||
<li> | ||
<a [routerLink]="['/books']" | ||
[queryParams]="pageParamValue('hydra:next')" | ||
[routerLinkActive]="'bg-gray-200 text-gray-500 pointer-events-none'" | ||
(click)="changeUri(pagination()['hydra:next'])" | ||
class="bg-gray block py-2 px-3 rounded" | ||
aria-label="Next page"> | ||
Next | ||
</a> | ||
</li> | ||
} | ||
<li> | ||
<a [routerLink]="['/books']" | ||
[queryParams]="pageParamValue('hydra:last')" | ||
[routerLinkActive]="'bg-gray-200 text-gray-500 pointer-events-none'" | ||
(click)="changeUri(pagination()['hydra:last'])" | ||
class="bg-gray block py-2 px-3 rounded" | ||
aria-label="Last page"> | ||
<span aria-hidden="true">⇛</span> Last | ||
</a> | ||
</li> | ||
</ul> | ||
</nav> | ||
</div> |
29 changes: 29 additions & 0 deletions
29
templates/angular/app/components/common/pagination/pagination.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,29 @@ | ||
import {Component, EventEmitter, Input, Output, WritableSignal} from '@angular/core'; | ||
import {RouterLink, RouterLinkActive} from "@angular/router"; | ||
import { Pagination} from "@interface/api"; | ||
|
||
@Component({ | ||
selector: 'app-pagination', | ||
standalone: true, | ||
imports: [ | ||
RouterLink, | ||
RouterLinkActive | ||
], | ||
templateUrl: './pagination.component.html', | ||
styleUrl: './pagination.component.css' | ||
}) | ||
export class PaginationComponent { | ||
@Input() pagination!:WritableSignal<Pagination>; | ||
@Output() handleChangePage = new EventEmitter() | ||
|
||
pageParamValue(page: keyof Pagination) { | ||
const pageParams = this.pagination()[page].split('?page=') | ||
return { | ||
page: pageParams[1] | ||
} | ||
} | ||
|
||
changeUri (uri: string) { | ||
this.handleChangePage.emit(uri) | ||
} | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
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.