WIP wire up category filters in frontend

pull/2908/head
Jan Sandbrink 10 years ago
parent 900b2a4c45
commit a05c0a4e5b
  1. 6
      app/assets/javascripts/angular/helpers/path-helper.js
  2. 54
      app/assets/javascripts/angular/services/category-service.js
  3. 6
      app/assets/javascripts/angular/services/query-service.js
  4. 1
      app/assets/javascripts/angular/work_packages/config/work-packages-config.js
  5. 1
      config/locales/js-de.yml
  6. 1
      config/locales/js-en.yml

@ -240,6 +240,12 @@ angular.module('openproject.helpers')
},
// API V3
apiV3ProjectPath: function(projectIdentifier) {
return PathHelper.apiV3 + "/projects/" + projectIdentifier;
},
apiProjectCategoriesPath: function(projectIdentifier) {
return PathHelper.apiV3ProjectPath(projectIdentifier) + '/categories';
},
apiQueryStarPath: function(queryId) {
return PathHelper.apiV3QueryPath(queryId) + '/star';
},

@ -0,0 +1,54 @@
//-- copyright
// OpenProject is a project management system.
// Copyright (C) 2012-2015 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.
//++
angular.module('openproject.services')
.service('CategoryService', ['$http', 'PathHelper', function($http, PathHelper) {
var CategoryService = {
getCategories: function(projectIdentifier) {
if(!projectIdentifier) {
return [];
}
var url = PathHelper.apiProjectCategoriesPath(projectIdentifier);
return CategoryService.doQuery(url);
},
doQuery: function(url, params) {
return $http.get(url, { params: params })
.then(function(response){
// TODO: parse the real response (the code below is c&p from version-service)
return _.sortBy(response.data.categories, 'name');
});
}
};
return CategoryService;
}]);

@ -40,6 +40,7 @@ angular.module('openproject.services')
'PriorityService',
'UserService',
'VersionService',
'CategoryService',
'RoleService',
'GroupService',
'ProjectService',
@ -48,7 +49,7 @@ angular.module('openproject.services')
'queryMenuItemFactory',
'$rootScope',
'QUERY_MENU_ITEM_TYPE',
function(Query, Sortation, $http, PathHelper, $q, AVAILABLE_WORK_PACKAGE_FILTERS, StatusService, TypeService, PriorityService, UserService, VersionService, RoleService, GroupService, ProjectService, WorkPackagesTableHelper, I18n, queryMenuItemFactory, $rootScope, QUERY_MENU_ITEM_TYPE) {
function(Query, Sortation, $http, PathHelper, $q, AVAILABLE_WORK_PACKAGE_FILTERS, StatusService, TypeService, PriorityService, UserService, VersionService, CategoryService, RoleService, GroupService, ProjectService, WorkPackagesTableHelper, I18n, queryMenuItemFactory, $rootScope, QUERY_MENU_ITEM_TYPE) {
var query;
@ -301,6 +302,9 @@ angular.module('openproject.services')
case 'version':
retrieveAvailableValues = VersionService.getVersions(projectIdentifier);
break;
case 'category':
retrieveAvailableValues = CategoryService.getCategories(projectIdentifier);
break;
case 'role':
retrieveAvailableValues = RoleService.getRoles();
break;

@ -52,6 +52,7 @@ angular.module('openproject.workPackages.config')
watcher_id: {type: 'list_model', modelName: 'user', order: 6, locale_name: 'watcher'},
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'},
category_id: {type: 'list_optional', modelName: 'category', order: 7, locale_name: 'category'},
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' },

@ -161,6 +161,7 @@ de:
assigned_to: "Zugewiesen an"
assigned_to_role: "Zuständigkeitsrolle"
author: "Autor"
category: "Kategorie"
created_at: "Angelegt"
done_ratio: "% erledigt"
due_date: "Abgabedatum"

@ -160,6 +160,7 @@ en:
assigned_to: "Assignee"
assigned_to_role: "Assignee's role"
author: "Author"
category: "Category"
created_at: "Created on"
done_ratio: "% done"
due_date: "Due date"

Loading…
Cancel
Save