File tree Expand file tree Collapse file tree 4 files changed +46
-3
lines changed
resources/views/includes/columns Expand file tree Collapse file tree 4 files changed +46
-3
lines changed Original file line number Diff line number Diff line change 22
33All notable changes to ` laravel-livewire-tables ` will be documented in this file
44
5- =======
65## [ v3.2.6] - UNRELEASED
76### New Features
87- Add configurable wire: model for filters by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1699
@@ -15,7 +14,6 @@ All notable changes to `laravel-livewire-tables` will be documented in this file
1514- Migrate to PHPUnit Attributes rather than Doc Comments by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1727
1615- Remove broken test by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1719
1716
18-
1917## [ v3.2.5] - 2024-04-30
2018### New Features
2119- Add setConfigurableArea by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1706
Original file line number Diff line number Diff line change @@ -96,6 +96,15 @@ Column::make('Name')
9696 ->html(),
9797```
9898
99+ And this method is also available for the [ LinkColumn] ( ./other-column-types#content-link-columns )
100+
101+ ``` php
102+ LinkColumn::make('Name', 'name')
103+ ->title(fn ($row) => 'Title')
104+ ->location(fn ($row) => "#$row->id")
105+ ->html(),
106+ ```
107+
99108### Using a view
100109
101110If you would like to render a view for the cell:
Original file line number Diff line number Diff line change 1- <a href =" {{ $path } }" {!! count ($attributes ) ? $column -> arrayToAttributes ($attributes ) : ' ' ! !} >{{ $title } } </a >
1+ <a href =" {{ $path } }" {!! count ($attributes ) ? $column -> arrayToAttributes ($attributes ) : ' ' ! !} >
2+ @if ($column -> isHtml () )
3+ {!! $title ! !}
4+ @else
5+ {{ $title } }
6+ @endif
7+ </a >
Original file line number Diff line number Diff line change @@ -43,4 +43,34 @@ public function test_can_render_field_if_title_and_location_callback(): void
4343
4444 $ this ->assertNotEmpty ($ column );
4545 }
46+
47+ /** @test */
48+ public function can_check_ishtml_from_html_column (): void
49+ {
50+ $ column = LinkColumn::make ('Name ' , 'name ' )
51+ ->title (fn ($ row ) => 'Title ' )
52+ ->location (fn ($ row ) => "# $ row ->id " )
53+ ->html ();
54+
55+ $ this ->assertTrue ($ column ->isHtml ());
56+ }
57+
58+ /** @test */
59+ public function can_get_html_from_html_label_column (): void
60+ {
61+ $ column = LinkColumn::make ('Name ' , 'name ' )
62+ ->title (fn ($ row ) => '<strong>My Label</strong> ' )
63+ ->location (fn ($ row ) => "# $ row ->id " )
64+ ->html ();
65+
66+ $ rows = $ this ->basicTable ->getRows ();
67+ $ location = '# ' .$ rows ->first ()->id ;
68+ $ htmlString = new \Illuminate \Support \HtmlString ('<a href=" ' .$ location .'"><strong>My Label</strong></a> ' );
69+
70+ // Removing every whitespace and line break for the comparison
71+ $ expectedHtml = preg_replace ('/\s+/ ' , '' , $ htmlString ->toHtml ());
72+ $ actualHtml = preg_replace ('/\s+/ ' , '' , $ column ->getContents ($ rows ->first ())->toHtml ());
73+
74+ $ this ->assertSame ($ expectedHtml , $ actualHtml );
75+ }
4676}
You can’t perform that action at this time.
0 commit comments