Use state changes to deselect queries instead of an event

pull/1452/head
Till Breuer 11 years ago
parent fdae795ef5
commit fb3a5e0006
  1. 4
      app/assets/javascripts/angular/directives/work_packages/filter-clear-directive.js
  2. 5
      app/assets/javascripts/angular/directives/work_packages/options-dropdown-directive.js
  3. 7
      karma/tests/directives/work_packages/options-dropdown-directive-test.js

@ -28,14 +28,14 @@
angular.module('openproject.workPackages.directives')
.directive('filterClear', [function(){
.directive('filterClear', ['$state', function($state){
return {
restrict: 'E',
templateUrl: '/templates/work_packages/filter_clear.html',
scope: true,
link: function(scope, element, attributes) {
scope.clearQuery = function(){
scope.$emit('queryResetRequired');
$state.go('work-packages.list', {}, { reload: true });
};
}
};

@ -38,7 +38,8 @@ angular.module('openproject.workPackages.directives')
'groupingModal',
'QueryService',
'$window',
function(I18n, columnsModal, exportModal, saveModal, settingsModal, shareModal, sortingModal, groupingModal, QueryService, $window){
'$state',
function(I18n, columnsModal, exportModal, saveModal, settingsModal, shareModal, sortingModal, groupingModal, QueryService, $window, $state){
return {
restrict: 'AE',
@ -69,7 +70,7 @@ angular.module('openproject.workPackages.directives')
.then(function(data){
settingsModal.deactivate();
scope.$emit('flashMessage', data.status);
scope.$emit('queryResetRequired');
$state.go('work-packages.list', {}, { reload: true });
});
}
};

@ -30,7 +30,12 @@ describe('optionsDropdown Directive', function() {
var compile, element, rootScope, scope;
beforeEach(angular.mock.module('openproject.workPackages.directives'));
beforeEach(module('templates', 'openproject.models', 'openproject.workPackages.controllers'));
beforeEach(module('openproject.models', 'openproject.workPackages.controllers'));
beforeEach(module('templates', function($provide) {
var state = { go: function() { return false; } };
$provide.value('$state', state);
}));
beforeEach(inject(function($rootScope, $compile) {
var optionsDropdownHtml;

Loading…
Cancel
Save