diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-19 22:11:55 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-19 22:11:55 +0000 |
commit | 5a8431feceba47fd8e1804d9aa1b1730606b71d5 (patch) | |
tree | e5df8e0ceee60f4af8093f5c4c2f934b8abced05 /app/assets/javascripts/right_sidebar.js | |
parent | 4d477238500c347c6553d335d920bedfc5a46869 (diff) | |
download | gitlab-ce-5a8431feceba47fd8e1804d9aa1b1730606b71d5.tar.gz |
Add latest changes from gitlab-org/gitlab@12-5-stable-ee
Diffstat (limited to 'app/assets/javascripts/right_sidebar.js')
-rw-r--r-- | app/assets/javascripts/right_sidebar.js | 52 |
1 files changed, 20 insertions, 32 deletions
diff --git a/app/assets/javascripts/right_sidebar.js b/app/assets/javascripts/right_sidebar.js index 87454ee056f..fa5649679d7 100644 --- a/app/assets/javascripts/right_sidebar.js +++ b/app/assets/javascripts/right_sidebar.js @@ -1,4 +1,4 @@ -/* eslint-disable func-names, no-var, consistent-return, one-var, no-else-return, no-param-reassign */ +/* eslint-disable func-names, consistent-return, no-else-return, no-param-reassign */ import $ from 'jquery'; import _ from 'underscore'; @@ -44,12 +44,11 @@ Sidebar.prototype.addEventListeners = function() { }; Sidebar.prototype.sidebarToggleClicked = function(e, triggered) { - var $allGutterToggleIcons, $this, isExpanded, tooltipLabel; + const $this = $(this); + const isExpanded = $this.find('i').hasClass('fa-angle-double-right'); + const tooltipLabel = isExpanded ? __('Expand sidebar') : __('Collapse sidebar'); + const $allGutterToggleIcons = $('.js-sidebar-toggle i'); e.preventDefault(); - $this = $(this); - isExpanded = $this.find('i').hasClass('fa-angle-double-right'); - tooltipLabel = isExpanded ? __('Expand sidebar') : __('Collapse sidebar'); - $allGutterToggleIcons = $('.js-sidebar-toggle i'); if (isExpanded) { $allGutterToggleIcons.removeClass('fa-angle-double-right').addClass('fa-angle-double-left'); @@ -77,15 +76,9 @@ Sidebar.prototype.sidebarToggleClicked = function(e, triggered) { }; Sidebar.prototype.toggleTodo = function(e) { - var $this, ajaxType, url; - $this = $(e.currentTarget); - ajaxType = $this.data('deletePath') ? 'delete' : 'post'; - - if ($this.data('deletePath')) { - url = String($this.data('deletePath')); - } else { - url = String($this.data('createPath')); - } + const $this = $(e.currentTarget); + const ajaxType = $this.data('deletePath') ? 'delete' : 'post'; + const url = String($this.data('deletePath') || $this.data('createPath')); $this.tooltip('hide'); @@ -141,13 +134,12 @@ Sidebar.prototype.todoUpdateDone = function(data) { }; Sidebar.prototype.sidebarDropdownLoading = function() { - var $loading, $sidebarCollapsedIcon, i, img; - $sidebarCollapsedIcon = $(this) + const $sidebarCollapsedIcon = $(this) .closest('.block') .find('.sidebar-collapsed-icon'); - img = $sidebarCollapsedIcon.find('img'); - i = $sidebarCollapsedIcon.find('i'); - $loading = $('<i class="fa fa-spinner fa-spin"></i>'); + const img = $sidebarCollapsedIcon.find('img'); + const i = $sidebarCollapsedIcon.find('i'); + const $loading = $('<i class="fa fa-spinner fa-spin"></i>'); if (img.length) { img.before($loading); return img.hide(); @@ -158,13 +150,12 @@ Sidebar.prototype.sidebarDropdownLoading = function() { }; Sidebar.prototype.sidebarDropdownLoaded = function() { - var $sidebarCollapsedIcon, i, img; - $sidebarCollapsedIcon = $(this) + const $sidebarCollapsedIcon = $(this) .closest('.block') .find('.sidebar-collapsed-icon'); - img = $sidebarCollapsedIcon.find('img'); + const img = $sidebarCollapsedIcon.find('img'); $sidebarCollapsedIcon.find('i.fa-spin').remove(); - i = $sidebarCollapsedIcon.find('i'); + const i = $sidebarCollapsedIcon.find('i'); if (img.length) { return img.show(); } else { @@ -173,19 +164,17 @@ Sidebar.prototype.sidebarDropdownLoaded = function() { }; Sidebar.prototype.sidebarCollapseClicked = function(e) { - var $block, sidebar; if ($(e.currentTarget).hasClass('dont-change-state')) { return; } - sidebar = e.data; + const sidebar = e.data; e.preventDefault(); - $block = $(this).closest('.block'); + const $block = $(this).closest('.block'); return sidebar.openDropdown($block); }; Sidebar.prototype.openDropdown = function(blockOrName) { - var $block; - $block = _.isString(blockOrName) ? this.getBlock(blockOrName) : blockOrName; + const $block = _.isString(blockOrName) ? this.getBlock(blockOrName) : blockOrName; if (!this.isOpen()) { this.setCollapseAfterUpdate($block); this.toggleSidebar('open'); @@ -204,10 +193,9 @@ Sidebar.prototype.setCollapseAfterUpdate = function($block) { }; Sidebar.prototype.onSidebarDropdownHidden = function(e) { - var $block, sidebar; - sidebar = e.data; + const sidebar = e.data; e.preventDefault(); - $block = $(e.target).closest('.block'); + const $block = $(e.target).closest('.block'); return sidebar.sidebarDropdownHidden($block); }; |