File tree Expand file tree Collapse file tree 8 files changed +62
-26
lines changed Expand file tree Collapse file tree 8 files changed +62
-26
lines changed Original file line number Diff line number Diff line change 1212 <span v-else class =" k-label-text" >
1313 <slot />
1414 </span >
15- <template v-if =" input !== false " >
16- <abbr v-if =" required" :title =" $t(type + '.required')" >✶</abbr >
17- <abbr
18- :title =" $t(type + '.invalid')"
19- data-theme =" negative"
20- class =" k-label-invalid"
21- >
22- × ;
23- </abbr >
24- </template >
15+ <abbr v-if =" required" :title =" $t(type + '.required')" >✶</abbr >
16+ <abbr
17+ :title =" $t(type + '.invalid')"
18+ data-theme =" negative"
19+ class =" k-label-invalid"
20+ >
21+ × ;
22+ </abbr >
2523 </component >
2624</template >
2725
Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ export default {
9494.k-user-view .k-user-profile {
9595 margin-bottom : var (--spacing-12 );
9696}
97- .k-user-view [ data-has-tabs = " true " ] .k-user-profile {
97+ .k-user-view .k-user-profile :has ( + .k-tabs ) {
9898 margin-bottom : 0 ;
9999}
100100 </style >
Original file line number Diff line number Diff line change 33namespace Kirby \Panel ;
44
55use Kirby \Cms \Collection ;
6+ use Kirby \Cms \File ;
7+ use Kirby \Cms \Page ;
8+ use Kirby \Cms \User ;
69use Kirby \Content \Changes ;
10+ use Kirby \Panel \Ui \Item \FileItem ;
11+ use Kirby \Panel \Ui \Item \PageItem ;
12+ use Kirby \Panel \Ui \Item \UserItem ;
713
814/**
915 * Manages the Panel dialog for content changes in
@@ -31,14 +37,26 @@ public function files(): array
3137 return $ this ->items ($ this ->changes ->files ());
3238 }
3339
40+ /**
41+ * Helper method to return item props for a single given model
42+ */
43+ public function item (File |Page |User $ model ): array
44+ {
45+ $ item = match (true ) {
46+ $ model instanceof File => new FileItem (file: $ model ),
47+ $ model instanceof Page => new PageItem (page: $ model ),
48+ $ model instanceof User => new UserItem (user: $ model ),
49+ };
50+
51+ return $ item ->props ();
52+ }
53+
3454 /**
3555 * Helper method to return item props for the given models
3656 */
3757 public function items (Collection $ models ): array
3858 {
39- return $ models ->values (
40- fn ($ model ) => $ model ->panel ()->dropdownOption ()
41- );
59+ return $ models ->values ($ this ->item (...));
4260 }
4361
4462 /**
Original file line number Diff line number Diff line change @@ -196,13 +196,14 @@ public function dropdown(array $options = []): array
196196 * Returns the setup for a dropdown option
197197 * which is used in the changes dropdown
198198 * for example
199+ *
200+ * @deprecated 5.1.4 Use the Kirby\Panel\Ui\Item\FileItem class instead
199201 */
200202 public function dropdownOption (): array
201203 {
202- return [
203- 'icon ' => 'image ' ,
204- 'text ' => $ this ->model ->filename (),
205- ] + parent ::dropdownOption ();
204+ return (new FileItem (file: $ this ->model ))->props () + [
205+ 'icon ' => 'image '
206+ ];
206207 }
207208
208209 /**
Original file line number Diff line number Diff line change @@ -197,12 +197,14 @@ public function dropdown(array $options = []): array
197197 * Returns the setup for a dropdown option
198198 * which is used in the changes dropdown
199199 * for example.
200+ *
201+ * @deprecated 5.1.4 Use the Kirby\Panel\Ui\Item\PageItem class instead
200202 */
201203 public function dropdownOption (): array
202204 {
203- return [
204- 'text ' => $ this -> model -> title ()-> value (),
205- ] + parent :: dropdownOption () ;
205+ return ( new PageItem (page: $ this -> model ))-> props () + [
206+ 'icon ' => ' page '
207+ ];
206208 }
207209
208210 /**
Original file line number Diff line number Diff line change @@ -41,12 +41,14 @@ public function buttons(): array
4141 * Returns the setup for a dropdown option
4242 * which is used in the changes dropdown
4343 * for example.
44+ *
45+ * @deprecated 5.1.4
4446 */
4547 public function dropdownOption (): array
4648 {
4749 return [
4850 'icon ' => 'home ' ,
49- 'text ' => $ this ->model ->title ()-> value ( ),
51+ 'text ' => $ this ->model ->toSafeString ( ' {{ site.title }} ' ),
5052 ] + parent ::dropdownOption ();
5153 }
5254
Original file line number Diff line number Diff line change @@ -138,13 +138,14 @@ public function dropdown(array $options = []): array
138138 * Returns the setup for a dropdown option
139139 * which is used in the changes dropdown
140140 * for example.
141+ *
142+ * @deprecated 5.1.4 Use the Kirby\Panel\Ui\Item\UserItem class instead
141143 */
142144 public function dropdownOption (): array
143145 {
144- return [
145- 'icon ' => 'user ' ,
146- 'text ' => $ this ->model ->username (),
147- ] + parent ::dropdownOption ();
146+ return (new UserItem (user: $ this ->model ))->props () + [
147+ 'icon ' => 'user '
148+ ];
148149 }
149150
150151 public function home (): string |null
Original file line number Diff line number Diff line change @@ -84,6 +84,20 @@ public function testFilesWithoutChanges(): void
8484 $ this ->assertSame ([], $ dialog ->files ());
8585 }
8686
87+ public function testItem (): void
88+ {
89+ $ this ->setUpModels ();
90+ $ page = $ this ->app ->page ('page://test ' );
91+ $ page ->version ('latest ' )->save ([]);
92+ $ page ->version ('changes ' )->save ([]);
93+
94+ $ dialog = new ChangesDialog ();
95+ $ item = $ dialog ->item ($ page );
96+
97+ $ this ->assertSame ('test ' , $ item ['text ' ]);
98+ $ this ->assertSame ('/pages/test ' , $ item ['link ' ]);
99+ }
100+
87101 public function testItems (): void
88102 {
89103 $ this ->setUpModels ();
You can’t perform that action at this time.
0 commit comments