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

Support for pagination #34

Open
maharjanmilan opened this issue Mar 22, 2024 · 2 comments
Open

Support for pagination #34

maharjanmilan opened this issue Mar 22, 2024 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@maharjanmilan
Copy link

I was looking at this project and it looks really interesting for me being a Laravel developer previously. I didn't saw this in the documentation but was curious if it supported pagination for collection pages?

@xy2z
Copy link
Owner

xy2z commented Mar 22, 2024

A pagination like showing pages 1-100 is currently not a build in feature.
It can be done using view templates - it's not pretty but possible. So I'd rather make a real pagination :)

If you only want to show next/prev pages, it can be done using the Capro class, here's an example of doing it for the capro docs site:

{{-- Next/prev pages --}}
<div class="pagination">
	{{-- Prev Page --}}
	@php ($prev_page = Capro::pages()->where('in_nav', true)->orderBy('nav_sort')->whereBetween('nav_sort', 0, $self->nav_sort-1)->last())
	@if ($prev_page)
		<a href="{{ $prev_page->href }}">
			<i class="fa-solid fa-chevron-left"></i>
			{{ $prev_page->title }}
		</a>
	@endif

	{{-- Next Page --}}
	@php ($next_page = Capro::pages()->where('in_nav', true)->orderBy('nav_sort')->whereBetween('nav_sort', $self->nav_sort+1, PHP_INT_MAX)->first())
	@if ($next_page)
		<a href="{{ $next_page->href }}" class="_right">
			{{ $next_page->title }}
			<i class="fa-solid fa-chevron-right"></i>
		</a>
	@endif
</div>

Also not super pretty, will probably find a nicer solution at some point.

@xy2z xy2z added enhancement New feature or request help wanted Extra attention is needed labels Mar 22, 2024
@maharjanmilan
Copy link
Author

thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants