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)
|
|
|
|
super(line_inline_diffs) do |text, left:, right:|
|
|
|
|
%{<span class="#{html_class_names(left, right, mode)}">#{text}</span>}
|
2016-01-29 22:53:50 +05:30
|
|
|
end
|
|
|
|
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
|