summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Knox <psimyn@gmail.com>2018-01-09 20:08:33 +1100
committerSimon Knox <psimyn@gmail.com>2018-01-10 16:21:48 +1100
commit520bee89fab788ff3eff1fcd1e9c81ab0e98cef3 (patch)
treea6c21b6c1714166a38d313d38f59bed5031a825b
parent7b2f9af4486b26512a2fefb3f385a2b8fa65a068 (diff)
downloadgitlab-ce-520bee89fab788ff3eff1fcd1e9c81ab0e98cef3.tar.gz
dynamic module loading for snippetsdispatcher-snippets
-rw-r--r--app/assets/javascripts/dispatcher.js12
-rw-r--r--app/assets/javascripts/pages/snippets/create/index.js8
-rw-r--r--app/assets/javascripts/pages/snippets/edit/index.js8
-rw-r--r--app/assets/javascripts/pages/snippets/new/index.js8
-rw-r--r--app/assets/javascripts/pages/snippets/update/index.js8
5 files changed, 42 insertions, 2 deletions
diff --git a/app/assets/javascripts/dispatcher.js b/app/assets/javascripts/dispatcher.js
index 9e8b2acfe1b..cc3608a4f4f 100644
--- a/app/assets/javascripts/dispatcher.js
+++ b/app/assets/javascripts/dispatcher.js
@@ -111,6 +111,9 @@ import Activities from './activities';
const fail = () => Flash('Error loading dynamic module');
const callDefault = m => m.default();
+ function rethrow(err) {
+ throw err;
+ }
path = page.split(':');
shortcut_handler = null;
@@ -311,11 +314,16 @@ import Activities from './activities';
new ZenMode();
break;
case 'snippets:new':
+ import('./pages/snippets/new').then(callDefault, fail).catch(rethrow);
+ break;
case 'snippets:edit':
+ import('./pages/snippets/edit').then(callDefault, fail).catch(rethrow);
+ break;
case 'snippets:create':
+ import('./pages/snippets/create').then(callDefault, fail).catch(rethrow);
+ break;
case 'snippets:update':
- new GLForm($('.snippet-form'), false);
- new ZenMode();
+ import('./pages/snippets/update').then(callDefault, fail).catch(rethrow);
break;
case 'projects:releases:edit':
new ZenMode();
diff --git a/app/assets/javascripts/pages/snippets/create/index.js b/app/assets/javascripts/pages/snippets/create/index.js
new file mode 100644
index 00000000000..e06dda3753c
--- /dev/null
+++ b/app/assets/javascripts/pages/snippets/create/index.js
@@ -0,0 +1,8 @@
+/* eslint-disable no-new */
+import GLForm from '~/gl_form';
+import ZenMode from '~/zen_mode';
+
+export default () => {
+ new GLForm($('.snippet-form'), false);
+ new ZenMode();
+};
diff --git a/app/assets/javascripts/pages/snippets/edit/index.js b/app/assets/javascripts/pages/snippets/edit/index.js
new file mode 100644
index 00000000000..e06dda3753c
--- /dev/null
+++ b/app/assets/javascripts/pages/snippets/edit/index.js
@@ -0,0 +1,8 @@
+/* eslint-disable no-new */
+import GLForm from '~/gl_form';
+import ZenMode from '~/zen_mode';
+
+export default () => {
+ new GLForm($('.snippet-form'), false);
+ new ZenMode();
+};
diff --git a/app/assets/javascripts/pages/snippets/new/index.js b/app/assets/javascripts/pages/snippets/new/index.js
new file mode 100644
index 00000000000..e06dda3753c
--- /dev/null
+++ b/app/assets/javascripts/pages/snippets/new/index.js
@@ -0,0 +1,8 @@
+/* eslint-disable no-new */
+import GLForm from '~/gl_form';
+import ZenMode from '~/zen_mode';
+
+export default () => {
+ new GLForm($('.snippet-form'), false);
+ new ZenMode();
+};
diff --git a/app/assets/javascripts/pages/snippets/update/index.js b/app/assets/javascripts/pages/snippets/update/index.js
new file mode 100644
index 00000000000..e06dda3753c
--- /dev/null
+++ b/app/assets/javascripts/pages/snippets/update/index.js
@@ -0,0 +1,8 @@
+/* eslint-disable no-new */
+import GLForm from '~/gl_form';
+import ZenMode from '~/zen_mode';
+
+export default () => {
+ new GLForm($('.snippet-form'), false);
+ new ZenMode();
+};