Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pagination to the "Pending Owner Invites" page #5185

Closed
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions app/controllers/me/pending-invites.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';

import { reads } from 'macro-decorators';

import { pagination } from '../../utils/pagination';

export default class PendingInvitesController extends Controller {
queryParams = ['page', 'per_page', 'sort'];
@tracked page = '1';
@tracked per_page = 50;
@tracked sort = 'alpha';

@reads('model.meta.total') totalItems;
@pagination() pagination;

get currentSortBy() {
if (this.sort === 'downloads') {
return 'All-Time Downloads';
} else if (this.sort === 'recent-downloads') {
return 'Recent Downloads';
} else if (this.sort === 'recent-updates') {
return 'Recent Updates';
} else if (this.sort === 'new') {
return 'Newly Added';
} else {
return 'Alphabetical';
}
}
}
5 changes: 5 additions & 0 deletions app/routes/me/pending-invites.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import AuthenticatedRoute from '../-authenticated-route';
export default class PendingInvitesRoute extends AuthenticatedRoute {
@service store;

queryParams = {
page: { refreshModel: true },
sort: { refreshModel: true },
};

model() {
return this.store.findAll('crate-owner-invite');
}
Expand Down
1 change: 1 addition & 0 deletions app/styles/me/pending-invites.module.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.list {
background: white;
margin-bottom: 2rem;
}

.row {
Expand Down
2 changes: 2 additions & 0 deletions app/templates/me/pending-invites.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@
<p local-class="row" data-test-empty-state>You don't seem to have any pending invitations.</p>
{{/each}}
</div>

<Pagination @pagination={{this.pagination}} />
Loading