Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-12-20 16:37:47 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-12-20 16:37:47 +0300
commitaee0a117a889461ce8ced6fcf73207fe017f1d99 (patch)
tree891d9ef189227a8445d83f35c1b0fc99573f4380 /lib/sidebars/concerns
parent8d46af3258650d305f53b819eabf7ab18d22f59e (diff)
Add latest changes from gitlab-org/gitlab@14-6-stable-eev14.6.0-rc42
Diffstat (limited to 'lib/sidebars/concerns')
-rw-r--r--lib/sidebars/concerns/container_with_html_options.rb2
-rw-r--r--lib/sidebars/concerns/link_with_html_options.rb14
-rw-r--r--lib/sidebars/concerns/positionable_list.rb8
3 files changed, 24 insertions, 0 deletions
diff --git a/lib/sidebars/concerns/container_with_html_options.rb b/lib/sidebars/concerns/container_with_html_options.rb
index 79dddd309b5..796b7cbe275 100644
--- a/lib/sidebars/concerns/container_with_html_options.rb
+++ b/lib/sidebars/concerns/container_with_html_options.rb
@@ -3,6 +3,8 @@
module Sidebars
module Concerns
module ContainerWithHtmlOptions
+ include LinkWithHtmlOptions
+
# The attributes returned from this method
# will be applied to helper methods like
# `link_to` or the div containing the container.
diff --git a/lib/sidebars/concerns/link_with_html_options.rb b/lib/sidebars/concerns/link_with_html_options.rb
new file mode 100644
index 00000000000..4ca748e0a71
--- /dev/null
+++ b/lib/sidebars/concerns/link_with_html_options.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+module Sidebars
+ module Concerns
+ module LinkWithHtmlOptions
+ # add on specific items as the pertain to `link_to` objects specifically
+ def link_html_options
+ container_html_options.tap do |html_options|
+ html_options[:class] = [*html_options[:class], 'gl-link'].join(' ')
+ end
+ end
+ end
+ end
+end
diff --git a/lib/sidebars/concerns/positionable_list.rb b/lib/sidebars/concerns/positionable_list.rb
index 0bbe1d918e5..459af466690 100644
--- a/lib/sidebars/concerns/positionable_list.rb
+++ b/lib/sidebars/concerns/positionable_list.rb
@@ -44,6 +44,14 @@ module Sidebars
list[index] = new_element
end
+ def remove_element(list, element_to_remove)
+ index = index_of(list, element_to_remove)
+
+ return unless index
+
+ list.slice!(index)
+ end
+
private
# Classes including this method will have to define