Skip to content

Commit

Permalink
Use toolbar checkbox to select/deselect testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
RMadjev committed Aug 17, 2020
1 parent dedffff commit 304afaf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions tcms/testplans/static/testplans/js/get.js
Expand Up @@ -30,6 +30,7 @@ $(document).ready(function() {
}
drawTestCases(allTestCases.confirmed, testPlanId, permissions);
treeViewBind();
toolbarEvents();
});

});
Expand Down Expand Up @@ -192,3 +193,18 @@ function attachEvents(testCases, testPlanId, permissions) {
return $(ev.target).closest('.js-testcase-row').data('testcase-pk');
}
}

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

testCaseRows.each(function(index, tc) {
tc.checked = isChecked;
});

testCaseRows.click(function() {
ev.target.checked = false;
});
});
}
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 304afaf

Please sign in to comment.