| |   |
| 84 | 84 | out << "<td> </td></tr>\n" |
| 85 | 85 | out << "</thead>\n" |
| 86 | 86 | out << differ.render(Gitorious::Diff::InlineTableCallback.new) |
| 87 | out << %Q{<tr class="toggle_diff"><td colspan="3">} |
| 88 | out << %Q{<small>#{link_to_function "toggle raw diff", "$('diff#{udiff.object_id}').toggle()"}</small></td></tr>} |
| 89 | out << %Q{<tr class="raw_diff"><td colspan="3" style="display:none" id="diff#{udiff.object_id}">} |
| 90 | out << %Q{<pre>#{h(udiff)}</pre>} |
| 91 | out << "</td></tr>" |
| 87 | 92 | out << "</table>" |
| 88 | 93 | out |
| 89 | 94 | end |
| … | … | |
| 98 | 98 | out = %Q{<table class="codediff sidebyside">\n} |
| 99 | 99 | out << %Q{<colgroup class="left"><col class="lines"/><col class="code"/></colgroup>} |
| 100 | 100 | out << %Q{<colgroup class="right"><col class="lines"/><col class="code"/></colgroup>} |
| 101 | | out << %Q{<thead><th colspan="2">#{src_sha}</th>} |
| 102 | | out << %Q{<th colspan="2">#{dst_sha}</th></thead>} |
| 101 | out << %Q{<thead><th colspan="2" class="line-numbers">#{src_sha}</th>} |
| 102 | out << %Q{<th colspan="2" class="line-numbers">#{dst_sha}</th></thead>} |
| 103 | 103 | out << differ.render(Gitorious::Diff::SidebysideTableCallback.new) |
| 104 | out << %Q{<tr class="toggle_diff"><td colspan="4">} |
| 105 | out << %Q{<small>#{link_to_function "toggle raw diff", "$('diff#{udiff.object_id}').toggle()"}</small></td></tr>} |
| 106 | out << %Q{<tr class="raw_diff"><td colspan="4" style="display:none" id="diff#{udiff.object_id}">} |
| 107 | out << %Q{<pre>#{h(udiff)}</pre>} |
| 108 | out << "</td></tr>" |
| 104 | 109 | out << "</table>" |
| 105 | 110 | out |
| 106 | 111 | end |
| toggle raw diff |
--- a/app/helpers/browse_helper.rb
+++ b/app/helpers/browse_helper.rb
@@ -84,6 +84,11 @@ module BrowseHelper
out << "<td> </td></tr>\n"
out << "</thead>\n"
out << differ.render(Gitorious::Diff::InlineTableCallback.new)
+ out << %Q{<tr class="toggle_diff"><td colspan="3">}
+ out << %Q{<small>#{link_to_function "toggle raw diff", "$('diff#{udiff.object_id}').toggle()"}</small></td></tr>}
+ out << %Q{<tr class="raw_diff"><td colspan="3" style="display:none" id="diff#{udiff.object_id}">}
+ out << %Q{<pre>#{h(udiff)}</pre>}
+ out << "</td></tr>"
out << "</table>"
out
end
@@ -93,9 +98,14 @@ module BrowseHelper
out = %Q{<table class="codediff sidebyside">\n}
out << %Q{<colgroup class="left"><col class="lines"/><col class="code"/></colgroup>}
out << %Q{<colgroup class="right"><col class="lines"/><col class="code"/></colgroup>}
- out << %Q{<thead><th colspan="2">#{src_sha}</th>}
- out << %Q{<th colspan="2">#{dst_sha}</th></thead>}
+ out << %Q{<thead><th colspan="2" class="line-numbers">#{src_sha}</th>}
+ out << %Q{<th colspan="2" class="line-numbers">#{dst_sha}</th></thead>}
out << differ.render(Gitorious::Diff::SidebysideTableCallback.new)
+ out << %Q{<tr class="toggle_diff"><td colspan="4">}
+ out << %Q{<small>#{link_to_function "toggle raw diff", "$('diff#{udiff.object_id}').toggle()"}</small></td></tr>}
+ out << %Q{<tr class="raw_diff"><td colspan="4" style="display:none" id="diff#{udiff.object_id}">}
+ out << %Q{<pre>#{h(udiff)}</pre>}
+ out << "</td></tr>"
out << "</table>"
out
end |
| |   |
| 22 | 22 | <h2>Commit diff</h2> |
| 23 | 23 | <%= render_diffmode_selector -%> |
| 24 | 24 | |
| 25 | | <% @diff.each do |file| -%> |
| 25 | <% @diff.each do |file, index| -%> |
| 26 | 26 | <h4><%= h(file.path) -%><%#=link_to h(file.path), blob_path(file.sha, file.path) -%></h4> |
| 27 | 27 | <%= render_diff(file.patch, file.src, file.dst, @diffmode) -%> |
| 28 | | <small><%= link_to_function "toggle raw diff", "$('#{file.object_id}').toggle()" -%></small> |
| 29 | | <div class="toggle_diff" style="display:none" id="<%= file.object_id -%>"> |
| 30 | | <p><pre><%= h(file.patch) -%></pre></p> |
| 31 | | </div> |
| 32 | 28 | <% end -%> |
| 33 | 29 | <% end -%> |
| 34 | 30 | |
| toggle raw diff |
--- a/app/views/browse/commit.html.erb
+++ b/app/views/browse/commit.html.erb
@@ -22,13 +22,9 @@
<h2>Commit diff</h2>
<%= render_diffmode_selector -%>
- <% @diff.each do |file| -%>
+ <% @diff.each do |file, index| -%>
<h4><%= h(file.path) -%><%#=link_to h(file.path), blob_path(file.sha, file.path) -%></h4>
<%= render_diff(file.patch, file.src, file.dst, @diffmode) -%>
- <small><%= link_to_function "toggle raw diff", "$('#{file.object_id}').toggle()" -%></small>
- <div class="toggle_diff" style="display:none" id="<%= file.object_id -%>">
- <p><pre><%= h(file.patch) -%></pre></p>
- </div>
<% end -%>
<% end -%>
|
| |   |
| 618 | 618 | } |
| 619 | 619 | |
| 620 | 620 | /* diff mode selector */ |
| 621 | | ul.mode_selector { float: right;} |
| 621 | ul.mode_selector { |
| 622 | float: right; |
| 623 | margin-top: -35px; |
| 624 | } |
| 622 | 625 | ul.mode_selector li { |
| 623 | 626 | display:inline; |
| 624 | 627 | margin-left: 1em; |
| … | … | |
| 630 | 630 | ul.mode_selector li.selected { border-bottom: 1px solid #666; } |
| 631 | 631 | |
| 632 | 632 | /* Diff rendering */ |
| 633 | | |
| 634 | | .toggle_diff { |
| 635 | | |
| 633 | tr.toggle_diff { border-top: 1px solid #999; } |
| 634 | tr.toggle_diff td { |
| 635 | background: #ddd; |
| 636 | padding: 0 5px 2px 5px; |
| 637 | margin-bottom: 5px; |
| 638 | } |
| 639 | tr.toggle_diff td small { float:right;} |
| 640 | tr.raw_diff td { |
| 641 | padding-top: 5px; |
| 636 | 642 | } |
| 637 | 643 | |
| 638 | 644 | table tr .line-numbers { |
| … | … | |
| 664 | 664 | word-wrap: break-word; /* Internet Explorer 5.5+ */ |
| 665 | 665 | background: #fff; |
| 666 | 666 | font: 95%/110% "Bitstream Vera Sans Mono", Monaco, "Courier New", Courier, monospace; |
| 667 | border-right: 1px solid #999; |
| 667 | 668 | } |
| 668 | 669 | |
| 669 | 670 | table tr td.unwrapped { |
| toggle raw diff |
--- a/public/stylesheets/base.css
+++ b/public/stylesheets/base.css
@@ -618,7 +618,10 @@ small.hint { font-size: 83%;}
}
/* diff mode selector */
-ul.mode_selector { float: right;}
+ul.mode_selector {
+ float: right;
+ margin-top: -35px;
+}
ul.mode_selector li {
display:inline;
margin-left: 1em;
@@ -627,9 +630,15 @@ ul.mode_selector li.list_header { font-weight: bold; }
ul.mode_selector li.selected { border-bottom: 1px solid #666; }
/* Diff rendering */
-
-.toggle_diff {
-
+tr.toggle_diff { border-top: 1px solid #999; }
+tr.toggle_diff td {
+ background: #ddd;
+ padding: 0 5px 2px 5px;
+ margin-bottom: 5px;
+}
+tr.toggle_diff td small { float:right;}
+tr.raw_diff td {
+ padding-top: 5px;
}
table tr .line-numbers {
@@ -655,6 +664,7 @@ table tr td.code {
word-wrap: break-word; /* Internet Explorer 5.5+ */
background: #fff;
font: 95%/110% "Bitstream Vera Sans Mono", Monaco, "Courier New", Courier, monospace;
+ border-right: 1px solid #999;
}
table tr td.unwrapped { |