Commit a88be4cc authored by derek-knox's avatar derek-knox Committed by Chad Woolley

Apply review feedback

- Add ISSUABLE_TYPE const
- Add projectSplit computed
parent 8ac6382e
...@@ -6,7 +6,7 @@ import LocalStorageSync from '~/vue_shared/components/local_storage_sync.vue'; ...@@ -6,7 +6,7 @@ import LocalStorageSync from '~/vue_shared/components/local_storage_sync.vue';
import EditMetaControls from './edit_meta_controls.vue'; import EditMetaControls from './edit_meta_controls.vue';
import { MR_META_LOCAL_STORAGE_KEY } from '../constants'; import { ISSUABLE_TYPE, MR_META_LOCAL_STORAGE_KEY } from '../constants';
export default { export default {
components: { components: {
...@@ -66,7 +66,7 @@ export default { ...@@ -66,7 +66,7 @@ export default {
this.$refs.modal.hide(); this.$refs.modal.hide();
}, },
initTemplates() { initTemplates() {
Api.issueTemplates(this.namespace, this.project, 'merge_request', (err, templates) => { Api.issueTemplates(this.namespace, this.project, ISSUABLE_TYPE, (err, templates) => {
if (err) return; // Error handled by global AJAX error handler if (err) return; // Error handled by global AJAX error handler
this.mergeRequestTemplates = templates; this.mergeRequestTemplates = templates;
}); });
......
...@@ -2,6 +2,7 @@ import { s__, __ } from '~/locale'; ...@@ -2,6 +2,7 @@ import { s__, __ } from '~/locale';
export const BRANCH_SUFFIX_COUNT = 8; export const BRANCH_SUFFIX_COUNT = 8;
export const DEFAULT_TARGET_BRANCH = 'master'; export const DEFAULT_TARGET_BRANCH = 'master';
export const ISSUABLE_TYPE = 'merge_request';
export const SUBMIT_CHANGES_BRANCH_ERROR = s__('StaticSiteEditor|Branch could not be created.'); export const SUBMIT_CHANGES_BRANCH_ERROR = s__('StaticSiteEditor|Branch could not be created.');
export const SUBMIT_CHANGES_COMMIT_ERROR = s__( export const SUBMIT_CHANGES_COMMIT_ERROR = s__(
......
...@@ -64,6 +64,9 @@ export default { ...@@ -64,6 +64,9 @@ export default {
isContentLoaded() { isContentLoaded() {
return Boolean(this.sourceContent); return Boolean(this.sourceContent);
}, },
projectSplit() {
return this.appData.project.split('/'); // TODO: refactor so `namespace` and `project` remain distinct
},
}, },
mounted() { mounted() {
Tracking.event(document.body.dataset.page, TRACKING_ACTION_INITIALIZE_EDITOR); Tracking.event(document.body.dataset.page, TRACKING_ACTION_INITIALIZE_EDITOR);
...@@ -148,8 +151,8 @@ export default { ...@@ -148,8 +151,8 @@ export default {
<edit-meta-modal <edit-meta-modal
ref="editMetaModal" ref="editMetaModal"
:source-path="appData.sourcePath" :source-path="appData.sourcePath"
:namespace="appData.project.split('/')[0]" :namespace="projectSplit[0]"
:project="appData.project.split('/')[1]" :project="projectSplit[1]"
@primary="onSubmit" @primary="onSubmit"
@hide="onHideModal" @hide="onHideModal"
/> />
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment