// Initialize widgets
$(document)
.on('crmLoad', function(e) {
- $('table.form-layout-compressed')
- .on('change', 'input.select-rows', function () {
- if ($(this).prop('checked')) {
- $('input#toggleSelect:checked').prop('checked', false);
- $('input.select-row:checked').prop('checked', false);
- }
- })
$('table.row-highlight', e.target)
.off('.rowHighlight')
.on('change.rowHighlight', 'input.select-row, input.select-rows', function (e, data) {
if (data !== 'master-selected') {
$('input.select-rows', $table).prop('checked', $(".select-row:not(':checked')", $table).length < 1);
}
- if ($(this).prop('checked')) {
- $('input[value=ts_sel]:radio').prop('checked', true);
- }
}
})
.find('input.select-row:checked').parents('tr').addClass('crm-row-selected');
// http://civicrm.org/licensing
-function countSelectedCheckboxes(fldPrefix, form) {
- fieldCount = 0;
- for (i = 0; i < form.elements.length; i++) {
- fpLen = fldPrefix.length;
- if (form.elements[i].type == 'checkbox' && form.elements[i].name.slice(0, fpLen) == fldPrefix && form.elements[i].checked == true) {
- fieldCount++;
- }
- }
- return fieldCount;
-}
-
(function($, _) {
"use strict";
var form = 'form.crm-search-form';
}
}
+ function countCheckboxes() {
+ $('label[for*=ts_sel] span', form).text($('input.select-row:checked', form).length);
+ }
+
$('#crm-container')
.on('change', '[name=radio_ts], .select-row', toggleTaskMenu)
+ .on('change', 'input.select-row', countCheckboxes)
.on('crmLoad', toggleTaskMenu)
+ .on('click', 'input.select-row, input.select-rows', function() {
+ $(this).closest('form').find('input[name=radio_ts][value=ts_sel]').prop('checked', true);
+ })
.on('change', 'select#task', function() {
$(this).siblings('input[type=submit]').click();
});
<tr>
<td class="font-size11pt"> {ts}Select Records{/ts}:</td>
<td class="nowrap">
- {$form.radio_ts.ts_all.html} <label for="{$ts_all_id}">{ts count=$pager->_totalItems plural='All %count records'}The found record{/ts}</label> {if $pager->_totalItems > 1} {$form.radio_ts.ts_sel.html} <label for="{$ts_sel_id}">{ts}Selected records only{/ts}</label>{/if}
+ {$form.radio_ts.ts_all.html} <label for="{$ts_all_id}">{ts count=$pager->_totalItems plural='All %count records'}The found record{/ts}</label> {if $pager->_totalItems > 1} {$form.radio_ts.ts_sel.html} <label for="{$ts_sel_id}">{ts 1="<span></span>"}%1 Selected records only{/ts}</label>{/if}
</td>
</tr>
<tr>
<tr>
<td class="font-size11pt"> {ts}Select Records{/ts}:</td>
<td class="nowrap">
- {$form.radio_ts.ts_all.html} {ts count=$pager->_totalItems plural='All %count records'}The found record{/ts} {if $pager->_totalItems > 1} {$form.radio_ts.ts_sel.html} {ts}Selected records only{/ts} {/if}
+ {$form.radio_ts.ts_all.html} <label for="{$ts_all_id}">{ts count=$pager->_totalItems plural='All %count records'}The found record{/ts}</label> {if $pager->_totalItems > 1} {$form.radio_ts.ts_sel.html} <label for="{$ts_sel_id}">{ts 1="<span></span>"}%1 Selected records only{/ts}</label>{/if}
</td>
</tr>
<tr>