summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClement Ho <ClemMakesApps@gmail.com>2018-02-22 15:48:15 -0600
committerClement Ho <ClemMakesApps@gmail.com>2018-02-22 15:48:15 -0600
commitac3b6f14a7cda4d7fa2da84bf00bd51e1b603370 (patch)
treedff4e9b70f330981da20f5bface59994363071f8
parent6ce56d45ef8760380250abaf39a3993f5a2b3903 (diff)
downloadgitlab-ce-dispatcher-if.tar.gz
Convert switch into if statementdispatcher-if
-rw-r--r--app/assets/javascripts/dispatcher.js51
1 files changed, 27 insertions, 24 deletions
diff --git a/app/assets/javascripts/dispatcher.js b/app/assets/javascripts/dispatcher.js
index f66ce1c083b..acf0effa00d 100644
--- a/app/assets/javascripts/dispatcher.js
+++ b/app/assets/javascripts/dispatcher.js
@@ -42,31 +42,34 @@ var Dispatcher;
});
});
- switch (page) {
- case 'projects:merge_requests:index':
- case 'projects:issues:index':
- case 'projects:issues:show':
- case 'projects:issues:new':
- case 'projects:issues:edit':
- case 'projects:merge_requests:creations:new':
- case 'projects:merge_requests:creations:diffs':
- case 'projects:merge_requests:edit':
- case 'projects:merge_requests:show':
- case 'projects:commit:show':
- case 'projects:activity':
- case 'projects:commits:show':
- case 'projects:show':
- case 'groups:show':
- case 'projects:tree:show':
- case 'projects:find_file:show':
- case 'projects:blob:show':
- case 'projects:blame:show':
- case 'projects:network:show':
- case 'projects:artifacts:browse':
- case 'projects:artifacts:file':
- shortcut_handler = true;
- break;
+ const shortcutHandlerPages = [
+ 'projects:activity',
+ 'projects:artifacts:browse',
+ 'projects:artifacts:file',
+ 'projects:blame:show',
+ 'projects:blob:show',
+ 'projects:commit:show',
+ 'projects:commits:show',
+ 'projects:find_file:show',
+ 'projects:issues:edit',
+ 'projects:issues:index',
+ 'projects:issues:new',
+ 'projects:issues:show',
+ 'projects:merge_requests:creations:diffs',
+ 'projects:merge_requests:creations:new',
+ 'projects:merge_requests:edit',
+ 'projects:merge_requests:index',
+ 'projects:merge_requests:show',
+ 'projects:network:show',
+ 'projects:show',
+ 'projects:tree:show',
+ 'groups:show',
+ ];
+
+ if (shortcutHandlerPages.indexOf(page) !== -1) {
+ shortcut_handler = true;
}
+
switch (path[0]) {
case 'admin':
switch (path[1]) {