Skip to content

Commit

Permalink
Genericized batch actions js for browse pages.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel-KM authored and Daniel Berthereau committed Jan 3, 2022
1 parent 498f1d2 commit 03d57e2
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion application/asset/js/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ var Omeka = {
},

manageSelectedActions: function() {
var selectedOptions = $('[value="update-selected"], [value="delete-selected"]');
var selectedOptions = $('#batch-form .batch-inputs [data-select=selected]');
if ($('.batch-edit td input[type="checkbox"]:checked').length > 0) {
selectedOptions.removeAttr('disabled');
} else {
Expand Down
14 changes: 7 additions & 7 deletions application/view/omeka/admin/item-set/browse.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,22 @@ $userIsAllowedBatchDelete = $this->userIsAllowed('Omeka\Api\Adapter\ItemSetAdapt
?>
<form method="post" id="batch-form" class="disable-unsaved-warning">
<div class="batch-inputs">
<select class="batch-actions-select" aria-label="<?php echo $translate('Batch actions'); ?>">
<select class="batch-actions-select" name="batch_action" aria-label="<?php echo $translate('Batch actions'); ?>">
<option value="default"><?php echo $translate('Batch actions'); ?></option>
<?php if ($userIsAllowedBatchUpdate): ?>
<option value="update-selected" disabled><?php echo $translate('Edit selected'); ?></option>
<option value="update-all"><?php echo $translate('Edit all'); ?></option>
<option value="update-selected" data-select="selected" disabled><?php echo $translate('Edit selected'); ?></option>
<option value="update-all" data-select="all"><?php echo $translate('Edit all'); ?></option>
<?php endif; ?>
<?php if ($userIsAllowedBatchDelete): ?>
<option value="delete-selected" disabled><?php echo $translate('Delete selected'); ?></option>
<option value="delete-all"><?php echo $translate('Delete all'); ?></option>
<option value="delete-selected" data-select="selected" disabled><?php echo $translate('Delete selected'); ?></option>
<option value="delete-all" data-select="all"><?php echo $translate('Delete all'); ?></option>
<?php endif; ?>
</select>
<div class="batch-actions">
<button type="button" class="default active" disabled><?php echo $translate('Go'); ?></button>
<?php if ($userIsAllowedBatchUpdate): ?>
<input type="submit" class="update-selected" name="update_selected" value="<?php echo $translate('Go'); ?>" formaction="<?php echo $escape($this->url(null, ['action' => 'batch-edit'], true)); ?>">
<input type="submit" class="update-all" name="update_all" value="<?php echo $translate('Go'); ?>" formaction="<?php echo $escape($this->url(null, ['action' => 'batch-edit-all'], true)); ?>">
<input type="submit" class="update-selected" value="<?php echo $translate('Go'); ?>" formaction="<?php echo $escape($this->url(null, ['action' => 'batch-edit'], true)); ?>">
<input type="submit" class="update-all" value="<?php echo $translate('Go'); ?>" formaction="<?php echo $escape($this->url(null, ['action' => 'batch-edit-all'], true)); ?>">
<?php endif; ?>
<input type="hidden" name="query" class="batch-query" value="<?php echo $escape(json_encode($this->params()->fromQuery())); ?>">
<?php if ($userIsAllowedBatchDelete): ?>
Expand Down
14 changes: 7 additions & 7 deletions application/view/omeka/admin/item/browse.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,22 @@ $userIsAllowedBatchDelete = $this->userIsAllowed('Omeka\Api\Adapter\ItemAdapter'
?>
<form method="post" id="batch-form" class="disable-unsaved-warning">
<div class="batch-inputs">
<select class="batch-actions-select" aria-label="<?php echo $translate('Batch actions'); ?>">
<select class="batch-actions-select" name="batch_action" aria-label="<?php echo $translate('Batch actions'); ?>">
<option value="default"><?php echo $translate('Batch actions'); ?></option>
<?php if ($userIsAllowedBatchUpdate): ?>
<option value="update-selected" disabled><?php echo $translate('Edit selected'); ?></option>
<option value="update-all"><?php echo $translate('Edit all'); ?></option>
<option value="update-selected" data-select="selected" disabled><?php echo $translate('Edit selected'); ?></option>
<option value="update-all" data-select="all"><?php echo $translate('Edit all'); ?></option>
<?php endif; ?>
<?php if ($userIsAllowedBatchDelete): ?>
<option value="delete-selected" disabled><?php echo $translate('Delete selected'); ?></option>
<option value="delete-all"><?php echo $translate('Delete all'); ?></option>
<option value="delete-selected" data-select="selected" disabled><?php echo $translate('Delete selected'); ?></option>
<option value="delete-all" data-select="all"><?php echo $translate('Delete all'); ?></option>
<?php endif; ?>
</select>
<div class="batch-actions">
<button type="button" class="default active" disabled><?php echo $translate('Go'); ?></button>
<?php if ($userIsAllowedBatchUpdate): ?>
<input type="submit" class="update-selected" name="update_selected" value="<?php echo $translate('Go'); ?>" formaction="<?php echo $escape($this->url(null, ['action' => 'batch-edit'], true)); ?>">
<input type="submit" class="update-all" name="update_all" value="<?php echo $translate('Go'); ?>" formaction="<?php echo $escape($this->url(null, ['action' => 'batch-edit-all'], true)); ?>">
<input type="submit" class="update-selected" value="<?php echo $translate('Go'); ?>" formaction="<?php echo $escape($this->url(null, ['action' => 'batch-edit'], true)); ?>">
<input type="submit" class="update-all" value="<?php echo $translate('Go'); ?>" formaction="<?php echo $escape($this->url(null, ['action' => 'batch-edit-all'], true)); ?>">
<?php endif; ?>
<input type="hidden" name="query" class="batch-query" value="<?php echo $escape(json_encode($this->params()->fromQuery())); ?>">
<?php if ($userIsAllowedBatchDelete): ?>
Expand Down
14 changes: 7 additions & 7 deletions application/view/omeka/admin/media/browse.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,22 @@ $userIsAllowedBatchDelete = $this->userIsAllowed('Omeka\Api\Adapter\MediaAdapter
?>
<form method="post" id="batch-form" class="disable-unsaved-warning">
<div class="batch-inputs">
<select class="batch-actions-select" aria-label="<?php echo $translate('Batch actions'); ?>">
<select class="batch-actions-select" name="batch_action" aria-label="<?php echo $translate('Batch actions'); ?>">
<option value="default"><?php echo $translate('Batch actions'); ?></option>
<?php if ($userIsAllowedBatchUpdate): ?>
<option value="update-selected" disabled><?php echo $translate('Edit selected'); ?></option>
<option value="update-all"><?php echo $translate('Edit all'); ?></option>
<option value="update-selected" data-select="selected" disabled><?php echo $translate('Edit selected'); ?></option>
<option value="update-all" data-select="all"><?php echo $translate('Edit all'); ?></option>
<?php endif; ?>
<?php if ($userIsAllowedBatchDelete): ?>
<option value="delete-selected" disabled><?php echo $translate('Delete selected'); ?></option>
<option value="delete-all"><?php echo $translate('Delete all'); ?></option>
<option value="delete-selected" data-select="selected" disabled><?php echo $translate('Delete selected'); ?></option>
<option value="delete-all" data-select="all"><?php echo $translate('Delete all'); ?></option>
<?php endif; ?>
</select>
<div class="batch-actions">
<button type="button" class="default active" disabled><?php echo $translate('Go'); ?></button>
<?php if ($userIsAllowedBatchUpdate): ?>
<input type="submit" class="update-selected" name="update_selected" value="<?php echo $translate('Go'); ?>" formaction="<?php echo $escape($this->url(null, ['action' => 'batch-edit'], true)); ?>">
<input type="submit" class="update-all" name="update_all" value="<?php echo $translate('Go'); ?>" formaction="<?php echo $escape($this->url(null, ['action' => 'batch-edit-all'], true)); ?>">
<input type="submit" class="update-selected" value="<?php echo $translate('Go'); ?>" formaction="<?php echo $escape($this->url(null, ['action' => 'batch-edit'], true)); ?>">
<input type="submit" class="update-all" value="<?php echo $translate('Go'); ?>" formaction="<?php echo $escape($this->url(null, ['action' => 'batch-edit-all'], true)); ?>">
<?php endif; ?>
<input type="hidden" name="query" class="batch-query" value="<?php echo $escape(json_encode($this->params()->fromQuery())); ?>">
<?php if ($userIsAllowedBatchDelete): ?>
Expand Down

0 comments on commit 03d57e2

Please sign in to comment.