Remove checbkoxes from WP table

pull/5109/head
Oliver Günther 8 years ago
parent 2bf04e0688
commit bdc68134df
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 8
      app/assets/stylesheets/content/work_packages/_table_content.sass
  2. 26
      frontend/app/components/wp-table/wp-table.directive.html
  3. 67
      frontend/app/components/wp-table/wp-table.directive.ts
  4. 1
      package.json

@ -45,6 +45,14 @@
color: $nm-color-error-icon
// Shrink column of details / inline-create icons
.wp-table--details-column
width: 30px
min-width: 30px !important
// Center the th icon
text-align: center !important
// Show details view button when hovering
.wp-table--details-link
.issue:hover &,

@ -14,17 +14,9 @@
</caption>
<thead>
<tr>
<th class="checkbox -short hide-when-print">
<div class="generic-table--header-outer">
<a href
alt="{{ text.toggleRows }}"
class="no-decoration-on-hover"
ng-click="setCheckedStateForAllRows(!(rows | allRowsChecked))"
title="{{ text.toggleRows }}">
<icon-wrapper icon-title="{{ text.toggleRows }}"
icon-name="checkmark"></icon-wrapper>
</a>
<th class="wp-table--details-column">
<div class="generic-table--sort-header-outer">
<span class="icon-button icon-columns icon-small"></span>
</div>
</th>
<th sort-header ng-repeat="column in columns"
@ -114,7 +106,7 @@
ng-class="[
'issue',
'hascontextmenu',
row.checked && 'context-menu-selection',
row.checked && '-checked context-menu-selection',
!row.object['leaf?'] && 'parent' || '',
row.level > 0 && 'child idnt' || '',
row.level > 0 && ('idnt-' + row.level) || '',
@ -128,13 +120,7 @@
wp-edit-form-on-save="onWorkPackageSave(workPackage, fields)"
wp-attachments-formattable
tabindex="-1">
<td ng-if="!row.object.isNew" class="checkbox -short hide-when-print">
<accessible-checkbox name="ids[]"
checkbox-id="work_package{{row.object.id}}"
checkbox-value="row.object.id"
checkbox-title="{{::checkboxTitle}}"
model="row.checked">
</accessible-checkbox>
<td ng-if="!row.object.isNew" class="wp-table--details-column hide-when-print">
<span>
<a class="wp-table--details-link hidden-for-sighted"
ui-state="desiredSplitViewState"
@ -144,7 +130,7 @@
</a>
</span>
</td>
<td ng-if="row.object.isNew" class="cancel-inline-create -short">
<td ng-if="row.object.isNew" class="cancel-inline-create wp-table--details-column">
<span>
<accessible-by-keyboard
execute="cancelInlineWorkPackage($index, row)"

@ -28,6 +28,9 @@
import {scopedObservable} from "../../helpers/angular-rx-utils";
import {KeepTabService} from "../wp-panels/keep-tab/keep-tab.service";
import * as MouseTrap from "mousetrap";
angular
.module('openproject.workPackages.directives')
.directive('wpTable', wpTable);
@ -65,7 +68,7 @@ function wpTable(
link: function(scope, element) {
var activeSelectionBorderIndex;
// Total columns = all available columns + id + checkbox
// Total columns = all available columns + id + action link
scope.numTableColumns = scope.columns.length + 2;
scope.workPackagesTableData = WorkPackagesTableService.getWorkPackagesTableData();
@ -114,6 +117,26 @@ function wpTable(
}
});
// Bind CTRL+A to select all work packages
Mousetrap.bind(['command+a', 'ctrl+a'], function(e) {
scope.$evalAsync(() => {
WorkPackagesTableService.setCheckedStateForAllRows(scope.rows, true);
});
e.preventDefault();
return false;
});
// Bind CTRL+D to deselect all work packages
Mousetrap.bind(['command+d', 'ctrl+d'], function(e) {
scope.$evalAsync(() => {
WorkPackagesTableService.setCheckedStateForAllRows(scope.rows, false);
});
e.preventDefault();
return false;
});
// Set and keep the current details tab state remembered
// for the open-in-details button in each WP row.
scope.desiredSplitViewState = keepTab.currentDetailsState;
@ -205,32 +228,30 @@ function wpTable(
// Thus save that row for the details view button
WorkPackageService.cache().put('preselectedWorkPackageId', row.object.id);
if ($event.target.type != 'checkbox') {
var currentRowCheckState = row.checked;
var multipleChecked = mulipleRowsChecked();
var isLink = angular.element($event.target).is('a');
var currentRowCheckState = row.checked;
var multipleChecked = mulipleRowsChecked();
var isLink = angular.element($event.target).is('a');
if (!($event.ctrlKey || $event.shiftKey)) {
scope.setCheckedStateForAllRows(false);
}
if (!($event.ctrlKey || $event.shiftKey)) {
scope.setCheckedStateForAllRows(false);
}
if(isLink) {
return;
}
if(isLink) {
return;
}
if ($event.shiftKey) {
clearSelection();
activeSelectionBorderIndex = WorkPackagesTableService.selectRowRange(scope.rows, row, activeSelectionBorderIndex);
} else if($event.ctrlKey || $event.metaKey){
setRowSelectionState(row, multipleChecked ? true : !currentRowCheckState);
} else {
setRowSelectionState(row, multipleChecked ? true : !currentRowCheckState);
}
if ($event.shiftKey) {
clearSelection();
activeSelectionBorderIndex = WorkPackagesTableService.selectRowRange(scope.rows, row, activeSelectionBorderIndex);
} else if($event.ctrlKey || $event.metaKey){
setRowSelectionState(row, multipleChecked ? true : !currentRowCheckState);
} else {
setRowSelectionState(row, multipleChecked ? true : !currentRowCheckState);
}
// Avoid bubbling of elements within the details link
if ($event.target.parentElement.className.indexOf('wp-table--details-link') === -1) {
openWhenInSplitView(row.object);
}
// Avoid bubbling of elements within the details link
if ($event.target.parentElement.className.indexOf('wp-table--details-link') === -1) {
openWhenInSplitView(row.object);
}
};

@ -10,6 +10,7 @@
},
"private": true,
"dependencies": {
"@types/mousetrap": "^1.5.32",
"typescript": "^2.0.3"
},
"engines": {

Loading…
Cancel
Save