Skip to content

Commit fd98bfc

Browse files
authored
Merge pull request #242 from rappasoft/develop
v1.4.0
2 parents b4d9e0b + b0e8c6f commit fd98bfc

22 files changed

+136
-38
lines changed

CHANGELOG.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@ All notable changes to `laravel-livewire-tables` will be documented in this file
44

55
## [Unreleased]
66

7+
## [1.4.0] - 2021-04-29
8+
9+
### Added
10+
11+
- Added option for single column sorting only.
12+
- Ability to change empty message per table.
13+
- Added en.json lang file.
14+
- Ability to add 'All' option to per-page.
15+
16+
### Changed
17+
18+
- Modified views to support localization better where necessary (republish views).
19+
- Alphabetize en.json
20+
- Fixed bulk actions using wrong key to select instead of $primaryKey
21+
- Make bulk select checkbox use primary key
22+
723
## [1.3.1] - 2021-04-26
824

925
### Added
@@ -263,7 +279,8 @@ All notable changes to `laravel-livewire-tables` will be documented in this file
263279

264280
- Initial release
265281

266-
[Unreleased]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.3.1...development
282+
[Unreleased]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.4.0...development
283+
[1.4.0]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.3.1...v1.4.0
267284
[1.3.1]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.3.0...v1.3.1
268285
[1.3.0]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.2.2...v1.3.0
269286
[1.2.2]: https://github.com/rappasoft/laravel-livewire-tables/compare/v1.2.1...v1.2.2

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
A dynamic Laravel Livewire component for data tables.
99

10+
![Full Table](https://i.imgur.com/2kfibjR.png)
11+
1012
This plugin assumes you already have [Laravel Livewire](https://laravel-livewire.com) and [Alpine.js](https://github.com/alpinejs/alpine) installed and configured in your project.
1113

1214
## Installation

resources/lang/en.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"All": "All",
3+
"Applied Filters": "Applied Filters",
4+
"Applied Sorting": "Applied Sorting",
5+
"Bulk Actions": "Bulk Actions",
6+
"Clear": "Clear",
7+
"Filters": "Filters",
8+
"Remove filter option": "Remove filter option",
9+
"Remove sort option": "Remove sort option",
10+
"Search": "Search",
11+
"Select All": "Select All",
12+
"Showing": "Showing",
13+
"Unselect All": "Unselect All",
14+
"You are currently selecting all": "You are currently selecting all",
15+
"You are not connected to the internet.": "You are not connected to the internet.",
16+
"You have selected": "You have selected",
17+
"of": "of",
18+
"results": "results",
19+
"rows": "rows",
20+
"rows, do you want to select all": "rows, do you want to select all",
21+
"to": "to"
22+
}

resources/views/bootstrap-4/includes/bulk-actions.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@if (count($bulkActions))
22
<div class="dropdown mb-3 mb-md-0 d-block d-md-inline">
33
<button class="btn dropdown-toggle d-block w-100 d-md-inline" type="button" id="bulkActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
4-
{{ __('Bulk Actions') }}
4+
@lang('Bulk Actions')
55
</button>
66

77
<div class="dropdown-menu dropdown-menu-right w-100" aria-labelledby="bulkActions">

resources/views/bootstrap-4/includes/filters.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@if ($filtersView || count($customFilters))
22
<div class="btn-group d-block d-md-inline">
33
<button type="button" class="btn dropdown-toggle d-block w-100 d-md-inline" data-toggle="dropdown">
4-
{{ __('Filters') }}
4+
@lang('Filters')
55

66
@if (count(array_filter($filters)) && !(count(array_filter($filters)) === 1 && isset($filters['search'])))
77
<span class="badge badge-info">

resources/views/bootstrap-4/includes/pagination.blade.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,21 @@
55
</div>
66

77
<div class="col-12 col-md-6 text-center text-md-right text-muted">
8-
@lang('Showing :first to :last out of :total results', [
9-
'first' => $rows->count() ? $rows->firstItem() : 0,
10-
'last' => $rows->count() ? $rows->lastItem() : 0,
11-
'total' => $rows->total()
12-
])
8+
@lang('Showing')
9+
<strong>{{ $rows->count() ? $rows->firstItem() : 0 }}</strong>
10+
@lang('to')
11+
<strong>{{ $rows->count() ? $rows->lastItem() : 0 }}</strong>
12+
@lang('of')
13+
<strong>{{ $rows->total() }}</strong>
14+
@lang('results')
1315
</div>
1416
</div>
1517
@else
1618
<div class="row">
1719
<div class="col-12 text-muted">
18-
{!! __('Showing <strong>:count</strong> results', ['count' => $rows->count()]) !!}
20+
@lang('Showing')
21+
<strong>{{ $rows->count() }}</strong>
22+
@lang('results')
1923
</div>
2024
</div>
2125
@endif

resources/views/bootstrap-4/includes/per-page.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class="form-control"
77
>
88
@foreach ($perPageAccepted as $item)
9-
<option value="{{ $item }}">{{ $item }}</option>
9+
<option value="{{ $item }}">{{ $item === -1 ? __('All') : $item }}</option>
1010
@endforeach
1111
</select>
1212
</div>

resources/views/bootstrap-4/includes/table.blade.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@
3030
<x-livewire-tables::bs4.table.cell colspan="{{ count($bulkActions) ? count($columns) + 1 : count($columns) }}">
3131
@unless ($selectAll)
3232
<div>
33-
<span>{!! __('You have selected <strong>:count</strong> rows, do you want to select all <strong>:total</strong>?', ['count' => $rows->count(), 'total' => number_format($rows->total())]) !!}</span>
33+
<span>
34+
@lang('You have selected')
35+
<strong>{{ $rows->count() }}</strong>
36+
@lang('rows, do you want to select all')
37+
<strong>{{ number_format($rows->total()) }}</strong>?
38+
</span>
3439

3540
<button
3641
wire:click="selectAll"
@@ -42,7 +47,11 @@ class="btn btn-primary btn-sm"
4247
</div>
4348
@else
4449
<div>
45-
<span>{!! __('You are currently selecting all <strong>:total</strong> rows.', ['total' => number_format($rows->total())]) !!}</span>
50+
<span>
51+
@lang('You are currently selecting all')
52+
<strong>{{ number_format($rows->total()) }}</strong>
53+
@lang('rows').
54+
</span>
4655

4756
<button
4857
wire:click="resetBulk"
@@ -67,7 +76,7 @@ class="btn btn-primary btn-sm"
6776
<x-livewire-tables::bs4.table.cell>
6877
<input
6978
wire:model="selected"
70-
value="{{ $row->getKey() }}"
79+
value="{{ $row->{$primaryKey} }}"
7180
onclick="event.stopPropagation();return true;"
7281
type="checkbox"
7382
/>
@@ -79,7 +88,7 @@ class="btn btn-primary btn-sm"
7988
@empty
8089
<x-livewire-tables::bs4.table.row>
8190
<x-livewire-tables::bs4.table.cell colspan="{{ count($bulkActions) ? count($columns) + 1 : count($columns) }}">
82-
@lang('No items found. Try narrowing your search.')
91+
@lang($emptyMessage)
8392
</x-livewire-tables::bs4.table.cell>
8493
</x-livewire-tables::bs4.table.row>
8594
@endforelse

resources/views/bootstrap-5/includes/bulk-actions.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@if (count($bulkActions))
22
<div class="dropdown mb-3 mb-md-0 d-block d-md-inline">
33
<button class="btn dropdown-toggle d-block w-100 d-md-inline" type="button" id="bulkActions" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
4-
{{ __('Bulk Actions') }}
4+
@lang('Bulk Actions')
55
</button>
66

77
<div class="dropdown-menu dropdown-menu-end w-100" aria-labelledby="bulkActions">

resources/views/bootstrap-5/includes/filters.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@if ($filtersView || count($customFilters))
22
<div class="btn-group d-block d-md-inline">
33
<button type="button" class="btn dropdown-toggle d-block w-100 d-md-inline" data-bs-toggle="dropdown">
4-
{{ __('Filters') }}
4+
@lang('Filters')
55

66
@if (count(array_filter($filters)) && !(count(array_filter($filters)) === 1 && isset($filters['search'])))
77
<span class="badge bg-info">

0 commit comments

Comments
 (0)