diff options
author | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 22:34:23 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 22:34:23 +0300 |
commit | 6438df3a1e0fb944485cebf07976160184697d72 (patch) | |
tree | 00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /app/assets/javascripts/right_sidebar.js | |
parent | 42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff) |
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'app/assets/javascripts/right_sidebar.js')
-rw-r--r-- | app/assets/javascripts/right_sidebar.js | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/app/assets/javascripts/right_sidebar.js b/app/assets/javascripts/right_sidebar.js index 6f43f837374..b9bc799fb0b 100644 --- a/app/assets/javascripts/right_sidebar.js +++ b/app/assets/javascripts/right_sidebar.js @@ -15,13 +15,13 @@ function Sidebar() { this.addEventListeners(); } -Sidebar.initialize = function() { +Sidebar.initialize = function () { if (!this.instance) { this.instance = new Sidebar(); } }; -Sidebar.prototype.removeListeners = function() { +Sidebar.prototype.removeListeners = function () { this.sidebar.off('click', '.sidebar-collapsed-icon'); // eslint-disable-next-line @gitlab/no-global-event-off this.sidebar.off('hidden.gl.dropdown'); @@ -32,7 +32,7 @@ Sidebar.prototype.removeListeners = function() { $(document).off('click', '.js-sidebar-toggle'); }; -Sidebar.prototype.addEventListeners = function() { +Sidebar.prototype.addEventListeners = function () { const $document = $(document); this.sidebar.on('click', '.sidebar-collapsed-icon', this, this.sidebarCollapseClicked); @@ -44,7 +44,7 @@ Sidebar.prototype.addEventListeners = function() { .on('click', '.js-issuable-todo', this.toggleTodo); }; -Sidebar.prototype.sidebarToggleClicked = function(e, triggered) { +Sidebar.prototype.sidebarToggleClicked = function (e, triggered) { const $this = $(this); const $collapseIcon = $('.js-sidebar-collapse'); const $expandIcon = $('.js-sidebar-expand'); @@ -60,9 +60,7 @@ Sidebar.prototype.sidebarToggleClicked = function(e, triggered) { $('aside.right-sidebar') .removeClass('right-sidebar-expanded') .addClass('right-sidebar-collapsed'); - $('.layout-page') - .removeClass('right-sidebar-expanded') - .addClass('right-sidebar-collapsed'); + $('.layout-page').removeClass('right-sidebar-expanded').addClass('right-sidebar-collapsed'); } else { $toggleContainer.data('is-expanded', true); $expandIcon.addClass('hidden'); @@ -70,9 +68,7 @@ Sidebar.prototype.sidebarToggleClicked = function(e, triggered) { $('aside.right-sidebar') .removeClass('right-sidebar-collapsed') .addClass('right-sidebar-expanded'); - $('.layout-page') - .removeClass('right-sidebar-collapsed') - .addClass('right-sidebar-expanded'); + $('.layout-page').removeClass('right-sidebar-collapsed').addClass('right-sidebar-expanded'); } $this.attr('data-original-title', tooltipLabel); @@ -82,16 +78,14 @@ Sidebar.prototype.sidebarToggleClicked = function(e, triggered) { } }; -Sidebar.prototype.toggleTodo = function(e) { +Sidebar.prototype.toggleTodo = function (e) { const $this = $(e.currentTarget); const ajaxType = $this.data('deletePath') ? 'delete' : 'post'; const url = String($this.data('deletePath') || $this.data('createPath')); hide($this); - $('.js-issuable-todo') - .disable() - .addClass('is-loading'); + $('.js-issuable-todo').disable().addClass('is-loading'); axios[ajaxType](url, { issuable_id: $this.data('issuableId'), @@ -110,7 +104,7 @@ Sidebar.prototype.toggleTodo = function(e) { ); }; -Sidebar.prototype.todoUpdateDone = function(data) { +Sidebar.prototype.todoUpdateDone = function (data) { const deletePath = data.delete_path ? data.delete_path : null; const attrPrefix = deletePath ? 'mark' : 'todo'; const $todoBtns = $('.js-issuable-todo'); @@ -140,7 +134,7 @@ Sidebar.prototype.todoUpdateDone = function(data) { }); }; -Sidebar.prototype.sidebarCollapseClicked = function(e) { +Sidebar.prototype.sidebarCollapseClicked = function (e) { if ($(e.currentTarget).hasClass('dont-change-state')) { return; } @@ -150,7 +144,7 @@ Sidebar.prototype.sidebarCollapseClicked = function(e) { return sidebar.openDropdown($block); }; -Sidebar.prototype.openDropdown = function(blockOrName) { +Sidebar.prototype.openDropdown = function (blockOrName) { const $block = typeof blockOrName === 'string' ? this.getBlock(blockOrName) : blockOrName; if (!this.isOpen()) { this.setCollapseAfterUpdate($block); @@ -164,19 +158,19 @@ Sidebar.prototype.openDropdown = function(blockOrName) { }); }; -Sidebar.prototype.setCollapseAfterUpdate = function($block) { +Sidebar.prototype.setCollapseAfterUpdate = function ($block) { $block.addClass('collapse-after-update'); return $('.layout-page').addClass('with-overlay'); }; -Sidebar.prototype.onSidebarDropdownHidden = function(e) { +Sidebar.prototype.onSidebarDropdownHidden = function (e) { const sidebar = e.data; e.preventDefault(); const $block = $(e.target).closest('.block'); return sidebar.sidebarDropdownHidden($block); }; -Sidebar.prototype.sidebarDropdownHidden = function($block) { +Sidebar.prototype.sidebarDropdownHidden = function ($block) { if ($block.hasClass('collapse-after-update')) { $block.removeClass('collapse-after-update'); $('.layout-page').removeClass('with-overlay'); @@ -184,11 +178,11 @@ Sidebar.prototype.sidebarDropdownHidden = function($block) { } }; -Sidebar.prototype.triggerOpenSidebar = function() { +Sidebar.prototype.triggerOpenSidebar = function () { return this.sidebar.find('.js-sidebar-toggle').trigger('click'); }; -Sidebar.prototype.toggleSidebar = function(action) { +Sidebar.prototype.toggleSidebar = function (action) { if (action == null) { action = 'toggle'; } @@ -207,11 +201,11 @@ Sidebar.prototype.toggleSidebar = function(action) { } }; -Sidebar.prototype.isOpen = function() { +Sidebar.prototype.isOpen = function () { return this.sidebar.is('.right-sidebar-expanded'); }; -Sidebar.prototype.getBlock = function(name) { +Sidebar.prototype.getBlock = function (name) { return this.sidebar.find(`.block.${name}`); }; |