Merge pull request #3171 from floriank/fix/20544-ungrouping-impossible

[20544] Add an empty option to grouping menu
pull/3190/head
Jan Sandbrink 9 years ago
commit cfda86b2bf
  1. 1
      config/locales/js-de.yml
  2. 1
      config/locales/js-en.yml
  3. 17
      frontend/app/work_packages/controllers/dialogs/group-by.js
  4. 1
      frontend/app/work_packages/controllers/index.js

@ -399,6 +399,7 @@ de:
btn_preview_enable: "Vorschau"
btn_preview_disable: "Vorschau deaktivieren"
null_value_label: "Kein Wert"
clear_value_label: "-"
errors:
required: '%{field} ist ein Pflichtfeld'
number: '%{field} ist keine gültige Zahl'

@ -402,6 +402,7 @@ en:
btn_preview_enable: "Preview"
btn_preview_disable: "Disable preview"
null_value_label: "No value"
clear_value_label: "-"
errors:
required: '%{field} cannot be empty'
number: '%{field} is not a valid number'

@ -26,11 +26,20 @@
// See doc/COPYRIGHT.rdoc for more details.
//++
module.exports = function($scope, $filter, groupingModal, QueryService, WorkPackagesTableService) {
module.exports = function($scope,
$filter,
groupingModal,
QueryService,
WorkPackagesTableService,
I18n) {
this.name = 'GroupBy';
this.closeMe = groupingModal.deactivate;
var emptyOption = {
title: I18n.t('js.inplace.clear_value_label')
};
$scope.vm = {};
$scope.updateGroupBy = function(){
@ -42,9 +51,11 @@ module.exports = function($scope, $filter, groupingModal, QueryService, WorkPack
$scope.workPackageTableData = WorkPackagesTableService.getWorkPackagesTableData();
$scope.$watch('workPackageTableData.groupableColumns', function(groupableColumns) {
if (!groupableColumns) return;
if (!groupableColumns) {
return;
}
$scope.vm.groupableColumns = [{}].concat(groupableColumns);
$scope.vm.groupableColumns = [emptyOption].concat(groupableColumns);
$scope.vm.selectedColumnName = QueryService.getGroupBy();
});

@ -159,6 +159,7 @@ angular.module('openproject.workPackages.controllers')
'groupingModal',
'QueryService',
'WorkPackagesTableService',
'I18n',
require('./dialogs/group-by')
])
.factory('saveModal', ['btfModal', function(btfModal) {

Loading…
Cancel
Save