Added a checkbox to toggle line wrapping in diff.

This commit is contained in:
Yuriy Glukhov 2014-08-13 14:04:13 +03:00 committed by uran
parent 070e3964dc
commit 0bf45aece3
3 changed files with 27 additions and 2 deletions

View file

@ -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")

View file

@ -125,8 +125,6 @@
}
.line_content {
display: block;
white-space: pre;
height: 18px;
margin: 0px;
padding: 0px 0.5em;
border: none;
@ -341,3 +339,12 @@
margin: 0;
border: none;
}
.diff-file .line_content {
white-space: pre;
}
.diff-wrap-lines .line_content {
white-space: pre-wrap;
}

View file

@ -16,6 +16,10 @@
%span.file-mode= "#{diff.a_mode} → #{diff.b_mode}"
.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
%i.icon-chevron-down
Diff comments