Added a checkbox to toggle line wrapping in diff.
This commit is contained in:
parent
070e3964dc
commit
0bf45aece3
3 changed files with 27 additions and 2 deletions
|
@ -0,0 +1,14 @@
|
||||||
|
$ ->
|
||||||
|
# Toggle line wrapping in diff.
|
||||||
|
#
|
||||||
|
# %div.diff-file
|
||||||
|
# %input.js-toggle-diff-line-wrap
|
||||||
|
# %td.line_content
|
||||||
|
#
|
||||||
|
$("body").on "click", ".js-toggle-diff-line-wrap", (e) ->
|
||||||
|
diffFile = $(@).closest(".diff-file")
|
||||||
|
if $(@).is(":checked")
|
||||||
|
diffFile.addClass("diff-wrap-lines")
|
||||||
|
else
|
||||||
|
diffFile.removeClass("diff-wrap-lines")
|
||||||
|
|
|
@ -125,8 +125,6 @@
|
||||||
}
|
}
|
||||||
.line_content {
|
.line_content {
|
||||||
display: block;
|
display: block;
|
||||||
white-space: pre;
|
|
||||||
height: 18px;
|
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
padding: 0px 0.5em;
|
padding: 0px 0.5em;
|
||||||
border: none;
|
border: none;
|
||||||
|
@ -341,3 +339,12 @@
|
||||||
margin: 0;
|
margin: 0;
|
||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.diff-file .line_content {
|
||||||
|
white-space: pre;
|
||||||
|
}
|
||||||
|
|
||||||
|
.diff-wrap-lines .line_content {
|
||||||
|
white-space: pre-wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,10 @@
|
||||||
%span.file-mode= "#{diff.a_mode} → #{diff.b_mode}"
|
%span.file-mode= "#{diff.a_mode} → #{diff.b_mode}"
|
||||||
|
|
||||||
.diff-btn-group
|
.diff-btn-group
|
||||||
|
%label
|
||||||
|
= check_box_tag nil, 1, false, class: "js-toggle-diff-line-wrap"
|
||||||
|
Wrap text
|
||||||
|
|
||||||
= link_to "#", class: "js-toggle-diff-comments btn btn-small" do
|
= link_to "#", class: "js-toggle-diff-comments btn btn-small" do
|
||||||
%i.icon-chevron-down
|
%i.icon-chevron-down
|
||||||
Diff comments
|
Diff comments
|
||||||
|
|
Loading…
Reference in a new issue