diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-26 12:07:48 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-26 12:07:48 +0000 |
commit | ef31adeb0fb9a02b2c6a4529ec4e38d7082a4b2b (patch) | |
tree | f0ee2b8bdffd7f91ad0b31388562c90825179585 /app/assets | |
parent | 7e019504f5ac6decde690565857238e7e59aa034 (diff) | |
download | gitlab-ce-ef31adeb0fb9a02b2c6a4529ec4e38d7082a4b2b.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets')
5 files changed, 29 insertions, 30 deletions
diff --git a/app/assets/javascripts/pages/projects/snippets/edit/index.js b/app/assets/javascripts/pages/projects/snippets/edit/index.js index 53606acc508..0a63f5c7172 100644 --- a/app/assets/javascripts/pages/projects/snippets/edit/index.js +++ b/app/assets/javascripts/pages/projects/snippets/edit/index.js @@ -1,8 +1 @@ -import $ from 'jquery'; -import initSnippet from '~/snippet/snippet_bundle'; -import initForm from '~/pages/projects/init_form'; - -document.addEventListener('DOMContentLoaded', () => { - initSnippet(); - initForm($('.snippet-form')); -}); +import '~/snippet/snippet_edit'; diff --git a/app/assets/javascripts/pages/projects/snippets/new/index.js b/app/assets/javascripts/pages/projects/snippets/new/index.js index 53606acc508..0a63f5c7172 100644 --- a/app/assets/javascripts/pages/projects/snippets/new/index.js +++ b/app/assets/javascripts/pages/projects/snippets/new/index.js @@ -1,8 +1 @@ -import $ from 'jquery'; -import initSnippet from '~/snippet/snippet_bundle'; -import initForm from '~/pages/projects/init_form'; - -document.addEventListener('DOMContentLoaded', () => { - initSnippet(); - initForm($('.snippet-form')); -}); +import '~/snippet/snippet_edit'; diff --git a/app/assets/javascripts/pages/snippets/edit/index.js b/app/assets/javascripts/pages/snippets/edit/index.js index d86e1632ae5..0a63f5c7172 100644 --- a/app/assets/javascripts/pages/snippets/edit/index.js +++ b/app/assets/javascripts/pages/snippets/edit/index.js @@ -1,7 +1 @@ -import initSnippet from '~/snippet/snippet_bundle'; -import form from '../form'; - -document.addEventListener('DOMContentLoaded', () => { - initSnippet(); - form(); -}); +import '~/snippet/snippet_edit'; diff --git a/app/assets/javascripts/pages/snippets/new/index.js b/app/assets/javascripts/pages/snippets/new/index.js index d86e1632ae5..0a63f5c7172 100644 --- a/app/assets/javascripts/pages/snippets/new/index.js +++ b/app/assets/javascripts/pages/snippets/new/index.js @@ -1,7 +1 @@ -import initSnippet from '~/snippet/snippet_bundle'; -import form from '../form'; - -document.addEventListener('DOMContentLoaded', () => { - initSnippet(); - form(); -}); +import '~/snippet/snippet_edit'; diff --git a/app/assets/javascripts/snippet/snippet_edit.js b/app/assets/javascripts/snippet/snippet_edit.js new file mode 100644 index 00000000000..a098d17a226 --- /dev/null +++ b/app/assets/javascripts/snippet/snippet_edit.js @@ -0,0 +1,25 @@ +import $ from 'jquery'; +import initSnippet from '~/snippet/snippet_bundle'; +import ZenMode from '~/zen_mode'; +import GLForm from '~/gl_form'; + +document.addEventListener('DOMContentLoaded', () => { + const form = document.querySelector('.snippet-form'); + const personalSnippetOptions = { + members: false, + issues: false, + mergeRequests: false, + epics: false, + milestones: false, + labels: false, + snippets: false, + }; + const projectSnippetOptions = {}; + + const options = + form.dataset.snippetType === 'project' ? projectSnippetOptions : personalSnippetOptions; + + initSnippet(); + new ZenMode(); // eslint-disable-line no-new + new GLForm($(form), options); // eslint-disable-line no-new +}); |