OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/app/assets/javascripts/angular/helpers/components/path-helper.js

67 lines
2.2 KiB

// TODO forward rails routes
angular.module('openproject.helpers')
.service('PathHelper', [function() {
PathHelper = {
apiPrefix: '/api/v2',
apiPrefixV3: '/api/v3',
projectPath: function(projectIdentifier) {
return '/projects/' + projectIdentifier;
},
workPackagesPath: function() {
return '/work_packages';
},
workPackagePath: function(id) {
return '/work_packages/' + id;
},
usersPath: function() {
return '/users';
},
userPath: function(id) {
return PathHelper.usersPath() + id;
},
versionPath: function(versionId) {
return '/versions/' + versionId;
},
apiProjectPath: function(projectIdentifier) {
return PathHelper.apiPrefixV3 + PathHelper.projectPath(projectIdentifier);
},
apiWorkPackagesPath: function() {
return PathHelper.apiPrefixV3 + '/work_packages';
},
apiProjectWorkPackagesPath: function(projectIdentifier) {
return PathHelper.apiProjectPath(projectIdentifier) + PathHelper.workPackagesPath();
},
apiAvailableColumnsPath: function(projectIdentifier) {
return PathHelper.apiProjectPath(projectIdentifier) + '/queries/available_columns';
},
apiWorkPackagesColumnDataPath: function() {
return PathHelper.apiWorkPackagesPath() + '/column_data';
},
apiPrioritiesPath: function() {
return PathHelper.apiPrefix + '/planning_element_priorities';
},
apiStatusesPath: function() {
return PathHelper.apiPrefix + '/statuses';
},
apiProjectStatusesPath: function(projectIdentifier) {
return PathHelper.apiProjectPath(projectIdentifier) + '/statuses';
},
apiTypesPath: function() {
return PathHelper.apiPrefix + '/planning_element_types';
},
apiProjectTypesPath: function(projectIdentifier) {
return PathHelper.apiProjectPath(projectIdentifier) + '/planning_element_types';
},
apiUsersPath: function() {
return PathHelper.apiPrefix + PathHelper.usersPath();
},
apiWorkPackagesSumsPath: function(projectIdentifier) {
return PathHelper.apiProjectPath(projectIdentifier) + PathHelper.workPackagesPath() + '/column_sums';
},
};
return PathHelper;
}]);