Merge branch 'dev-angular' into feature/actionmenu-styling

Conflicts:
	app/assets/stylesheets/content/_action_menu_main.sass
pull/1314/head
Till Breuer 11 years ago
commit 9a5cfd63f1
  1. 3
      Gemfile
  2. 8
      Gemfile.lock
  3. 62
      app/assets/javascripts/angular/controllers/dialogs/columns.js
  4. 11
      app/assets/javascripts/angular/controllers/dialogs/share.js
  5. 12
      app/assets/javascripts/angular/controllers/work-packages-controller.js
  6. 5
      app/assets/javascripts/angular/directives/components/selectable-title-directive.js
  7. 70
      app/assets/javascripts/angular/directives/work_packages/column-context-menu-directive.js
  8. 15
      app/assets/javascripts/angular/directives/work_packages/options-dropdown-directive.js
  9. 26
      app/assets/javascripts/angular/directives/work_packages/query-columns-directive.js
  10. 27
      app/assets/javascripts/angular/directives/work_packages/sort-header-directive.js
  11. 19
      app/assets/javascripts/angular/directives/work_packages/work-package-context-menu-directive.js
  12. 32
      app/assets/javascripts/angular/helpers/work-packages-table-helper.js
  13. 10
      app/assets/javascripts/angular/models/query.js
  14. 2
      app/assets/javascripts/angular/models/timelines/mixins/ui.js
  15. 2
      app/assets/javascripts/angular/openproject-app.js
  16. 82
      app/assets/javascripts/angular/services/query-service.js
  17. 33
      app/assets/javascripts/angular/services/work-packages-table-service.js
  18. 3
      app/assets/javascripts/application.js.erb
  19. 12
      app/assets/stylesheets/content/_action_menu_main.sass
  20. 101
      app/assets/stylesheets/content/_context_menu.sass
  21. 2
      app/assets/stylesheets/content/_modal.sass
  22. 2
      app/assets/stylesheets/context_menu_rtl.css
  23. 20
      app/assets/stylesheets/fonts/_openproject_icon_font.sass
  24. 1
      app/assets/stylesheets/global/_variables.sass
  25. 8
      app/assets/stylesheets/select2_customizing.css.erb
  26. 1
      app/controllers/api/v3/queries_controller.rb
  27. 7
      app/controllers/statuses_controller.rb
  28. 9
      app/views/my/page_layout.html.erb
  29. 1
      app/views/work_packages/_list.html.erb
  30. 2
      app/views/work_packages/index.html.erb
  31. 3
      bower.json
  32. 1
      config/locales/de.yml
  33. 1
      config/locales/en.yml
  34. 4
      config/locales/js-de.yml
  35. 6
      config/locales/js-en.yml
  36. 5
      doc/CHANGELOG.md
  37. 2
      features/project_types/project_creation_with_type.feature
  38. 11
      features/session/user_session.feature
  39. 11
      features/step_definitions/my_page_steps.rb
  40. 4
      features/step_definitions/web_steps.rb
  41. 6
      features/work_packages/bulk.feature
  42. 2
      features/work_packages/moves/work_package_moves_new_copy.feature
  43. 2
      karma.conf.js
  44. 8
      karma/tests/controllers/work-packages-controller-test.js
  45. 137
      karma/tests/directives/work_packages/column-context-menu-directive-test.js
  46. 7
      karma/tests/directives/work_packages/work-package-context-menu-directive-test.js
  47. 3
      karma/tests/helpers/work-package-context-menu-helper-test.js
  48. 17
      karma/tests/helpers/work-package-table-helper-test.js
  49. 2
      lib/redmine/menu_manager/top_menu_helper.rb
  50. 6
      public/templates/timelines/toolbar.html
  51. 28
      public/templates/work_packages/column_context_menu.html
  52. 16
      public/templates/work_packages/modals/columns.html
  53. 9
      public/templates/work_packages/modals/share.html
  54. 6
      public/templates/work_packages/query_columns.html
  55. 1
      public/templates/work_packages/sort_header.html
  56. 2
      public/templates/work_packages/work_package_context_menu.html
  57. 10
      public/templates/work_packages/work_packages_table.html
  58. 17
      spec/controllers/statuses_controller_spec.rb
  59. 2
      spec/features/accessibility/work_packages/work_package_query_spec.rb
  60. 40
      spec/views/layouts/base.html.erb_spec.rb

@ -110,8 +110,7 @@ gem 'sprockets-rails', '2.0.0.backport1'
gem 'sass-rails', git: 'https://github.com/guilleiguaran/sass-rails.git', branch: 'backport'
gem 'sass', '~> 3.3.6'
gem 'bourbon', '~> 4.0'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
gem 'uglifier', '>= 1.0.3', require: false
gem 'compass', '1.0.0.alpha.19'
gem 'compass-rails', git: 'https://github.com/Compass/compass-rails'
gem 'livingstyleguide'

@ -110,13 +110,6 @@ GEM
codeclimate-test-reporter (0.1.1)
simplecov (>= 0.7.1, < 1.0.0)
coderay (1.0.9)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.6.2)
color-tools (1.3.0)
columnize (0.8.9)
compass (1.0.0.alpha.19)
@ -393,7 +386,6 @@ DEPENDENCIES
cocaine
codeclimate-test-reporter
coderay (~> 1.0.5)
coffee-rails (~> 3.2.1)
color-tools (~> 1.3.0)
compass (= 1.0.0.alpha.19)
compass-rails!

@ -36,7 +36,67 @@ angular.module('openproject.workPackages.controllers')
});
}])
.controller('ColumnsModalController', ['columnsModal', function(columnsModal) {
.controller('ColumnsModalController', ['$scope',
'$timeout',
'$filter',
'columnsModal',
'QueryService',
'WorkPackageService',
'WorkPackagesTableService',
function($scope, $timeout, $filter, columnsModal, QueryService, WorkPackageService, WorkPackagesTableService) {
this.name = 'Columns';
this.closeMe = columnsModal.deactivate;
$scope.getObjectsData = function(term, result) {
// Note: This relies on the columns having been cached in the service so they can be instantly available.
result($filter('filter')($scope.availableColumnsData, {label: term}));
};
// Data conversion for select2
function convertColumnsForSelect2(columns) {
return columns.map(function(column){
return { id: column.name, label: column.title, other: column.title };
})
}
function getColumnIdentifiersFromSelection(selectedColumnsData) {
return selectedColumnsData.map(function(column) { return column.id; })
}
// Selected Columns
var selectedColumns = QueryService.getSelectedColumns();
var previouslySelectedColumnNames = selectedColumns
.map(function(column){ return column.name; });
function getNewlyAddedColumns() {
return selectedColumns.select(function(column){
return previouslySelectedColumnNames.indexOf(column.name) < 0;
});
}
$scope.selectedColumnsData = convertColumnsForSelect2(selectedColumns);
// Available selectable Columns
QueryService.loadAvailableUnusedColumns()
.then(function(availableUnusedColumns){
$scope.availableUnusedColumns = availableUnusedColumns;
$scope.availableColumnsData = convertColumnsForSelect2(availableUnusedColumns);
});
$scope.updateSelectedColumns = function(){
// Note: Can't directly manipulate selected columns because select2 returns a new array when you change the values:(
QueryService.setSelectedColumns(getColumnIdentifiersFromSelection($scope.selectedColumnsData));
// Augment work packages with new columns data
var addedColumns = getNewlyAddedColumns(),
currentWorkPackages = WorkPackagesTableService.getRowsData(),
groupBy = WorkPackagesTableService.getGroupBy();
if(groupBy.length === 0) groupBy = undefined; // don't pass an empty string as groupBy
if(addedColumns.length) WorkPackageService.augmentWorkPackagesWithColumnsData(currentWorkPackages, addedColumns, groupBy);
columnsModal.deactivate();
}
}]);

@ -36,7 +36,16 @@ angular.module('openproject.workPackages.controllers')
});
}])
.controller('ShareModalController', ['shareModal', function(shareModal) {
.controller('ShareModalController', ['$scope', 'shareModal', 'QueryService', function($scope, shareModal, QueryService) {
this.name = 'Share';
this.closeMe = shareModal.deactivate;
$scope.query = QueryService.getQuery();
$scope.saveQuery = function() {
QueryService.saveQuery()
.then(function(data){
shareModal.deactivate();
$scope.$emit('flashMessage', data.status);
});
}
}]);

@ -33,7 +33,6 @@ angular.module('openproject.workPackages.controllers')
'$q',
'$window',
'$location',
'WorkPackagesTableHelper',
'WorkPackagesTableService',
'WorkPackageService',
'QueryService',
@ -41,8 +40,7 @@ angular.module('openproject.workPackages.controllers')
'WorkPackageLoadingHelper',
'INITIALLY_SELECTED_COLUMNS',
'OPERATORS_AND_LABELS_BY_FILTER_TYPE',
function($scope, $q, $window, $location,
WorkPackagesTableHelper, WorkPackagesTableService,
function($scope, $q, $window, $location, WorkPackagesTableService,
WorkPackageService, QueryService, PaginationService,
WorkPackageLoadingHelper, INITIALLY_SELECTED_COLUMNS,
OPERATORS_AND_LABELS_BY_FILTER_TYPE) {
@ -115,7 +113,8 @@ angular.module('openproject.workPackages.controllers')
// table data
WorkPackagesTableService.setColumns($scope.query.columns);
WorkPackagesTableService.addColumnMetaData(meta);
WorkPackagesTableService.setRows(WorkPackagesTableHelper.getRows(workPackages, $scope.query.groupBy));
WorkPackagesTableService.setGroupBy($scope.query.groupBy);
WorkPackagesTableService.buildRows(workPackages, $scope.query.groupBy);
WorkPackagesTableService.setBulkLinks(bulkLinks);
// query data
@ -139,10 +138,9 @@ angular.module('openproject.workPackages.controllers')
}
function initAvailableColumns() {
return QueryService.getAvailableColumns($scope.projectIdentifier)
return QueryService.loadAvailableUnusedColumns($scope.projectIdentifier)
.then(function(data){
$scope.availableColumns = WorkPackagesTableHelper.getColumnDifference(data.available_columns, $scope.columns);
return $scope.availableColumns;
$scope.availableUnusedColumns = data;
});
}

@ -44,6 +44,11 @@ angular.module('openproject.uiComponents')
scope.filteredGroups = angular.copy(scope.groups);
});
angular.element('#title-filter').bind('click', function(event) {
event.preventDefault();
event.stopPropagation();
});
scope.reload = function(modelId, newTitle) {
scope.selectedTitle = newTitle;
scope.reloadMethod(modelId);

@ -0,0 +1,70 @@
angular.module('openproject.workPackages.directives')
.directive('columnContextMenu', [
'ContextMenuService',
'I18n',
'QueryService',
'WorkPackagesTableHelper',
'WorkPackagesTableService',
function(ContextMenuService, I18n, QueryService, WorkPackagesTableHelper, WorkPackagesTableService) {
return {
restrict: 'EA',
replace: true,
scope: {},
templateUrl: '/templates/work_packages/column_context_menu.html',
link: function(scope, element, attrs) {
var contextMenuName = 'columnContextMenu';
// Wire up context menu handlers
ContextMenuService.registerMenuElement(contextMenuName, element);
scope.contextMenu = ContextMenuService.getContextMenu();
scope.$watch('contextMenu.opened', function(opened) {
scope.opened = opened && scope.contextMenu.targetMenu === contextMenuName;
});
scope.$watch('contextMenu.targetMenu', function(target) {
scope.opened = scope.contextMenu.opened && target === contextMenuName;
});
// shared context information
scope.$watch('contextMenu.context.column', function(column) {
scope.column = column;
});
scope.$watch('contextMenu.context.columns', function(columns) {
scope.columns = columns;
});
scope.I18n = I18n;
// context menu actions
scope.groupBy = function(columnName) {
QueryService.getQuery().groupBy = columnName;
};
scope.sortAscending = function(columnName) {
WorkPackagesTableService.sortBy(columnName, 'asc');
};
scope.sortDescending = function(columnName) {
WorkPackagesTableService.sortBy(columnName, 'desc');
};
scope.moveLeft = function(columnName) {
WorkPackagesTableHelper.moveColumnBy(scope.columns, columnName, -1);
};
scope.moveRight = function(columnName) {
WorkPackagesTableHelper.moveColumnBy(scope.columns, columnName, 1);
};
scope.hideColumn = function(columnName) {
QueryService.hideColumns(new Array(columnName));
};
}
};
}]);

@ -35,12 +35,17 @@ angular.module('openproject.workPackages.directives')
'settingsModal',
'shareModal',
'sortingModal',
function(I18n, columnsModal, exportModal, saveModal, settingsModal, shareModal, sortingModal){
'QueryService',
'$window',
function(I18n, columnsModal, exportModal, saveModal, settingsModal, shareModal, sortingModal, QueryService, $window){
return {
restrict: 'AE',
scope: true,
link: function(scope, element, attributes) {
angular.element($window).bind('click', function() {
scope.$emit('hideAllDropdowns');
});
// Modals
scope.showColumnsModal = columnsModal.activate;
@ -61,9 +66,15 @@ angular.module('openproject.workPackages.directives')
}
};
scope.showColumnsModal = function(){
scope.$emit('hideAllDropdowns');
columnsModal.activate();
};
scope.toggleDisplaySums = function(){
scope.$emit('hideAllDropdowns');
scope.query.displaySums = !scope.query.displaySums;
}
};
}
};
}]);

@ -28,7 +28,11 @@
angular.module('openproject.workPackages.directives')
.directive('queryColumns', ['WorkPackagesTableHelper', 'WorkPackageService', function(WorkPackagesTableHelper, WorkPackageService) {
.directive('queryColumns', [
'WorkPackagesTableHelper',
'WorkPackageService',
'QueryService',
function(WorkPackagesTableHelper, WorkPackageService, QueryService) {
return {
restrict: 'E',
@ -37,14 +41,14 @@ angular.module('openproject.workPackages.directives')
compile: function(tElement) {
return {
pre: function(scope) {
scope.moveColumns = function (columnNames, fromColumns, toColumns, requires_extension) {
angular.forEach(columnNames, function(columnName){
removeColumn(columnName, fromColumns, function(removedColumn){
toColumns.push(removedColumn);
});
});
scope.showColumns = function(columnNames) {
QueryService.showColumns(columnNames);
extendRowsWithColumnData(columnNames); // TODO move to QueryService
};
if (requires_extension) extendRowsWithColumnData(columnNames);
scope.hideColumns = function(columnNames) {
QueryService.hideColumns(columnNames);
};
scope.moveSelectedColumnBy = function(by) {
@ -52,6 +56,7 @@ angular.module('openproject.workPackages.directives')
WorkPackagesTableHelper.moveColumnBy(scope.columns, nameOfColumnToBeMoved, by);
};
// TODO move to WorkPackagesService
function extendRowsWithColumnData(columnNames) {
var workPackages = scope.rows.map(function(row) {
return row.object;
@ -64,11 +69,6 @@ angular.module('openproject.workPackages.directives')
scope.withLoading(WorkPackageService.augmentWorkPackagesWithColumnsData, params)
.then(scope.updateBackUrl);
}
function removeColumn(columnName, columns, callback) {
var removed = columns.splice(WorkPackagesTableHelper.getColumnIndexByName(columns, columnName), 1).first();
return !(typeof(callback) === 'undefined') ? callback.call(this, removed) : null;
}
}
};
}

@ -33,6 +33,7 @@ angular.module('openproject.workPackages.directives')
return {
restrict: 'A',
templateUrl: '/templates/work_packages/sort_header.html',
transclude: true,
scope: {
query: '=',
headerName: '=',
@ -41,29 +42,35 @@ angular.module('openproject.workPackages.directives')
locale: '='
},
link: function(scope, element, attributes) {
scope.$watch('query.sortation.sortElements', function(newValue, oldValue){
if (scope.headerName != newValue[0].field) scope.currentSortDirection = null;
scope.$watch('query.sortation.sortElements', function(sortElements){
var latestSortElement = sortElements[0];
if (scope.headerName !== latestSortElement.field) {
scope.currentSortDirection = null;
} else {
scope.currentSortDirection = latestSortElement.direction;
}
setFullTitle();
}, true);
scope.performSort = function(){
targetSortation = scope.query.sortation.getTargetSortationOfHeader(scope.headerName);
var targetSortation = scope.query.sortation.getTargetSortationOfHeader(scope.headerName);
scope.query.setSortation(targetSortation);
scope.currentSortDirection = scope.query.sortation.getDisplayedSortDirectionOfHeader(scope.headerName);
scope.setFullTitle();
};
scope.setFullTitle = function(){
function setFullTitle() {
if(!scope.sortable) scope.fullTitle = '';
if(scope.currentSortDirection){
if(scope.currentSortDirection) {
var sortDirectionText = (scope.currentSortDirection == 'asc') ? I18n.t('js.label_ascending') : I18n.t('js.label_descending');
scope.fullTitle = sortDirectionText + " " + I18n.t('js.label_sorted_by') + ' \"' + scope.headerTitle + '\"';
} else {
scope.fullTitle = (I18n.t('js.label_sort_by') + ' \"' + scope.headerTitle + '\"');
}
};
scope.currentSortDirection = scope.query.sortation.getDisplayedSortDirectionOfHeader(scope.headerName);
scope.setFullTitle();
}
}
};
}]);

@ -15,20 +15,25 @@ angular.module('openproject.workPackages.directives')
scope: {},
templateUrl: '/templates/work_packages/work_package_context_menu.html',
link: function(scope, element, attrs) {
var contextMenuName = 'workPackageContextMenu';
scope.I18n = I18n;
scope.opened = false;
// wire up context menu event handler
ContextMenuService.setTarget(element);
ContextMenuService.registerMenuElement(contextMenuName, element);
scope.contextMenu = ContextMenuService.getContextMenu();
scope.$watch('contextMenu.opened', function(opened) {
scope.opened = opened;
scope.opened = opened && scope.contextMenu.targetMenu === contextMenuName;
});
scope.$watch('contextMenu.targetMenu', function(target) {
scope.opened = scope.contextMenu.opened && target === contextMenuName;
});
scope.$watch('contextMenu.context.row', function() {
updateContextMenu(getWorkPackagesFromContext(scope.contextMenu.context));
scope.$watch('contextMenu.context.row', function(row) {
if (row && scope.contextMenu.targetMenu === contextMenuName) {
updateContextMenu(getWorkPackagesFromContext(scope.contextMenu.context));
}
});
scope.triggerContextMenuAction = function(action, link) {
@ -53,8 +58,6 @@ angular.module('openproject.workPackages.directives')
});
WorkPackagesTableService.removeRows(rows);
// TODO remove via a controller linked to the work packages row
// Remark: This controller has to be forwarded by the hasContextMenu directive somehow
})
.error(function(data, status) {
// TODO wire up to API and processs API response

@ -31,7 +31,7 @@ angular.module('openproject.workPackages.helpers')
.factory('WorkPackagesTableHelper', ['WorkPackagesHelper', function(WorkPackagesHelper) {
var WorkPackagesTableHelper = {
/* builds rows from work packages, see IssuesHelper */
getRows: function(workPackages, groupBy) {
buildRows: function(workPackages, groupBy) {
var rows = [], ancestors = [];
var currentGroup, allGroups = [], groupIndex = -1;
@ -89,16 +89,16 @@ angular.module('openproject.workPackages.helpers')
},
getColumnDifference: function (allColumns, columns) {
var columnValues = columns.map(function(column){
var identifiers = columns.map(function(column){
return column.name;
});
return this.getColumnDifferenceByName(allColumns, columnValues);
return this.getColumnDifferenceByName(allColumns, identifiers);
},
getColumnDifferenceByName: function (allColumns, columnValues) {
getColumnDifferenceByName: function (allColumns, identifiers) {
return allColumns.filter(function(column) {
return columnValues.indexOf(column.name) === -1;
return identifiers.indexOf(column.name) === -1;
});
},
@ -126,12 +126,18 @@ angular.module('openproject.workPackages.helpers')
});
},
mapIdentifiersToColumns: function(columns, columnNames) {
return columnNames.map(function(columnName) {
return WorkPackagesTableHelper.detectColumnByName(columns, columnName);
});
},
moveElementBy: function(array, index, positions) {
// TODO maybe extend the Array prototype
var newPosition = index + positions;
if (newPosition > -1 && newPosition < array.length) {
var elementToMove = array.splice(index, 1).first();
var elementToMove = array.splice(index, 1)[0];
array.splice(newPosition, 0, elementToMove);
}
},
@ -142,6 +148,20 @@ angular.module('openproject.workPackages.helpers')
WorkPackagesTableHelper.moveElementBy(columns, index, by);
},
moveColumns: function (columnNames, fromColumns, toColumns) {
angular.forEach(columnNames, function(columnName){
WorkPackagesTableHelper.removeColumn(columnName, fromColumns, function(removedColumn){
toColumns.push(removedColumn);
});
});
},
removeColumn: function(columnName, columns, callback) {
var removed = columns.splice(this.getColumnIndexByName(columns, columnName), 1)[0];
return typeof(callback) !== 'undefined' ? callback.call(this, removed) : null;
},
getSelectedRows: function(rows) {
return rows
.filter(function(row) {

@ -58,7 +58,8 @@ angular.module('openproject.models')
'group_by': this.groupBy,
'sort': this.sortation.encode(),
'display_sums': this.displaySums,
'name': this.name
'name': this.name,
'is_public': this.isPublic
}].concat(this.getActiveConfiguredFilters().map(function(filter) {
return filter.toParams();
}))
@ -73,7 +74,8 @@ angular.module('openproject.models')
'c[]': this.getParamColumns(),
'group_by': this.groupBy,
'sort': this.sortation.encode(),
'display_sums': this.displaySums
'display_sums': this.displaySums,
'is_public': this.isPublic
}].concat(this.getActiveConfiguredFilters().map(function(filter) {
return filter.toParams();
}))
@ -162,6 +164,10 @@ angular.module('openproject.models')
});
},
getSelectedColumns: function(){
return this.columns;
},
getParamColumns: function(){
var selectedColumns = this.columns.map(function(column) {
return column.name;

@ -819,7 +819,7 @@ angular.module('openproject.timelines.models')
})
).attr({
'stroke': 'red',
'stroke-dasharray': '- '
'stroke-dasharray': '3,3'
});
var setDateTime = 5 * 60 * 1000;

@ -57,7 +57,7 @@ angular.module('openproject.timeEntries', ['openproject.timeEntries.controllers'
angular.module('openproject.timeEntries.controllers', []);
// main app
var openprojectApp = angular.module('openproject', ['ui.select2', 'ui.date', 'openproject.uiComponents', 'openproject.timelines', 'openproject.workPackages', 'openproject.messages', 'openproject.timeEntries', 'ngAnimate', 'ngSanitize']);
var openprojectApp = angular.module('openproject', ['ui.select2', 'ui.select2.sortable', 'ui.date', 'openproject.uiComponents', 'openproject.timelines', 'openproject.workPackages', 'openproject.messages', 'openproject.timeEntries', 'ngAnimate', 'ngSanitize']);
window.appBasePath = jQuery('meta[name=app_base_path]').attr('content') || '';

@ -28,12 +28,32 @@
angular.module('openproject.services')
.service('QueryService', ['Query', 'Sortation', '$http', '$location', 'PathHelper', '$q', 'AVAILABLE_WORK_PACKAGE_FILTERS', 'StatusService', 'TypeService', 'PriorityService', 'UserService', 'VersionService', 'RoleService', 'GroupService', 'ProjectService', 'I18n',
function(Query, Sortation, $http, $location, PathHelper, $q, AVAILABLE_WORK_PACKAGE_FILTERS, StatusService, TypeService, PriorityService, UserService, VersionService, RoleService, GroupService, ProjectService, I18n) {
.service('QueryService', [
'Query',
'Sortation',
'$http',
'$location',
'PathHelper',
'$q',
'AVAILABLE_WORK_PACKAGE_FILTERS',
'StatusService',
'TypeService',
'PriorityService',
'UserService',
'VersionService',
'RoleService',
'GroupService',
'ProjectService',
'WorkPackagesTableHelper',
'I18n',
function(Query, Sortation, $http, $location, PathHelper, $q, AVAILABLE_WORK_PACKAGE_FILTERS, StatusService, TypeService, PriorityService, UserService, VersionService, RoleService, GroupService, ProjectService, WorkPackagesTableHelper, I18n) {
var query;
var availableColumns = [], availableFilterValues = {}, availableFilters = {};
var availableColumns = [],
availableUnusedColumns = [],
availableFilterValues = {},
availableFilters = {};
var totalEntries;
@ -47,7 +67,8 @@ angular.module('openproject.services')
groupSums: queryData.group_sums,
sums: queryData.sums,
columns: selectedColumns,
groupBy: queryData.group_by
groupBy: queryData.group_by,
isPublic: queryData.is_public
});
query.setSortation(new Sortation(queryData.sort_criteria));
@ -79,6 +100,18 @@ angular.module('openproject.services')
return totalEntries;
},
getAvailableUnusedColumns: function() {
return availableUnusedColumns;
},
hideColumns: function(columnNames) {
WorkPackagesTableHelper.moveColumns(columnNames, this.getSelectedColumns(), availableColumns);
},
showColumns: function(columnNames) {
WorkPackagesTableHelper.moveColumns(columnNames, availableColumns, this.getSelectedColumns());
},
// data loading
getAvailableGroupedQueries: function(projectIdentifier) {
@ -87,10 +120,41 @@ angular.module('openproject.services')
return QueryService.doQuery(url);
},
getAvailableColumns: function(projectIdentifier) {
loadAvailableUnusedColumns: function(projectIdentifier) {
if(availableUnusedColumns.length) {
return $q.when(availableUnusedColumns);
}
return QueryService.loadAvailableColumns(projectIdentifier)
.then(function(available_columns) {
availableUnusedColumns = WorkPackagesTableHelper.getColumnDifference(available_columns, QueryService.getSelectedColumns());
return availableUnusedColumns;
});
},
loadAvailableColumns: function(projectIdentifier) {
// TODO: Once we have a single page app we need to differentiate between different project columns
if(availableColumns.length) {
return $q.when(availableColumns);
}
var url = projectIdentifier ? PathHelper.apiProjectAvailableColumnsPath(projectIdentifier) : PathHelper.apiAvailableColumnsPath();
return QueryService.doQuery(url);
return QueryService.doGet(url, function(response){
availableColumns = response.data.available_columns;
return availableColumns;
});
},
getSelectedColumns: function() {
return this.getQuery().getSelectedColumns();
},
setSelectedColumns: function(selectedColumnNames) {
var currentColumns = this.getSelectedColumns();
this.hideColumns(currentColumns.map(function(column) { return column.name; }));
this.showColumns(selectedColumnNames);
},
getAvailableFilters: function(projectIdentifier){
@ -193,6 +257,8 @@ angular.module('openproject.services')
return availableFilters[projectIdentifier];
},
// synchronization
saveQuery: function() {
var url = PathHelper.apiProjectQueryPath(query.project_id, query.id);
return QueryService.doQuery(url, query.toUpdateParams(), 'PUT', function(response){
@ -209,6 +275,10 @@ angular.module('openproject.services')
});
},
doGet: function(url, success, failure) {
return QueryService.doQuery(url, null, 'GET', success, failure);
},
doQuery: function(url, params, method, success, failure) {
method = method || 'GET';
success = success || function(response){

@ -28,7 +28,11 @@
angular.module('openproject.workPackages.services')
.service('WorkPackagesTableService', ['$filter', function($filter) {
.service('WorkPackagesTableService', [
'$filter',
'QueryService',
'WorkPackagesTableHelper',
function($filter, QueryService, WorkPackagesTableHelper) {
var workPackagesTableData = {
allRowsChecked: false
};
@ -74,13 +78,32 @@ angular.module('openproject.workPackages.services')
return workPackagesTableData.groupableColumns;
},
buildRows: function(workPackages, groupBy) {
this.setRows(WorkPackagesTableHelper.buildRows(workPackages, groupBy));
},
setRows: function(rows) {
workPackagesTableData.rows = rows;
},
getRows: function() {
return workPackagesTableData.rows;
},
getRowsData: function() {
return WorkPackagesTableService.getRows().map(function(row) {
return row.object;
});
},
getGroupBy: function() {
return workPackagesTableData.groupBy;
},
setGroupBy: function(groupBy) {
workPackagesTableData.groupBy = groupBy;
},
removeRow: function(row) {
var rows = workPackagesTableData.rows;
var index = rows.indexOf(row);
@ -91,8 +114,14 @@ angular.module('openproject.workPackages.services')
angular.forEach(rows, function(row) {
WorkPackagesTableService.removeRow(row);
});
}
},
sortBy: function(columnName, direction) {
QueryService.getQuery().sortation.addSortElement({
field: columnName,
direction: direction
});
}
};
return WorkPackagesTableService;

@ -20,7 +20,7 @@
//= require momentjs/lang/de.js
//= require jquery.atwho/dist/js/jquery.atwho.js
//= require Caret.js/src/jquery.caret
//= require Caret.js/src/jquery.caret.js
//= require jquery_noconflict
//= require prototype
//= require effects
@ -57,6 +57,7 @@
//= require angular-animate
//= require angular-modal
//= require angular-ui-select2
//= require angular-ui-select2-sortable
//= require angular-ui-date/src/date
//= require angular-sanitize

@ -25,18 +25,18 @@
*
* See doc/COPYRIGHT.rdoc for more details. ++
*/
.action-menu
ul
list-style-type: none
margin: 0
width: 200px
border: 1px solid #dddddd
box-shadow: 1px 1px 4px #cccccc
padding: 3px 0
background: #ffffff
li
padding: 4px 13px 4px 10px
&:hover
@ -51,7 +51,7 @@
&:hover ul
display: block
margin: -28px 0 0 190px
a
color: $main_menu_font_color
font-weight: normal
@ -59,11 +59,11 @@
text-decoration: none
ul
display: none
position: absolute
position: absolute
.icon-action-menu
@include icon-action-menu-rules
.icon-sub-menu
@include icon-sub-menu-rules

@ -34,106 +34,9 @@
padding: 0
border: 0
#context-menu
position: absolute
font-size: 0.9em
left: -7px
top: -7px
padding: 6px
z-index: 21
ul
@include context_menu_defaults
width: 140px
list-style: none
#work-package-context-menu, #column-context-menu
&.action-menu
position: absolute
left: -7px
z-index: 20
background: #f4f4f4
border: 1px solid #afafaf
li
@include context_menu_defaults
position: relative
padding: 1px
padding: 6px
z-index: 39
border: 1px solid white
background-position: 6px center
background-repeat: no-repeat
cursor: pointer
border-top: 1px solid #fff
border-bottom: 1px solid #ddd
> a
width:auto
&:hover
border: 1px solid gray
background-color: #eee
&.folder
&:hover
z-index: 40
div.submenu
background: url(image-path('arrow-right.png')) no-repeat right
position: absolute
height: 9px
width: 7px
top: 11px
right: 6px
ul
display: none
position: absolute
max-height: 400px
overflow-x: hidden
overflow-y: auto
left: 140px
top: -1px
width: auto
z-index: 19
a
@include context_menu_defaults
border: none
background-repeat: no-repeat
background-position: 1px 50%
padding: 1px 10px 1px 15px
width: 100%
&.icon, &.icon-context
color: $content_icon_link_hover_color
font-weight: bold
padding-left: 0
&.disabled, &.disabled:hover
color: #ccc
&:hover
color: #2A5685
border: none
text-decoration: none
&.reverse-y li.folder>ul
top: auto
bottom: 0
&.reverse-x li.folder
ul
left: auto
right: 168px
>ul
right: 148px
#context-menu ul ul, #context-menu li:hover ul ul
display: none
#context-menu li:hover ul, #context-menu li:hover li:hover ul
display: block
#context-menu li li
padding: 6px 12px
width: auto
display: block
white-space: nowrap
#context-menu li:hover ul
display: block
.hascontextmenu
cursor: context-menu

@ -14,7 +14,7 @@ $ng-modal-image-width: $ng-modal-image-height
+position(fixed, 0px 0px 0px 0px)
background: rgba(0, 0, 0, 0.2)
text-align: left
z-index: 99999999999
z-index: 10000
.ng-modal-bg
+position(absolute, 0px 0px 0px 0px)

@ -27,6 +27,8 @@ See doc/COPYRIGHT.rdoc for more details.
++*/
/* FIXME adapt modifications to the new action-menu component */
#context-menu li.folder ul { left:auto; right:168px; }
#context-menu li.folder>ul { left:auto; right:148px; }
#context-menu li a.submenu { background:url("../images/bullet_arrow_left.png") left no-repeat; }

@ -65,11 +65,11 @@
@mixin icon6-rules
padding: 0 7px 0 9px
font-size: 12px
@mixin icon-dropdown-rules
padding: 0 0px 0 3px
font-size: 13px
@mixin icon-button-rules
padding: 0 5px 0 0px
font-size: 13px
@ -77,7 +77,7 @@
@mixin icon-context-rules
padding: 0 4px 0 0
color: $content_icon_color
@mixin icon-table-rules
padding: 0 0 0 0
@ -118,17 +118,17 @@
@include icon-common
content: attr(data-icon5)
@include icon5-rules
[data-icon-dropwdown]:before
@include icon-common
content: attr(data-icon-dropdown)
@include icon-dropdown-rules
[data-icon-button]:before
@include icon-common
content: attr(data-icon-button)
@include icon-button-rules
[data-icon-table]:before
@include icon-common
content: attr(data-icon-table)
@ -168,15 +168,15 @@
// used for toggler icons in the project menu
.icon6:before
@include icon6-rules
// used for arrow icons in buttons with dropdown
.icon-dropdown:before
@include icon-dropdown-rules
// used for icons in buttons
.icon-buttons:before
@include icon-button-rules
// used for icons in workpackage table
.icon-table:before
@include icon-table-rules
@ -187,7 +187,7 @@
float: left
// used for icons in the content area, which appear in context (menus)
#context-menu .icon:before,
.action-menu .icon:before,
.icon-context:before
@include icon-context-rules

@ -163,3 +163,4 @@ $content_box_border: 1px solid #EAEAEA !default
$content_box_bg_color: #FFFFFF !default
$my_page_edit_box_border_color: #06799F !default
$action_menu_bg_color: #FFFFFF

@ -115,3 +115,11 @@ See doc/COPYRIGHT.rdoc for more details.
color: #fff;
font-weight: bold;
}
.select2-drop {
z-index: 30001;
}
.select2-drop-mask {
z-index: 30000;
}

@ -122,6 +122,7 @@ module Api::V3
@query.column_names = params[:c] if params[:c]
@query.column_names = nil if params[:default_columns]
@query.name = params[:name] if params[:name]
@query.is_public = params[:is_public] if params[:is_public]
end
def visible_queries

@ -76,7 +76,12 @@ class StatusesController < ApplicationController
verify :method => :delete, :only => :destroy, :render => {:nothing => true, :status => :method_not_allowed }
def destroy
Status.find(params[:id]).destroy
status = Status.find(params[:id])
if status.is_default?
flash[:error] = l(:error_unable_delete_default_status)
else
status.destroy
end
redirect_to :action => 'index'
rescue
flash[:error] = l(:error_unable_delete_status)

@ -42,9 +42,11 @@ function recreateSortables() {
function updateSelect() {
s = $('block-select')
for (var i = 0; i < s.options.length; i++) {
if ($('block_' + s.options[i].value)) {
var block = $('block_' + s.options[i].value);
if (block && block.visible()) {
s.options[i].disabled = true;
} else {
if (block) { block.remove(); }
s.options[i].disabled = false;
}
}
@ -57,8 +59,9 @@ function afterAddBlock() {
}
function removeBlock(block) {
Effect.DropOut(block);
updateSelect();
Effect.DropOut(block,{ 'afterFinish':function(){
updateSelect();
}});
}
//]]>
</script>

@ -56,6 +56,7 @@ See doc/COPYRIGHT.rdoc for more details.
</modal-loading>
<work-package-context-menu></work-package-context-menu>
<column-context-menu></column-context-menu>
</div>
<% end -%>

@ -86,7 +86,7 @@ end
<li><a href ng-click="showSaveModal()">Save</a></li>
<li><a href ng-click="showSaveModal(true)">Save as</a></li>
<li><a href ng-click="showExportModal()">Export</a></li>
<li><a href ng-click="showShareModal()">Share</a></li>
<li ng-show="!query.isNew()"><a href ng-click="showShareModal()">Share</a></li>
<li><a href ng-click="showSettingsModal()">Page settings</a></li>
</ul>
</div>

@ -11,13 +11,14 @@
"angular": "~1.2.14",
"angular-animate": "~1.2.14",
"angular-ui-select2": "latest",
"angular-ui-select2-sortable": "latest",
"angular-ui-date": "latest",
"angular-i18n": "~1.3.0",
"angular-modal": "~0.3.0",
"angular-sanitize": "~1.2.14",
"jquery-migrate": "~1.2.1",
"momentjs": "~2.6.0",
"ng-context-menu": "finnlabs/ng-context-menu#customized"
"ng-context-menu": "finnlabs/ng-context-menu#context-sharing-with-multiple-targets"
},
"devDependencies": {
"mocha": "~1.14.0",

@ -535,6 +535,7 @@ de:
error_scm_command_failed: "Beim Zugriff auf das Projektarchiv ist ein Fehler aufgetreten: %{value}"
error_scm_not_found: "Eintrag und/oder Revision existiert nicht im Projektarchiv."
error_unable_delete_status: "Der Ticket-Status konnte nicht gelöscht werden."
error_unable_delete_default_status: "Der Arbeitspaket-Status konnte nicht gelöscht werden, da dieser als Standard-Status markiert ist. Wählen Sie bitte zunächst einen anderen Arbeitspaket-Status als Standard-Status."
error_unable_to_connect: "Fehler beim Verbinden (%{value})"
error_workflow_copy_source: "Bitte wählen Sie einen Quell-Typ und eine Quell-Rolle."
error_workflow_copy_target: "Bitte wählen Sie die Ziel-Typ und -Rollen."

@ -532,6 +532,7 @@ en:
error_scm_command_failed: "An error occurred when trying to access the repository: %{value}"
error_scm_not_found: "The entry or revision was not found in the repository."
error_unable_delete_status: "Unable to delete work package status"
error_unable_delete_default_status: "Unable to delete default work package status. Please select another default work package status before deleting the current one."
error_unable_to_connect: "Unable to connect (%{value})"
error_workflow_copy_source: "Please select a source type or role"
error_workflow_copy_target: "Please select target type(s) and role(s)"

@ -69,6 +69,7 @@ de:
label_expanded: "aufgeklappt"
label_expand_all: "Alle aufklappen"
label_greater_or_equal: ">="
label_hide_column: "Spalte ausblenden"
label_in: "an"
label_in_less_than: "in weniger als"
label_in_more_than: "in mehr als"
@ -78,10 +79,13 @@ de:
label_menu_collapse: "ausblenden"
label_menu_expand: "einblenden"
label_more_than_ago: "vor mehr als"
label_move_column_left: "Spalte nach links verschieben"
label_move_column_right: "Spalte nach rechts verschieben"
label_no_data: "Nichts anzuzeigen"
label_none: "kein"
label_not_contains: "enthält nicht"
label_not_equals: "ist nicht"
label_open_menu: "Menü öffnen"
label_open_work_packages: "offen"
label_remove_columns: "Ausgewählte Spalten entfernen"
label_sort_by: "Sortiere nach"

@ -64,12 +64,12 @@ en:
label_collapsed: "collapsed"
label_collapse_all: "Collapse all"
label_contains: "contains"
label_not_contains: "doesn't contain"
label_equals: "is"
label_expand: "Expand"
label_expanded: "expanded"
label_expand_all: "Expand all"
label_greater_or_equal: ">="
label_hide_column: "Hide column"
label_in: "in"
label_in_less_than: "in less than"
label_in_more_than: "in more than"
@ -79,9 +79,13 @@ en:
label_menu_collapse: "collapse"
label_menu_expand: "expand"
label_more_than_ago: "more than days ago"
label_move_column_left: "Move column left"
label_move_column_right: "Move column right"
label_no_data: "No data to display"
label_none: "none"
label_not_contains: "doesn't contain"
label_not_equals: "is not"
label_open_menu: "Open menu"
label_open_work_packages: "open"
label_remove_columns: "Remove selected columns"
label_sort_by: "Sort by"

@ -70,8 +70,13 @@ See doc/COPYRIGHT.rdoc for more details.
* `#7149` Fix: Wrong success message when login is already in use
* `#7177` Fix: Journal not created in connection with deleted note
* `#7384` Headlines in wiki table of content are broken
* `#7499` No default work package status possible
* `#7504` Timeline "Today" line not displayed properly
* `#7531` Projects menu not visible if there are no projects
* `#7533` Fixes: Deleted block not addable
* `#7562` Regression: creating ticket via API fails with HTTP 422
* `#7608` Make highlight buttons styleable
* `#7609` Fix: Blue icons in Telekom theme
* Allowed sending of mails with only cc: or bcc: fields
* Allow adding attachments to created work packages via planning elements controller
* Remove unused rmagick dependency

@ -46,7 +46,7 @@ Feature: Project creation with support for project type
Scenario: The admin may create a project with a project type
Given I am already admin
When I go to the admin page
And I follow "Projects"
And I follow the first link matching "Projects"
And I follow "New project"
Then I fill in "Fancy Pants" for "Name"
And I fill in "fancy-pants" for "Identifier"

@ -100,3 +100,14 @@ Feature: User session
When I login as blocked_user with password iamblocked
Then there should be a flash error message
And the flash message should contain "Invalid user or password"
@javascript
Scenario: A deleted block is always visible in My page block list
Given I am already admin
When I go to the My page personalization page
And I select "Calendar" from the available widgets drop down
And I click on "Add"
Then the "Calendar" widget should be in the top block
And "Calendar" should be disabled in the my page available widgets drop down
When I click the first delete block link
Then "Calendar" should not be disabled in the my page available widgets drop down

@ -43,10 +43,19 @@ Then(/^I should see the widget "([^"]*)"$/) do |arg|
page.find("#widget_#{arg}").should_not be_nil
end
Then /^"(.+)" should be disabled in the my page available widgets drop down$/ do |widget_name|
Then /^"(.+)" should( not)? be disabled in the my page available widgets drop down$/ do |widget_name , neg|
option_name = MyController.available_blocks.detect{|k, v| I18n.t(v) == widget_name}.first.dasherize
unless neg
steps %Q{Then the "block-select" drop-down should have the following options disabled:
| #{option_name} |}
else
steps %Q{Then the "block-select" drop-down should have the following options enabled:
| #{option_name} |}
end
end
When(/^I click the first delete block link$/) do
all(:xpath, "//a[@title='Remove widget']")[0].click
end

@ -444,6 +444,10 @@ When /^(?:|I )click on the first button matching "([^"]*)"$/ do |button|
first(:button, button).click
end
When /^(?:|I )follow the first link matching "([^"]*)"$/ do |link|
first(:link, link).click
end
def find_lowest_containing_element text, selector
elements = []

@ -78,7 +78,7 @@ Feature: Updating work packages
| pe1 |
| pe2 |
And I hover over ".fixed_version .context_item"
And I follow "none" within "#context-menu"
And I follow "none" within "#work-package-context-menu"
Then I should see "Successful update"
And I follow "pe1"
And I should see "deleted (version1)"
@ -89,7 +89,7 @@ Feature: Updating work packages
And I open the context menu on the work packages:
| pe1 |
| pe2 |
And I follow "Edit" within "#context-menu"
And I follow "Edit" within "#work-package-context-menu"
And I press "Submit"
Then I should see "Work Packages" within ".title-container"
@ -100,6 +100,6 @@ Feature: Updating work packages
| pe1 |
| pe2 |
And I hover over ".assigned_to .context_item"
And I follow "none" within "#context-menu"
And I follow "none" within "#work-package-context-menu"
Then I should see "Successful update"
Then the attribute "assigned_to" of work package "pe1" should be ""

@ -128,7 +128,7 @@ Feature: Copying a work package
And I open the context menu on the work packages:
| issue1 |
| issue2 |
And I follow "Copy" within "#context-menu"
And I follow "Copy" within "#work-package-context-menu"
Then I should see "Copy" within "#content"
And I should not see "Move" within "#content"

@ -24,6 +24,7 @@ module.exports = function(config) {
"vendor/assets/components/angular/angular.js",
"vendor/assets/components/angular-mocks/angular-mocks.js",
"vendor/assets/components/angular-ui-select2/src/select2.js",
"vendor/assets/components/angular-ui-select2/src/select2sortable.js",
"vendor/assets/components/angular-modal/modal.js",
"vendor/assets/components/angular-sanitize/angular-sanitize.js",
"vendor/assets/components/momentjs/moment.js",
@ -44,6 +45,7 @@ module.exports = function(config) {
'app/assets/javascripts/angular/helpers/timeline-table-helper.js',
'app/assets/javascripts/angular/helpers/function-decorators.js',
'app/assets/javascripts/angular/helpers/url-params-helper.js',
'app/assets/javascripts/angular/helpers/queries-helper.js',
'app/assets/javascripts/angular/filters/work-packages-filters.js',

@ -72,7 +72,7 @@ describe('WorkPackagesController', function() {
},
initQuery: function () {
},
getAvailableColumns: function () {
loadAvailableColumns: function () {
return $timeout(function () {
return columnData;
}, 10);
@ -83,6 +83,12 @@ describe('WorkPackagesController', function() {
}, 10);
},
loadAvailableUnusedColumns: function() {
return $timeout(function () {
return columnData;
}, 10);
},
getTotalEntries: function() {
},

@ -0,0 +1,137 @@
//-- copyright
// OpenProject is a project management system.
// Copyright (C) 2012-2014 the OpenProject Foundation (OPF)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License version 3.
//
// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
// Copyright (C) 2006-2013 Jean-Philippe Lang
// Copyright (C) 2010-2013 the ChiliProject Team
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// See doc/COPYRIGHT.rdoc for more details.
//++
/*jshint expr: true*/
describe('columnContextMenu Directive', function() {
var compile, element, rootScope, scope;
beforeEach(angular.mock.module('openproject.workPackages.directives'));
beforeEach(module('templates', 'openproject.models'));
beforeEach(inject(function($rootScope, $compile, _ContextMenuService_) {
var html;
html = '<column-context-menu></column-context-menu>';
element = angular.element(html);
rootScope = $rootScope;
scope = $rootScope.$new();
ContextMenuService = _ContextMenuService_;
compile = function() {
$compile(element)(scope);
scope.$digest();
};
}));
describe('element', function() {
beforeEach(function() {
compile();
});
it('should render a surrounding div', function() {
expect(element.prop('tagName')).to.equal('DIV');
});
});
describe('when the context menu handler of a column is clicked', function() {
var I18n, QueryService;
var column = { name: 'status', title: 'Status' },
anotherColumn = { name: 'subject', title: 'Subject' },
columns = [column, anotherColumn],
query = Factory.build('Query', { columns: columns });
var directiveScope;
beforeEach(inject(function(_QueryService_) {
QueryService = _QueryService_;
sinon.stub(QueryService, 'getQuery').returns(query);
}));
afterEach(inject(function() {
QueryService.getQuery.restore();
}));
beforeEach(function() {
compile();
ContextMenuService.setContext({ column: column, columns: columns });
ContextMenuService.open('columnContextMenu');
scope.$apply();
directiveScope = element.children().scope();
});
it('fetches the column from the context handle context', function() {
expect(directiveScope.column).to.have.property('name').and.contain(column.name);
});
describe('and the group by option is clicked', function() {
beforeEach(function() {
directiveScope.groupBy(column.name);
});
it('changes the query group by', function() {
expect(query.groupBy).to.equal(column.name);
});
});
describe('and "move column right" is clicked', function() {
beforeEach(function() {
directiveScope.moveRight(column.name);
});
it('moves the column right', function() {
expect(columns[1]).to.equal(column);
});
});
describe('and "Sort ascending" is clicked', function() {
var Sortation;
beforeEach(inject(function(_Sortation_) {
Sortation = _Sortation_;
query.sortation = new Sortation();
directiveScope.sortAscending(column.name);
}));
it('updates the query sortation', function() {
expect(query.sortation.getPrimarySortationCriterion()).to.deep.equal({ field: column.name, direction: 'asc' });
});
});
describe('and "Hide column" is clicked', function() {
beforeEach(function() {
directiveScope.hideColumn(column.name);
});
it('removes the column from the query columns', function() {
expect(query.columns).to.not.include(column);
});
});
});
});

@ -32,7 +32,7 @@ describe('workPackageContextMenu Directive', function() {
var compile, element, rootScope, scope;
beforeEach(angular.mock.module('openproject.workPackages.directives'));
beforeEach(module('templates'));
beforeEach(module('templates', 'openproject.models'));
beforeEach(inject(function($rootScope, $compile, _ContextMenuService_) {
var html;
@ -74,9 +74,12 @@ describe('workPackageContextMenu Directive', function() {
var directListElements;
beforeEach(function() {
ContextMenuService.setContext({rows: [], row: {object: workPackage}});
compile();
ContextMenuService.setContext({rows: [], row: {object: workPackage}});
ContextMenuService.open('workPackageContextMenu');
scope.$apply();
directListElements = element.find('.menu > li:not(.folder)');
});

@ -31,7 +31,8 @@
describe('WorkPackageContextMenuHelper', function() {
var WorkPackageContextMenuHelper;
beforeEach(module('openproject.workPackages.helpers'));
beforeEach(module('openproject.workPackages.helpers', 'openproject.models'));
beforeEach(inject(function(_WorkPackageContextMenuHelper_) {
WorkPackageContextMenuHelper = _WorkPackageContextMenuHelper_;
}));

@ -78,4 +78,21 @@ describe('WorkPackagesTableHelper', function() {
});
});
describe('mapColumnNamesToColumns', function() {
// What do we even need this helper for at the moment?
var columns = [{ name: 'cheese' },
{ name: 'biscuits' },
{ name: 'grapes' },
{ name: 'wine' },
{ name: 'pandas' }];
var identifiers = ['cheese', 'wine'];
it('should get the columns for the names given', function() {
var selectedColumns = WorkPackagesTableHelper.mapIdentifiersToColumns(columns, identifiers);
expect(selectedColumns).to.deep.equal([{ name: 'cheese' }, { name: 'wine' }]);
});
});
});

@ -48,7 +48,7 @@ module Redmine::MenuManager::TopMenuHelper
def render_projects_top_menu_node
return "" if User.current.anonymous? and Setting.login_required?
return "" if User.current.number_of_known_projects.zero?
return "" if User.current.anonymous? and User.current.number_of_known_projects.zero?
heading = link_to l(:label_project_plural),
{ :controller => '/projects',

@ -8,7 +8,7 @@
<div class="tl-toolbar-container" style="width: 1px; height: 20px; background-color: rgb(0, 0, 0);"></div>
<div class="tl-toolbar-container">
<a href="javascript://" title="Zoom out" class="icon tl-icon-zoomout" ng-click="decreaseZoom()"></a>
<a href="javascript://" title="Zoom out" class="icon icon-zoom-out" ng-click="decreaseZoom()"></a>
</div>
<div class="tl-toolbar-container" style="width: 100px; height: 20px;">
@ -16,7 +16,7 @@
</div>
<div class="tl-toolbar-container">
<a href="javascript://" title="Zoom in" class="icon tl-icon-zoomin" ng-click="increaseZoom()"></a>
<a href="javascript://" title="Zoom in" class="icon icon-zoom-in" ng-click="increaseZoom()"></a>
</div>
@ -31,7 +31,7 @@
<div class="tl-toolbar-container" style="width: 1px; height: 20px; background-color: rgb(0, 0, 0);"></div>
<div class="tl-toolbar-container">
<a href="javascript://" title="Reset Outline" class="icon tl-icon-outline" ng-click="resetOutline()"></a>
<a href="javascript://" title="Reset Outline" class="icon icon-outline" ng-click="resetOutline()"></a>
</div>
<div class="tl-toolbar-container">

@ -0,0 +1,28 @@
<div id="column-context-menu" class="action-menu" ng-show="opened">
<ul class="menu">
<li ng-click="groupBy(column.name)">
<a href="#"><span ng-bind="I18n.t('js.work_packages.query.group_by')"/> {{column.title}}</a>
</li>
<li ng-click="sortAscending(column.name)">
<a href="#"><span ng-bind="I18n.t('js.label_sort_by')"/> <span ng-bind="column.title"/> <span ng-bind="I18n.t('js.label_ascending')"/></a>
</li>
<li ng-click="sortDescending(column.name)">
<a href="#"><span ng-bind="I18n.t('js.label_sort_by')"/> <span ng-bind="column.title"/> <span ng-bind="I18n.t('js.label_descending')"/></a>
</li>
<li ng-click="moveLeft(column.name)">
<a href="#"><span ng-bind="I18n.t('js.label_move_column_left')"/></a>
</li>
<li ng-click="moveRight(column.name)">
<a href="#"><span ng-bind="I18n.t('js.label_move_column_right')"/></a>
</li>
<li ng-click="hideColumn(column.name)">
<a href="#"><span ng-bind="I18n.t('js.label_hide_column')"/></a>
</li>
</ul>
</div>

@ -4,5 +4,21 @@
<h1>Columns</h1>
<div>
<label for="selected_columns">Selected Columns</label>
<input id="selected_columns_new"
type="hidden"
ui-select2-sortable="select2Options"
simple-query="getObjectsData"
ng-model="selectedColumnsData"
multiple
sortable></input>
</div>
<div>
<button ng-click="updateSelectedColumns()">Apply</button>
<button ng-click="modal.closeMe()">Cancel</button>
</div>
</div>
</div>

@ -4,5 +4,14 @@
<h1>Share</h1>
<div>
<label for="name">Page visible for others</label>
<input type="checkbox" name="is_public" ng-model="query.isPublic"></input>
</div>
<div>
<button ng-click="modal.closeMe()">Cancel</button>
<button ng-click="saveQuery()">Save</button>
</div>
</div>
</div>

@ -8,7 +8,7 @@
multiple="multiple"
name="available_columns[]"
ng-model="markedAvailableColumns"
ng-options="column.name as column.title for column in availableColumns"
ng-options="column.name as column.title for column in availableUnusedColumns"
size="10"
style="width:150px">
</select>
@ -18,13 +18,13 @@
<input id="add_selected_columns"
type="button"
value="→"
ng-click="moveColumns(markedAvailableColumns, availableColumns, columns, true)"
ng-click="showColumns(markedAvailableColumns)"
title="{{ I18n.t('js.label_add_columns') }}"
ng-disabled="loading"><br>
<label class="hidden-for-sighted" for="add_selected_columns">{{ I18n.t('js.label_remove_columns') }}</label>
<input type="button"
value="←"
ng-click="moveColumns(markedSelectedColumns, columns, availableColumns)"
ng-click="hideColumns(markedSelectedColumns)"
title="{{ I18n.t('js.label_remove_columns') }}"
ng-disabled="loading">
</td>

@ -6,4 +6,5 @@
lang-attribute
lang="{{locale}}">{{headerTitle}}</a>
<span ng-if="!sortable">{{headerTitle}}</span>
<span ng-transclude/>
</span>

@ -1,4 +1,4 @@
<div id="context-menu" ng-show="opened">
<div id="work-package-context-menu" class="action-menu" ng-show="opened">
<ul class="menu">
<li ng-repeat="(action, link) in permittedActions"
ng-click="triggerContextMenuAction(action, link)"

@ -24,7 +24,14 @@
header-name="column.name"
header-title="column.title"
sortable="column.sortable"
query="query"/>
query="query">
<span has-context-menu
target="columnContextMenu"
process-event="adaptVerticalPosition"
trigger-on-event="click">
<icon-wrapper icon-name="pulldown-arrow1" title="{{I18n.t('js.label_open_menu')}}"></icon-wrapper>
</span>
</th>
</tr>
</thead>
@ -83,6 +90,7 @@
<tr work-package-row
id="work-package-{{ row.object.id }}"
has-context-menu
target="workPackageContextMenu"
process-event="adaptVerticalPosition"
ng-class="[
'hascontextmenu',

@ -175,6 +175,23 @@ describe StatusesController do
it_behaves_like :redirect
end
context "default" do
let!(:status_default) { FactoryGirl.create(:status,
is_default: true) }
before do
delete :destroy, id: status_default.id
end
it_behaves_like :statuses
it_behaves_like :redirect
it "shows the right flash message" do
expect(flash[:error]).to eq(I18n.t('error_unable_delete_default_status'))
end
end
end
describe :update_work_package_done_ratio do

@ -84,7 +84,7 @@ describe 'Work package index accessibility' do
it do
expect(sort_header).not_to be_nil
expect(sort_header.find("span")[:title]).to eq(sort_text)
expect(sort_header.find("span.sort-header")[:title]).to eq(sort_text)
end
end

@ -0,0 +1,40 @@
require 'spec_helper'
describe "layouts/base" do
include Redmine::MenuManager::MenuHelper
helper Redmine::MenuManager::MenuHelper
let!(:user) { FactoryGirl.create :user }
let!(:anonymous) { FactoryGirl.create(:anonymous) }
before do
view.stub(:current_menu_item).and_return("overview")
view.stub(:default_breadcrumb)
controller.stub(:default_search_scope)
end
describe "projects menu visibility" do
context "when the user is not logged in" do
before do
User.stub(:current).and_return anonymous
view.stub(:current_user).and_return anonymous
render
end
it "the projects menu should not be displayed" do
expect(response).to_not have_text("Projects")
end
end
context "when the user is logged in" do
before do
User.stub(:current).and_return user
view.stub(:current_user).and_return user
render
end
it "the projects menu should be displayed" do
expect(response).to have_text("Projects")
end
end
end
end
Loading…
Cancel
Save