Changed filter operators constant to be arrays instead of object.

This allows us to define the ordering.
pull/1112/head
Richard 11 years ago
parent b7e065afba
commit 5440410d03
  1. 32
      app/assets/javascripts/angular/config/work-packages-config.js
  2. 2
      public/templates/work_packages/query_filters.html

@ -31,29 +31,29 @@ angular.module('openproject.workPackages.config')
.constant('INITIALLY_SELECTED_COLUMNS', ['id', 'project', 'type', 'status', 'priority', 'subject', 'assigned_to_id', 'updated_at'])
.constant('OPERATORS_AND_LABELS_BY_FILTER_TYPE', {
list: {'=':'label_equals','!':'label_not_equals'},
list_model: {'=':'label_equals','!':'label_not_equals'},
list_status: {'o':'label_open_work_packages','=':'label_equals','!':'label_not_equals','c':'label_closed_work_packages','*':'label_all'},
list_optional: {'=':'label_equals','!':'label_not_equals','!*':'label_none','*':'label_all'},
list_subprojects: {'*':'label_all','!*':'label_none','=':'label_equals'},
date: {'<t+':'label_in_less_than','>t+':'label_in_more_than','t+':'label_in','t':'label_today','w':'label_this_week','>t-':'label_less_than_ago','<t-':'label_more_than_ago','t-':'label_ago'},
date_past: {'>t-':'label_less_than_ago','<t-':'label_more_than_ago','t-':'label_ago','t':'label_today','w':'label_this_week'},
string: {'=':'label_equals','~':'label_contains','!':'label_not_equals','!~':"label_not_contains"},
text: {'~':'label_contains','!~':"label_not_contains"},
integer: {'=':'label_equals','>=':'label_greater_or_equal','<=':'label_less_or_equal','!*':'label_none','*':'label_all'}
list: [['=', 'label_equals'], ['!', 'label_not_equals']],
list_model: [['=', 'label_equals'], ['!', 'label_not_equals']],
list_status: [['o', 'label_open_work_packages'], ['=', 'label_equals'], ['!', 'label_not_equals'], ['c', 'label_closed_work_packages'], ['*', 'label_all']],
list_optional: [['=', 'label_equals'], ['!', 'label_not_equals'], ['!*', 'label_none'], ['*', 'label_all']],
list_subprojects: [['*', 'label_all'], ['!*', 'label_none'], ['=', 'label_equals']],
date: [['<t+', 'label_in_less_than'], ['>t+', 'label_in_more_than'], ['t+', 'label_in'], ['t', 'label_today'], ['w', 'label_this_week'], ['>t-', 'label_less_than_ago'], ['<t-', 'label_more_than_ago'], ['t-', 'label_ago']],
date_past: [['>t-', 'label_less_than_ago'], ['<t-', 'label_more_than_ago'], ['t-', 'label_ago'], ['t', 'label_today'], ['w', 'label_this_week']],
string: [['=', 'label_equals'], ['~', 'label_contains'], ['!', 'label_not_equals'], ['!~', 'label_not_contains']],
text: [['~', 'label_contains'], ['!~', 'label_not_contains']],
integer: [['=', 'label_equals'], ['>=', 'label_greater_or_equal'], ['<=', 'label_less_or_equal'], ['!*', 'label_none'], ['*', 'label_all']]
})
.constant('AVAILABLE_WORK_PACKAGE_FILTERS', {
status_id: { type: 'list_status', modelName: 'status' , order: 1, locale_name: 'status' },
type_id: { type: 'list_model', modelName: 'type', order: 2, locale_name: 'type' },
priority_id: { type: 'list_model', modelName: 'priority', order: 3, locale_name: 'priority'},
assigned_to_id: { type: 'list_model', modelName: 'user' , order: 4, locale_name: 'assigned_to' },
assigned_to_id: { type: 'list_optional', modelName: 'user' , order: 4, locale_name: 'assigned_to' },
author_id: { type: 'list_model', modelName: 'user' , order: 5, locale_name: 'author' },
watcher_id: {type: 'list_model', modelName: 'user', order: 6, locale_name: 'watcher'},
responsible_id: {type: 'list_model', modelName: 'user', order: 6, locale_name: 'responsible'},
fixed_version_id: {type: 'list_model', modelName: 'version', order: 7, locale_name: 'fixed_version'},
member_of_group: {type: 'list_model', modelName: 'group', order: 8, locale_name: 'member_of_group'},
assigned_to_role: {type: 'list_model', modelName: 'role', order: 9, locale_name: 'assigned_to_role'},
responsible_id: {type: 'list_optional', modelName: 'user', order: 6, locale_name: 'responsible'},
fixed_version_id: {type: 'list_optional', modelName: 'version', order: 7, locale_name: 'fixed_version'},
member_of_group: {type: 'list_optional', modelName: 'group', order: 8, locale_name: 'member_of_group'},
assigned_to_role: {type: 'list_optional', modelName: 'role', order: 9, locale_name: 'assigned_to_role'},
subject: { type: 'text', order: 10, locale_name: 'subject' },
created_at: { type: 'date_past', order: 11, locale_name: 'created_at' },
updated_at: { type: 'date_past', order: 12, locale_name: 'updated_at' },
@ -62,7 +62,7 @@ angular.module('openproject.workPackages.config')
estimated_hours: { type: 'integer', order: 15, locale_name: 'estimated_hours' },
done_ratio: { type: 'integer', order: 16, locale_name: 'done_ratio' },
project_id: { type: 'list_model', modelName: 'project', order: 17, locale_name: 'project' },
subproject_id: { type: 'list_model', modelName: 'sub_project', order: 18, locale_name: 'subproject' },
subproject_id: { type: 'list_subprojects', modelName: 'sub_project', order: 18, locale_name: 'subproject' },
})
.constant('DEFAULT_SORT_CRITERIA', 'parent:desc')

@ -41,7 +41,7 @@
class="select-small to-validate"
id="operators-{{filter.name}}"
name="op[{{filter.name}}]"
ng-options="operator as I18n.t('js.' + label) for (operator, label) in operatorsAndLabelsByFilterType[filter.type]"
ng-options="operator[0] as I18n.t('js.' + operator[1]) for operator in operatorsAndLabelsByFilterType[filter.type]"
ng-model="filter.operator"
style="vertical-align: top;"
ng-disabled="isLoading">

Loading…
Cancel
Save