Browse Source

#381 Add select/deselect all buttons for calendar categories

merge-requests/16/head
Mike Koch 6 years ago
parent
commit
d334c33d31
  1. 6
      admin/calendar.php
  2. 6
      calendar.php
  3. 17
      js/modsForHesk-javascript.js
  4. 2
      language/en/text.php

6
admin/calendar.php

@ -83,11 +83,15 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
<h4><?php echo $hesklang['calendar_categories']; ?></h4>
</div>
<div class="panel-body">
<div class="btn-group">
<button id="select-all" class="btn btn-default" data-select-all="category-toggle"><?php echo $hesklang['select_all_title_case']; ?></button>
<button id="deselect-all" class="btn btn-default" data-deselect-all="category-toggle"><?php echo $hesklang['deselect_all_title_case']; ?></button>
</div>
<ul class="list-unstyled">
<?php foreach ($categories as $category): ?>
<li class="move-down-20 move-right-20">
<div class="checkbox">
<input type="checkbox" name="category-toggle" value="<?php echo $category['id']; ?>" checked>
<input type="checkbox" data-select-target="category-toggle" name="category-toggle" value="<?php echo $category['id']; ?>" checked>
</div>
<span class="label background-volatile category-label" style="<?php echo $category['css_style']; ?>">
<?php echo $category['name']; ?>

6
calendar.php

@ -73,10 +73,14 @@ require_once(HESK_PATH . 'inc/header.inc.php');
</div>
<div class="panel-body">
<ul class="list-unstyled">
<div class="btn-group">
<button id="select-all" class="btn btn-default" data-select-all="category-toggle"><?php echo $hesklang['select_all_title_case']; ?></button>
<button id="deselect-all" class="btn btn-default" data-deselect-all="category-toggle"><?php echo $hesklang['deselect_all_title_case']; ?></button>
</div>
<?php foreach ($categories as $category): ?>
<li class="move-down-20 move-right-20">
<div class="checkbox">
<input type="checkbox" name="category-toggle" value="<?php echo $category['id']; ?>" checked>
<input type="checkbox" data-select-target="category-toggle" name="category-toggle" value="<?php echo $category['id']; ?>" checked>
</div>
<span class="label background-volatile category-label" style="<?php echo $category['css_style']; ?>">
<?php echo $category['name']; ?>

17
js/modsForHesk-javascript.js

@ -70,6 +70,21 @@ var loadJquery = function()
$('.colorpicker-trigger').colorpicker({
format: 'hex'
});
// Generic select/deselect all. Use this instead of selectAll()/deselctAll()
$('[data-select-all]').click(function() {
var toggle = $(this).attr('data-select-all');
$('[data-select-target="' + toggle + '"]').prop('checked', true)
.prop('selected', true)
.trigger('change');
});
$('[data-deselect-all]').click(function() {
var toggle = $(this).attr('data-deselect-all');
$('[data-select-target="' + toggle + '"]').prop('checked', false)
.prop('selected', false)
.trigger('change');
});
};
function calculateGrayCount(background) {
@ -85,10 +100,12 @@ var setIcon = function(icon) {
$('[data-toggle="iconpicker"]').iconpicker('setIcon', icon);
}
// Deprecated. Use data-select-all="id" instead
function selectAll(id) {
$('#' + id + ' option').prop('selected', true);
}
// Deprecated. Use data-deselect-all="id" instead
function deselectAll(id) {
$('#' + id + ' option').prop('selected', false);
}

2
language/en/text.php

@ -105,6 +105,8 @@ $hesklang['tickets_only'] = 'Tickets only';
$hesklang['events_only'] = 'Events only';
$hesklang['events'] = 'Events';
$hesklang['add_files'] = '<i class="fa fa-plus"></i> Add File';
$hesklang['select_all_title_case'] = 'Select All';
$hesklang['deselect_all_title_case'] = 'Deselect All';
// ADDED OR MODIFIED IN Mods for HESK 2.5.2
$hesklang['manage_statuses'] = 'Manage Statuses';

Loading…
Cancel
Save