summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/shortcuts_dashboard_navigation.js
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-03-30 18:31:59 +0100
committerJacob Schatz <jschatz1@gmail.com>2017-04-06 18:14:42 -0400
commite9025c25e4a7e7ebbb2e7097c14470bdadb64982 (patch)
tree6fea798e85c24c10562d74f7d02ec14d028c8225 /app/assets/javascripts/shortcuts_dashboard_navigation.js
parentd9ed9c6d0d9712154877d8f2b336562c502a939d (diff)
downloadgitlab-ce-e9025c25e4a7e7ebbb2e7097c14470bdadb64982.tar.gz
Improve shortcuts code
Diffstat (limited to 'app/assets/javascripts/shortcuts_dashboard_navigation.js')
-rw-r--r--app/assets/javascripts/shortcuts_dashboard_navigation.js40
1 files changed, 12 insertions, 28 deletions
diff --git a/app/assets/javascripts/shortcuts_dashboard_navigation.js b/app/assets/javascripts/shortcuts_dashboard_navigation.js
index 0d8d251e93e..25f39e4fdb6 100644
--- a/app/assets/javascripts/shortcuts_dashboard_navigation.js
+++ b/app/assets/javascripts/shortcuts_dashboard_navigation.js
@@ -1,28 +1,12 @@
-/* eslint-disable func-names, space-before-function-paren, max-len, one-var, no-var, no-restricted-syntax, vars-on-top, no-use-before-define, no-param-reassign, new-cap, no-underscore-dangle, wrap-iife, prefer-arrow-callback, consistent-return, no-return-assign */
-/* global Mousetrap */
-/* global Shortcuts */
-
-require('./shortcuts');
-
-(function() {
- var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
- hasProp = {}.hasOwnProperty;
-
- this.ShortcutsDashboardNavigation = (function(superClass) {
- extend(ShortcutsDashboardNavigation, superClass);
-
- function ShortcutsDashboardNavigation() {
- ShortcutsDashboardNavigation.__super__.constructor.call(this);
- }
-
- ShortcutsDashboardNavigation.findAndFollowLink = function(selector) {
- var link;
- link = $(selector).attr('href');
- if (link) {
- return window.location = link;
- }
- };
-
- return ShortcutsDashboardNavigation;
- })(Shortcuts);
-}).call(window);
+/**
+ * Helper function that finds the href of the fiven selector and updates the location.
+ *
+ * @param {String} selector
+ */
+export default (selector) => {
+ const link = document.querySelector(selector).getAttribute('href');
+
+ if (link) {
+ window.location = link;
+ }
+};