Simplify column updates

pull/1302/head
Till Breuer 11 years ago
parent 8e0deec131
commit 8ad36c7f0f
  1. 14
      app/assets/javascripts/angular/helpers/work-packages-table-helper.js
  2. 9
      app/assets/javascripts/angular/services/query-service.js

@ -108,14 +108,6 @@ angular.module('openproject.workPackages.helpers')
});
},
getIncludedColumnNames: function (columns, columnNames) {
return columnNames.filter(function(columnName) {
return columns.map(function(column) {
return column.name;
}).indexOf(columnName) !== -1;
});
},
getColumnIndexByName: function(columns, columnName) {
return columns
.map(function(column){
@ -134,12 +126,6 @@ angular.module('openproject.workPackages.helpers')
});
},
orderColumnsByNames: function(columns, columnNames) {
columns.sort(function(a, b) {
return columnNames.indexOf(a.name) > columnNames.indexOf(b.name) ? 1 : -1;
});
},
mapIdentifiersToColumns: function(columns, columnNames) {
return columnNames.map(function(columnName) {
return WorkPackagesTableHelper.detectColumnByName(columns, columnName);

@ -144,13 +144,8 @@ angular.module('openproject.services')
setSelectedColumns: function(selectedColumnNames) {
var currentColumns = this.getSelectedColumns();
var newSelectedColumnNames = WorkPackagesTableHelper.getIncludedColumnNames(availableUnusedColumns, selectedColumnNames);
var removedColumns = WorkPackagesTableHelper.getColumnDifferenceByName(currentColumns, selectedColumnNames);
this.showColumns(newSelectedColumnNames);
this.hideColumns(removedColumns.map(function(column) { return column.name; }));
WorkPackagesTableHelper.orderColumnsByNames(currentColumns, selectedColumnNames);
this.hideColumns(currentColumns.map(function(column) { return column.name; }));
this.showColumns(selectedColumnNames);
},
getAvailableFilters: function(projectIdentifier){

Loading…
Cancel
Save