2016-01-29 22:53:50 +05:30
|
|
|
module Gitlab
|
|
|
|
module Diff
|
2017-09-10 17:25:29 +05:30
|
|
|
class InlineDiffMarker < Gitlab::StringRangeMarker
|
|
|
|
def mark(line_inline_diffs, mode: nil)
|
2018-03-17 18:26:18 +05:30
|
|
|
mark = super(line_inline_diffs) do |text, left:, right:|
|
2017-09-10 17:25:29 +05:30
|
|
|
%{<span class="#{html_class_names(left, right, mode)}">#{text}</span>}
|
2016-01-29 22:53:50 +05:30
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
mark.html_safe
|
2016-01-29 22:53:50 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
def html_class_names(left, right, mode)
|
2016-06-02 11:05:42 +05:30
|
|
|
class_names = ["idiff"]
|
2017-09-10 17:25:29 +05:30
|
|
|
class_names << "left" if left
|
|
|
|
class_names << "right" if right
|
2016-06-02 11:05:42 +05:30
|
|
|
class_names << mode if mode
|
|
|
|
class_names.join(" ")
|
|
|
|
end
|
2016-01-29 22:53:50 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|