diff options
author | Simon Knox <psimyn@gmail.com> | 2017-09-06 08:02:30 +0300 |
---|---|---|
committer | Simon Knox <psimyn@gmail.com> | 2017-09-06 08:41:00 +0300 |
commit | c28d52a3a5e745d20981151b89bfcad07c68fa9c (patch) | |
tree | d51df26c80701f8e7b8a178119ffd09a895ad063 /app/assets/javascripts/api.js | |
parent | b9aa55e1ea2ba226bd9bf4c6fb08fdec30e046c5 (diff) |
FE backport of group boards to reduce CE conflicts
Diffstat (limited to 'app/assets/javascripts/api.js')
-rw-r--r-- | app/assets/javascripts/api.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/app/assets/javascripts/api.js b/app/assets/javascripts/api.js index 8acddd6194c..501cc43d552 100644 --- a/app/assets/javascripts/api.js +++ b/app/assets/javascripts/api.js @@ -6,7 +6,8 @@ const Api = { namespacesPath: '/api/:version/namespaces.json', groupProjectsPath: '/api/:version/groups/:id/projects.json', projectsPath: '/api/:version/projects.json', - labelsPath: '/:namespace_path/:project_path/labels', + projectLabelsPath: '/:namespace_path/:project_path/labels', + groupLabelsPath: '/groups/:namespace_path/labels', licensePath: '/api/:version/templates/licenses/:key', gitignorePath: '/api/:version/templates/gitignores/:key', gitlabCiYmlPath: '/api/:version/templates/gitlab_ci_ymls/:key', @@ -74,9 +75,14 @@ const Api = { }, newLabel(namespacePath, projectPath, data, callback) { - const url = Api.buildUrl(Api.labelsPath) - .replace(':namespace_path', namespacePath) - .replace(':project_path', projectPath); + let url; + if (projectPath) { + url = Api.buildUrl(Api.projectLabelsPath) + .replace(':namespace_path', namespacePath) + .replace(':project_path', projectPath); + } else { + url = Api.buildUrl(Api.groupLabelsPath).replace(':namespace_path', namespacePath); + } return $.ajax({ url, type: 'POST', |