diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 10:34:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 10:34:06 +0000 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /app/assets/javascripts/templates | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) | |
download | gitlab-ce-859a6fb938bb9ee2a317c46dfa4fcc1af49608f0.tar.gz |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'app/assets/javascripts/templates')
-rw-r--r-- | app/assets/javascripts/templates/issuable_template_selector.js | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/app/assets/javascripts/templates/issuable_template_selector.js b/app/assets/javascripts/templates/issuable_template_selector.js index 22bbd083a5d..1bb5e214c2e 100644 --- a/app/assets/javascripts/templates/issuable_template_selector.js +++ b/app/assets/javascripts/templates/issuable_template_selector.js @@ -1,16 +1,15 @@ /* eslint-disable no-useless-return */ import $ from 'jquery'; +import { __ } from '~/locale'; import Api from '../api'; import TemplateSelector from '../blob/template_selector'; -import { __ } from '~/locale'; export default class IssuableTemplateSelector extends TemplateSelector { constructor(...args) { super(...args); - this.projectPath = this.dropdown.data('projectPath'); - this.namespacePath = this.dropdown.data('namespacePath'); + this.projectId = this.dropdown.data('projectId'); this.issuableType = this.$dropdownContainer.data('issuableType'); this.titleInput = $(`#${this.issuableType}_title`); this.templateWarningEl = $('.js-issuable-template-warning'); @@ -81,21 +80,21 @@ export default class IssuableTemplateSelector extends TemplateSelector { } requestFile(query) { + const callback = (currentTemplate) => { + this.currentTemplate = currentTemplate; + this.stopLoadingSpinner(); + this.setInputValueToTemplateContent(); + }; + this.startLoadingSpinner(); - Api.issueTemplate( - this.namespacePath, - this.projectPath, - query.name, + Api.projectTemplate( + this.projectId, this.issuableType, - (err, currentTemplate) => { - this.currentTemplate = currentTemplate; - this.stopLoadingSpinner(); - if (err) return; // Error handled by global AJAX error handler - this.setInputValueToTemplateContent(); - }, + query.name, + { source_template_project_id: query.project_id }, + callback, ); - return; } setInputValueToTemplateContent() { |