Fix looking up model names when filter options are augmented

pull/1093/head
Till Breuer 11 years ago
parent 0e2362a628
commit 8ced3bc924
  1. 10
      app/assets/javascripts/angular/directives/work_packages/query-filter-directive.js
  2. 6
      app/assets/javascripts/angular/models/filter.js

@ -80,11 +80,13 @@ angular.module('openproject.workPackages.directives')
}
function addStandardOptions(options) {
if (scope.filter.getModelName() === 'user') {
options.unshift(['<< ' + I18n.t('js.label_me') + ' >>', 'me']);
}
return scope.filter.getModelName().then(function(modelName) {
if (modelName === 'user') {
options.unshift(['<< ' + I18n.t('js.label_me') + ' >>', 'me']);
}
return options;
return options;
});
}
function valueReset(filter, oldFilter) {

@ -64,6 +64,12 @@ angular.module('openproject.models')
return this.operator && (this.hasValues() || !this.requiresValues());
},
/**
* @name getModelName
*
* @description Looks through the available filters and looks up the model name
* @returns {promise} Promise yielding the model name
*/
getModelName: function() {
var self = this;
return QueryService.getAvailableFilters()

Loading…
Cancel
Save