Skip to content

Commit

Permalink
add bulk action buttons to bottom of favorites and switch order on bo…
Browse files Browse the repository at this point in the history
…ttom
  • Loading branch information
ThoWagen committed Jan 28, 2025
1 parent e186d90 commit c6a3e98
Show file tree
Hide file tree
Showing 6 changed files with 376 additions and 304 deletions.
182 changes: 100 additions & 82 deletions themes/bootstrap3/templates/myresearch/bulk-action-buttons.phtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php if (isset($list)): ?>
<?php $isBottom = $this->idPrefix === 'bottom_'; ?>
<?php if (isset($list) && !$isBottom): ?>
<input type="hidden" name="listID" value="<?=$this->escapeHtmlAttr($list->getId())?>">
<input type="hidden" name="listName" value="<?=$this->escapeHtmlAttr($list->getTitle())?>">
<?php endif; ?>
Expand All @@ -9,92 +10,109 @@
$multiPageSelection = $socialConfig['multi_page_favorites_selection'] ?? true;
$checkboxSelectAllType = $socialConfig['checkbox_select_all_favorites_type'] ?? 'both';
?>
<ul class="action-toolbar">
<?php if ($this->accountCapabilities()->isEmailActionAvailable()): ?>
<?php ob_start(); ?>
<ul class="action-toolbar">
<?php if ($this->accountCapabilities()->isEmailActionAvailable()): ?>
<?=
$this->bulkAction()->button(
'email',
'send-email',
'Email',
[
'title' => $this->translate('bulk_email_myresearch'),
]
)
?>
<?php endif; ?>
<?php if ((null !== $this->list && $this->userlist()->userCanEditList($user, $list)) || null === $this->list && $user): ?>
<?=
$this->bulkAction()->button(
'delete',
'ui-delete',
'Delete',
[
'id' => $this->idPrefix . 'delete_list_items_' . (null !== $this->list ? $this->escapeHtmlAttr($this->list->getId()) : ''),
'title' => $this->translate('bulk_delete_myresearch'),
]
)
?>
<?php endif; ?>
<?php $exportOptions = $this->export()->getActiveFormats('bulk'); ?>
<?php if (count($exportOptions) > 0): ?>
<?=
$this->bulkAction()->button(
'export',
'export',
'Export',
[
'title' => $this->translate('bulk_export_myresearch'),
]
)
?>
<?php endif; ?>
<?=
$this->bulkAction()->button(
'email',
'send-email',
'Email',
'print',
'print',
'Print',
[
'title' => $this->translate('bulk_email_myresearch'),
'title' => $this->translate('bulk_print_myresearch'),
'data-lightbox-ignore' => '',
]
)
?>
<?php endif; ?>
<?php if ((null !== $this->list && $this->userlist()->userCanEditList($user, $list)) || null === $this->list && $user): ?>
<?=
$this->bulkAction()->button(
'delete',
'ui-delete',
'Delete',
[
'id' => $this->idPrefix . 'delete_list_items_' . (null !== $this->list ? $this->escapeHtmlAttr($this->list->getId()) : ''),
'title' => $this->translate('bulk_delete_myresearch'),
]
)
?>
<?php endif; ?>
<?php $exportOptions = $this->export()->getActiveFormats('bulk'); ?>
<?php if (count($exportOptions) > 0): ?>
<?=
$this->bulkAction()->button(
'export',
'export',
'Export',
[
'title' => $this->translate('bulk_export_myresearch'),
]
)
?>
<?php endif; ?>
<?=
$this->bulkAction()->button(
'print',
'print',
'Print',
[
'title' => $this->translate('bulk_print_myresearch'),
'data-lightbox-ignore' => '',
]
)
?>
<?php if ($this->cart()->isActive()): ?>
<?=
$this->bulkAction()->button(
'add',
'cart-add',
'Add to Book Bag',
[
'id' => $this->idPrefix . 'updateCart',
]
)
?>
<?php endif; ?>
</ul>
<ul class="selection-controls-bar">
<?php if(in_array($checkboxSelectAllType, ['on_page', 'both'])): ?>
<li class="bulk-checkbox">
<label for="myresearchCheckAll">
<input type="checkbox" name="selectAll" class="checkbox-select-all" id="myresearchCheckAll">
<?=$this->transEsc('select_all_on_page')?>
</label>
</li>
<?php endif; ?>
<?php if($multiPageSelection && in_array($checkboxSelectAllType, ['global', 'both'])): ?>
<li class="bulk-checkbox">
<div class="select-all-global hidden">
<label for="myresearchCheckAllGlobal">
<input type="checkbox" name="selectAllGlobal" class="checkbox-select-all-global" id="myresearchCheckAllGlobal">
<?=$this->transEsc('select_all')?>
<?php if ($this->cart()->isActive()): ?>
<?=
$this->bulkAction()->button(
'add',
'cart-add',
'Add to Book Bag',
[
'id' => $this->idPrefix . 'updateCart',
]
)
?>
<?php endif; ?>
</ul>
<?php
$bulkActionButtons = ob_get_contents();
ob_end_clean();
ob_start();
?>
<ul class="selection-controls-bar">
<?php if(in_array($checkboxSelectAllType, ['on_page', 'both'])): ?>
<li class="bulk-checkbox">
<label for="<?=$this->idPrefix?>myresearchCheckAll">
<input type="checkbox" name="selectAll" class="checkbox-select-all" id="<?=$this->idPrefix?>myresearchCheckAll">
<?=$this->transEsc('select_all_on_page')?>
</label>
</div>
</li>
<?php endif; ?>
<?php if($multiPageSelection): ?>
<li>
<button type="button" class="clear-selection hidden"></button>
</li>
<?php endif; ?>
</ul>
</li>
<?php endif; ?>
<?php if($multiPageSelection && in_array($checkboxSelectAllType, ['global', 'both'])): ?>
<li class="bulk-checkbox">
<div class="select-all-global hidden">
<label for="<?=$this->idPrefix?>myresearchCheckAllGlobal">
<input type="checkbox" name="selectAllGlobal" class="checkbox-select-all-global" id="<?=$this->idPrefix?>myresearchCheckAllGlobal">
<?=$this->transEsc('select_all')?>
</label>
</div>
</li>
<?php endif; ?>
<?php if($multiPageSelection): ?>
<li>
<button type="button" class="clear-selection hidden"></button>
</li>
<?php endif; ?>
</ul>
<?php
$selectionControlsBar = ob_get_contents();
ob_end_clean();
?>
<?php if ($isBottom): ?>
<?=$selectionControlsBar?>
<?=$bulkActionButtons?>
<?php else: ?>
<?=$bulkActionButtons?>
<?=$selectionControlsBar?>
<?php endif; ?>
</nav>
1 change: 1 addition & 0 deletions themes/bootstrap3/templates/myresearch/mylist.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
<?=$this->record($current)->getListEntry($list, $user)?>
<?php endforeach; ?>
</ul>
<?=$this->context($this)->renderInContext('myresearch/bulk-action-buttons.phtml', ['idPrefix' => 'bottom_', 'list' => $list ?? null, 'account' => $this->account])?>
</form>
<?=$this->paginationControl($this->results->getPaginator(), 'Sliding', 'Helpers/pagination.phtml', ['params' => ['results' => $this->results]])?>
<?php else: ?>
Expand Down
157 changes: 87 additions & 70 deletions themes/bootstrap3/templates/search/bulk-action-buttons.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,95 +3,112 @@
?>
<?php if ($searchSettings->checkboxesEnabled()): ?>
<nav class="bulkActionButtons">
<ul class="action-toolbar">
<?php if ($searchSettings->bulkOptionsEnabled()): ?>
<?php if ($this->accountCapabilities()->isEmailActionAvailable()): ?>
<?=
$this->bulkAction()->button(
'email',
'send-email',
'Email',
array_merge(
[
'id' => $this->idPrefix . 'ribbon-email',
'title' => $this->translate('bulk_email_search'),
],
$this->formAttr ? ['form' => $this->formAttr] : []
)
)
?>
<?php endif; ?>
<?php $exportOptions = $this->export()->getActiveFormats('bulk'); ?>
<?php if (count($exportOptions) > 0): ?>
<?php ob_start(); ?>
<ul class="action-toolbar">
<?php if ($searchSettings->bulkOptionsEnabled()): ?>
<?php if ($this->accountCapabilities()->isEmailActionAvailable()): ?>
<?=
$this->bulkAction()->button(
'email',
'send-email',
'Email',
array_merge(
[
'id' => $this->idPrefix . 'ribbon-email',
'title' => $this->translate('bulk_email_search'),
],
$this->formAttr ? ['form' => $this->formAttr] : []
)
)
?>
<?php endif; ?>
<?php $exportOptions = $this->export()->getActiveFormats('bulk'); ?>
<?php if (count($exportOptions) > 0): ?>
<?=
$this->bulkAction()->button(
'export',
'export',
'Export',
array_merge(
[
'id' => $this->idPrefix . 'ribbon-export',
'title' => $this->translate('bulk_export_search'),
],
$this->formAttr ? ['form' => $this->formAttr] : []
)
)
?>
<?php endif; ?>
<?=
$this->bulkAction()->button(
'export',
'export',
'Export',
'print',
'print',
'Print',
array_merge(
[
'id' => $this->idPrefix . 'ribbon-export',
'title' => $this->translate('bulk_export_search'),
'id' => $this->idPrefix . 'ribbon-print',
'title' => $this->translate('bulk_print_search'),
],
$this->formAttr ? ['form' => $this->formAttr] : []
)
)
?>
<?php endif; ?>
<?=
$this->bulkAction()->button(
'print',
'print',
'Print',
array_merge(
[
'id' => $this->idPrefix . 'ribbon-print',
'title' => $this->translate('bulk_print_search'),
],
$this->formAttr ? ['form' => $this->formAttr] : []
<?php if ($this->userlist()->getMode() !== 'disabled'): ?>
<?=
$this->bulkAction()->button(
'saveCart',
'user-list-add',
'bulk_save_button',
array_merge(
[
'id' => $this->idPrefix . 'ribbon-save',
'title' => $this->translate('bulk_save_search'),
],
$this->formAttr ? ['form' => $this->formAttr] : []
)
)
)
?>
<?php if ($this->userlist()->getMode() !== 'disabled'): ?>
?>
<?php endif; ?>
<?php endif; ?>
<?php if ($searchSettings->cartControlsEnabled()): ?>
<?=
$this->bulkAction()->button(
'saveCart',
'user-list-add',
'bulk_save_button',
'add',
'cart-add',
'Add to Book Bag',
array_merge(
[
'id' => $this->idPrefix . 'ribbon-save',
'title' => $this->translate('bulk_save_search'),
'id' => $this->idPrefix . 'updateCart',
],
$this->formAttr ? ['form' => $this->formAttr] : []
)
)
?>
<?php endif; ?>
<?php endif; ?>
<?php if ($searchSettings->cartControlsEnabled()): ?>
<?=
$this->bulkAction()->button(
'add',
'cart-add',
'Add to Book Bag',
array_merge(
[
'id' => $this->idPrefix . 'updateCart',
],
$this->formAttr ? ['form' => $this->formAttr] : []
)
)
?>
<?php endif; ?>
</ul>
<ul class="selection-controls-bar">
<li class="bulk-checkbox">
<label for="<?=$this->idPrefix?>addFormCheckboxSelectAll">
<input type="checkbox" class="checkbox-select-all" name="selectAll" id="<?=$this->idPrefix?>addFormCheckboxSelectAll"<?php if ($this->formAttr): ?> form="<?=$this->escapeHtmlAttr($this->formAttr) ?>"<?php endif; ?>>
<?=$this->transEsc('select_all_on_page')?>
</label>
</li>
</ul>
</ul>
<?php
$bulkActionButtons = ob_get_contents();
ob_end_clean();
ob_start();
?>
<ul class="selection-controls-bar">
<li class="bulk-checkbox">
<label for="<?=$this->idPrefix?>addFormCheckboxSelectAll">
<input type="checkbox" class="checkbox-select-all" name="selectAll" id="<?=$this->idPrefix?>addFormCheckboxSelectAll"<?php if ($this->formAttr): ?> form="<?=$this->escapeHtmlAttr($this->formAttr) ?>"<?php endif; ?>>
<?=$this->transEsc('select_all_on_page')?>
</label>
</li>
</ul>
<?php
$selectionControlsBar = ob_get_contents();
ob_end_clean();
?>
<?php if ($this->idPrefix === 'bottom_'): ?>
<?=$selectionControlsBar?>
<?=$bulkActionButtons?>
<?php else: ?>
<?=$bulkActionButtons?>
<?=$selectionControlsBar?>
<?php endif; ?>
</nav>
<?php endif; ?>
Loading

0 comments on commit c6a3e98

Please sign in to comment.