Revert "make filter operator select focusable and keep track in query filters di..."

pull/1897/head
Alex Coles 10 years ago
parent 958cd85907
commit 7f3e3574d9
  1. 2
      app/assets/javascripts/angular/helpers/components/focus-helper.js
  2. 4
      app/assets/javascripts/angular/models/query.js
  3. 2
      app/assets/javascripts/angular/work_packages/directives/query-filter-directive.js
  4. 11
      app/assets/javascripts/angular/work_packages/directives/query-filters-directive.js
  5. 8
      public/templates/work_packages/query_filters.html

@ -29,7 +29,7 @@
// TODO move to UI components
angular.module('openproject.uiComponents')
.constant('FOCUSABLE_SELECTOR', 'a, button, :input, [tabindex], select')
.constant('FOCUSABLE_SELECTOR', 'a, button, :input, [tabindex]')
.service('FocusHelper', ['$timeout', 'FOCUSABLE_SELECTOR', function($timeout, FOCUSABLE_SELECTOR) {
FocusHelper = {

@ -286,12 +286,12 @@ angular.module('openproject.models')
if (filter) {
filter.deactivated = false;
this.removeFilter(filter.name);
} else {
var filterData = this.getExtendedFilterData(angular.extend({name: filterName}, options));
filter = new Filter(filterData);
this.filters.push(filter);
}
this.filters.push(filter);
},
removeFilter: function(filterName) {

@ -46,7 +46,6 @@ angular.module('openproject.workPackages.directives')
scope.isLoading = false; // shadow isLoading as its used for a different purpose in this context
scope.showValueOptionsAsSelect = !scope.filter.isSingleInputField();
scope.$broadcast('updateFocus');
if (scope.showValueOptionsAsSelect) {
WorkPackageLoadingHelper.withLoading(scope, QueryService.getAvailableFilterValues, [scope.filter.name, scope.projectIdentifier])
@ -109,7 +108,6 @@ angular.module('openproject.workPackages.directives')
function valueReset(filter, oldFilter) {
return oldFilter.hasValues() && !filter.hasValues();
}
}
};
}]);

@ -28,7 +28,7 @@
angular.module('openproject.workPackages.directives')
.directive('queryFilters', ['FiltersHelper', 'I18n', '$timeout', function(FiltersHelper, I18n, $timeout) {
.directive('queryFilters', ['FiltersHelper', 'I18n', function(FiltersHelper, I18n) {
return {
restrict: 'E',
@ -42,19 +42,10 @@ angular.module('openproject.workPackages.directives')
scope.$watch('filterToBeAdded', function(filterName) {
if (filterName) {
scope.query.addFilter(filterName);
scope.focussedFilterIndex = scope.query.getActiveFilters().length - 1;
scope.filterToBeAdded = undefined;
}
});
scope.focussedFilterIndex = -1;
scope.deactivateFilter = function(filter) {
scope.query.deactivateFilter(filter);
scope.focussedFilterIndex = scope.query.getActiveFilters().length - 1;
$timeout(function() {
scope.$broadcast('updateFocus');
});
}
}
};
}

@ -10,7 +10,8 @@
<table>
<tbody>
<tr query-filter
ng-repeat="filter in query.getActiveFilters()"
ng-repeat="filter in query.filters"
ng-show="!filter.deactivated"
id="tr_{{filter.name}}"
class="filter">
@ -24,8 +25,7 @@
<!-- Operator -->
<td style="width:150px;">
<select focus="$index == focussedFilterIndex"
require
<select require
class="select-small"
id="operators-{{filter.name}}"
name="op[{{filter.name}}]"
@ -132,7 +132,7 @@
<!-- Delete filter -->
<td>
<accessible-by-keyboard execute="deactivateFilter(filter)">
<accessible-by-keyboard execute="query.deactivateFilter(filter)">
<icon-wrapper icon-name="delete2"
icon-title="{{I18n.t('js.button_delete')}}"/>
</accessible-by-keyboard>

Loading…
Cancel
Save