File tree 8 files changed +35
-32
lines changed
8 files changed +35
-32
lines changed Original file line number Diff line number Diff line change
1
+ {{ #if @pagination.nextPage }}
2
+ <nav local-class =' seek-pagination' aria-label =" Pagination navigation" >
3
+ <LinkTo @query ={{ hash seek = @pagination.nextPage }} local-class =" next" rel =" next" title =" Goes to next page" data-test-pagination-next>
4
+ Next Page
5
+ </LinkTo >
6
+ </nav >
7
+ {{ /if }}
Original file line number Diff line number Diff line change
1
+ .seek-pagination {
2
+ text-align : center;
3
+ font-size : 90% ;
4
+ margin-bottom : 20px ;
5
+ }
Original file line number Diff line number Diff line change 1
1
import Controller from '@ember/controller' ;
2
- import { tracked } from '@glimmer/tracking' ;
3
2
4
3
import { reads } from 'macro-decorators' ;
5
4
6
- import { pagination } from '../../utils/seek' ;
5
+ import { pagination } from '../../utils/seek-pagination ' ;
7
6
8
7
export default class PendingInvitesController extends Controller {
9
- queryParams = [ 'seek' ] ;
10
- @tracked seek = 'WzEsIDFd' ;
11
-
12
- @reads ( 'model.meta.total' ) totalItems ;
8
+ @reads ( 'model.meta.next_page' ) nextPage ;
13
9
@pagination ( ) pagination ;
14
10
}
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ export default class PendingInvitesRoute extends AuthenticatedRoute {
6
6
@service store ;
7
7
8
8
queryParams = {
9
- page : { refreshModel : true } ,
9
+ seek : { refreshModel : true } ,
10
10
} ;
11
11
12
12
model ( params ) {
Original file line number Diff line number Diff line change 10
10
{{ /each }}
11
11
</div >
12
12
13
- <Pagination @pagination ={{ this.pagination }} />
13
+ <SeekPagination @pagination ={{ this.pagination }} />
Original file line number Diff line number Diff line change
1
+ import macro from 'macro-decorators' ;
2
+
3
+ export function pagination ( ) {
4
+ return macro ( function ( ) {
5
+ let { nextPage, totalItems } = this ;
6
+
7
+ return {
8
+ nextPage,
9
+ totalItems,
10
+ } ;
11
+ } ) ;
12
+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -136,6 +136,7 @@ fn prepare_list(
136
136
Page :: Unspecified => query. load ( & * conn) ?,
137
137
Page :: Seek ( s) => {
138
138
let seek_key: ( i32 , i32 ) = s. decode ( ) ?;
139
+ println ! ( "{} {}" , seek_key. 0 , seek_key. 1 ) ;
139
140
query
140
141
. filter (
141
142
crate_owner_invitations:: crate_id. gt ( seek_key. 0 ) . or (
@@ -154,15 +155,12 @@ fn prepare_list(
154
155
raw_invitations. pop ( ) ;
155
156
156
157
if let Some ( last) = raw_invitations. last ( ) {
157
- let mut params = IndexMap :: new ( ) ;
158
- params. insert (
159
- "seek" . into ( ) ,
160
- crate :: controllers:: helpers:: pagination:: encode_seek ( (
161
- last. crate_id ,
162
- last. invited_user_id ,
163
- ) ) ?,
164
- ) ;
165
- Some ( req. query_with_params ( params) )
158
+ let seek_key = crate :: controllers:: helpers:: pagination:: encode_seek ( (
159
+ last. crate_id ,
160
+ last. invited_user_id ,
161
+ ) ) ?;
162
+
163
+ Some ( seek_key)
166
164
} else {
167
165
None
168
166
}
You can’t perform that action at this time.
0 commit comments