@@ -168,34 +168,33 @@ public function renderBulkActions()
168168 $ action = Arr::get ($ bulk_action , 'action ' , $ bulk_action_key );
169169 $ href = Arr::get ($ bulk_action , 'href ' , $ this ->resource_url );
170170 $ title = Arr::get ($ bulk_action , 'modal-title ' );
171+ $ confirmation = !empty ($ bulk_action ['confirmation ' ]) ? ' data-confirmation=" ' . $ bulk_action ['confirmation ' ] . '" ' : '' ;
171172
172- $ confirmation = "" ;
173+ if ($ this ->isExpandableBulkActions ()) {
174+ $ btnColorClass = Arr::get ($ bulk_action , 'color-btn-class ' , 'btn-primary ' );
173175
174- if ($ bulk_action ['confirmation ' ]) {
175- $ confirmation = ' data-confirmation=" ' . $ bulk_action ['confirmation ' ] . '" ' ;
176+ $ class = "btn btn-sm m-1 " . $ btnColorClass ;
177+ $ action_links .= '<a class=" ' . $ class . '" href=" ' . $ href . '" ' . $ confirmation . ' data-action=" ' . $ action . '" data-title=" ' . $ title . '" >Bulk ' . $ bulk_action ['title ' ] . '</a> ' ;
178+ } else {
179+ $ action_links .= '<li><a class="dropdown-item" href=" ' . $ href . '" ' . $ confirmation . ' data-action=" ' . $ action . '" data-title=" ' . $ title . '" > ' . $ bulk_action ['title ' ] . '</a></li> ' ;
176180 }
177-
178- $ action_links .= '<li><a class="dropdown-item" href=" ' . $ href . '" ' . $ confirmation . ' data-action=" ' . $ action . '" data-title=" ' . $ title . '" > ' . $ bulk_action ['title ' ] . '</a></li> ' ;
179181 }
180182
181183 if (empty ($ action_links )) {
182184 return '' ;
183185 }
184186
185- $ actions = '
186- <div class="btn-group bulk_actions" id="bulk_actions_ ' . $ tableId . '" data-table=" ' . $ tableId . '">
187- <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown"> '
188- . trans ('Corals::labels.actions ' ) .
189- '
190- </button>
191- <ul class="dropdown-menu" role="menu"> ' ;
192- $ actions .= $ action_links ;
193-
194- $ actions .= ' </ul>
195- </div> ' ;
196-
197-
198- return $ actions ;
187+ if ($ this ->isExpandableBulkActions ()) {
188+ return '<div class="bulk-actions d-inline" id="bulk_actions_ ' . $ tableId . '" data-table=" ' . $ tableId . '"> ' . $ action_links . '</div> ' ;
189+ } else {
190+ return '
191+ <div class="btn-group bulk_actions" id="bulk_actions_ ' . $ tableId . '" data-table=" ' . $ tableId . '">
192+ <button type="button" class="btn btn-sm btn-primary dropdown-toggle" data-toggle="dropdown"> '
193+ . trans ('Corals::labels.actions ' ) .
194+ '</button>
195+ <ul class="dropdown-menu dropdown-menu-right" role="menu"> ' . $ action_links . '</ul>
196+ </div> ' ;
197+ }
199198 }
200199
201200 /**
@@ -611,4 +610,9 @@ public function addCheckbox(array $attributes = [], $position = false): static
611610
612611 return $ this ;
613612 }
613+
614+ private function isExpandableBulkActions (): bool
615+ {
616+ return $ this ->options ['bulk_actions_as_buttons ' ] ?? false ;
617+ }
614618}
0 commit comments