Commit 84360544 authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch 'dmishunov-refactor-snippet-edit' into 'master'

Unified Edit form JS handling for Project and Personal snippets

See merge request gitlab-org/gitlab!28041
parents 20ea35d5 35239074
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';
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';
import initSnippet from '~/snippet/snippet_bundle';
import form from '../form';
document.addEventListener('DOMContentLoaded', () => {
initSnippet();
form();
});
import '~/snippet/snippet_edit';
import initSnippet from '~/snippet/snippet_bundle';
import form from '../form';
document.addEventListener('DOMContentLoaded', () => {
initSnippet();
form();
});
import '~/snippet/snippet_edit';
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
});
......@@ -3,7 +3,8 @@
.snippet-form-holder
= form_for @snippet, url: url,
html: { class: "snippet-form js-requires-input js-quick-submit common-note-form" } do |f|
html: { class: "snippet-form js-requires-input js-quick-submit common-note-form" },
data: { "snippet-type": @snippet.project_id ? 'project' : 'personal'} do |f|
= form_errors(@snippet)
.form-group
......
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