Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/templates/issuable_template_selector.js')
-rw-r--r--app/assets/javascripts/templates/issuable_template_selector.js27
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() {