Skip to content

Commit

Permalink
Merge 7d2d942 into dedffff
Browse files Browse the repository at this point in the history
  • Loading branch information
RMadjev committed Aug 19, 2020
2 parents dedffff + 7d2d942 commit 16744ae
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
27 changes: 27 additions & 0 deletions tcms/testplans/static/testplans/js/get.js
Expand Up @@ -32,6 +32,7 @@ $(document).ready(function() {
treeViewBind();
});

toolbarEvents();
});

function drawTestCases(testCases, testPlanId, permissions) {
Expand Down Expand Up @@ -188,7 +189,33 @@ function attachEvents(testCases, testPlanId, permissions) {
getTestCaseExpandArea(tcRow, testCases[testCaseId]);
});


let inputs = $('.js-testcase-row').find('input');
inputs.click(function(ev) {
const checkbox = $('.js-checkbox-toolbar')[0];

inputs.each(function(index, tc) {
checkbox.checked = tc.checked;

if (!checkbox.checked) {
return false;
}
});
});

function getCaseIdFromEvent(ev) {
return $(ev.target).closest('.js-testcase-row').data('testcase-pk');
}
}

function toolbarEvents() {

$('.js-checkbox-toolbar').click(function(ev){
const isChecked = ev.target.checked;
const testCaseRows = $('.js-testcase-row').find('input');

testCaseRows.each(function(index, tc) {
tc.checked = isChecked;
});
});
}
2 changes: 1 addition & 1 deletion tcms/testplans/templates/testplans/get.html
Expand Up @@ -94,7 +94,7 @@ <h2 class="card-pf-title">
<div class="col-sm-12 toolbar-pf-filter">
<form class="toolbar-pf-actions">
<div class="form-group" style="margin-right:15px; padding-right: 15px;">
<input type="checkbox">
<input type="checkbox" class="js-checkbox-toolbar">
</div>
<div class="form-group toolbar-pf-filter">
<label class="sr-only" for="filter">{% trans 'Name' %}</label>
Expand Down

0 comments on commit 16744ae

Please sign in to comment.