diff options
author | Jan Provaznik <jprovaznik@gitlab.com> | 2019-04-02 12:48:20 +0200 |
---|---|---|
committer | Jan Provaznik <jprovaznik@gitlab.com> | 2019-04-04 08:07:58 +0200 |
commit | fec2e27f1dcbb806247d6f78ebae628622c02d52 (patch) | |
tree | 28c1fdcc333629d6de8324c0a02fb12066d73543 /lib/banzai | |
parent | 97ab8539968d52b709cd61c2dd4229d404903e14 (diff) | |
download | gitlab-ce-fec2e27f1dcbb806247d6f78ebae628622c02d52.tar.gz |
[backend] backport of scoped labels
Scoped labels in EE require additional changes in CE code.
Diffstat (limited to 'lib/banzai')
-rw-r--r-- | lib/banzai/filter/abstract_reference_filter.rb | 12 | ||||
-rw-r--r-- | lib/banzai/filter/label_reference_filter.rb | 6 |
2 files changed, 14 insertions, 4 deletions
diff --git a/lib/banzai/filter/abstract_reference_filter.rb b/lib/banzai/filter/abstract_reference_filter.rb index 5f8aca104aa..44b151d01e7 100644 --- a/lib/banzai/filter/abstract_reference_filter.rb +++ b/lib/banzai/filter/abstract_reference_filter.rb @@ -195,15 +195,21 @@ module Banzai content = link_content || object_link_text(object, matches) - %(<a href="#{url}" #{data} - title="#{escape_once(title)}" - class="#{klass}">#{content}</a>) + link = %(<a href="#{url}" #{data} + title="#{escape_once(title)}" + class="#{klass}">#{content}</a>) + + wrap_link(link, object) else match end end end + def wrap_link(link, object) + link + end + def data_attributes_for(text, parent, object, link_content: false, link_reference: false) object_parent_type = parent.is_a?(Group) ? :group : :project diff --git a/lib/banzai/filter/label_reference_filter.rb b/lib/banzai/filter/label_reference_filter.rb index f90a35952e5..77e4c438bd0 100644 --- a/lib/banzai/filter/label_reference_filter.rb +++ b/lib/banzai/filter/label_reference_filter.rb @@ -91,7 +91,11 @@ module Banzai label_suffix = " <i>in #{reference}</i>" if reference.present? end - LabelsHelper.render_colored_label(object, label_suffix) + LabelsHelper.render_colored_label(object, label_suffix: label_suffix, title: tooltip_title(object)) + end + + def tooltip_title(label) + nil end def full_path_ref?(matches) |