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 fb6f4de
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
18 changes: 17 additions & 1 deletion tcms/testplans/static/testplans/js/get.js
Expand Up @@ -31,7 +31,8 @@ $(document).ready(function() {
drawTestCases(allTestCases.confirmed, testPlanId, permissions);
treeViewBind();
});


toolbarEvents();
});

function drawTestCases(testCases, testPlanId, permissions) {
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 fb6f4de

Please sign in to comment.