Skip to content

Commit

Permalink
Override the Paginators defaultSimpleView (#3652)
Browse files Browse the repository at this point in the history
Credit to @dzava. Fixes #3355.
  • Loading branch information
dzava authored and LukeTowers committed Jan 22, 2019
1 parent 0d5a58d commit ee5a03f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use Backend\Classes\WidgetManager;
use October\Rain\Support\ModuleServiceProvider;
use October\Rain\Router\Helper as RouterHelper;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\Facades\Schema;

class ServiceProvider extends ModuleServiceProvider
Expand Down Expand Up @@ -87,6 +88,8 @@ public function boot()
Schema::defaultStringLength(191);
}

Paginator::defaultSimpleView('system::pagination.simple-default');

/*
* Boot plugins
*/
Expand Down
4 changes: 4 additions & 0 deletions lang/el/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,4 +317,8 @@
'invalid_path' => "Ορίστηκε μη έγκυρη διαδρομή αρχείου : ':path'.",
'folder_size_items' => 'αντικείμενο(α)',
],
'pagination' => [
'previous' => 'Προηγούμενη',
'next' => 'Επόμενη',
],
];
4 changes: 4 additions & 0 deletions lang/en/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,4 +447,8 @@
'invalid_path' => "Invalid file path specified: ':path'.",
'folder_size_items' => 'item(s)',
],
'pagination' => [
'previous' => 'Previous',
'next' => 'Next',
],
];
20 changes: 20 additions & 0 deletions views/pagination/simple-default.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@if ($paginator->hasPages())
<ul class="pagination">
{{-- Previous Page Link --}}
@if ($paginator->onFirstPage())
<li class="disabled"><span>{!! Lang::get('system::lang.pagination.previous') !!}</span></li>
@else
<li><a href="{{ $paginator->previousPageUrl() }}"
rel="prev">{!! Lang::get('system::lang.pagination.previous') !!}</a></li>
@endif

{{-- Next Page Link --}}
@if ($paginator->hasMorePages())
<li><a href="{{ $paginator->nextPageUrl() }}" rel="next">{!! Lang::get('system::lang.pagination.next') !!}</a>
</li>
@else
<li class="disabled"><span>{!! Lang::get('system::lang.pagination.next') !!}</span></li>
@endif
</ul>
@endif

0 comments on commit ee5a03f

Please sign in to comment.