##// END OF EJS Templates
Diff: adds some space between 2 changes in the same file and reduces html size....
Jean-Philippe Lang -
r1472:36162c6cf261
parent child
Show More
@@ -1,95 +1,91
1 1 <h2><%= l(:label_revision) %> <%= format_revision(@rev) %> <%= @path.gsub(/^.*\//, '') %></h2>
2 2
3 3 <!-- Choose view type -->
4 4 <% form_tag({ :controller => 'repositories', :action => 'diff'}, :method => 'get') do %>
5 5 <% params.each do |k, p| %>
6 6 <% if k != "type" %>
7 7 <%= hidden_field_tag(k,p) %>
8 8 <% end %>
9 9 <% end %>
10 10 <p><label><%= l(:label_view_diff) %></label>
11 11 <%= select_tag 'type', options_for_select([[l(:label_diff_inline), "inline"], [l(:label_diff_side_by_side), "sbs"]], @diff_type), :onchange => "if (this.value != '') {this.form.submit()}" %></p>
12 12 <% end %>
13 13
14 <% cache(@cache_key) do %>
15 <% @diff.each do |table_file| %>
14 <% cache(@cache_key) do -%>
15 <% @diff.each do |table_file| -%>
16 16 <div class="autoscroll">
17 <% if @diff_type == 'sbs' %>
18 <table class="filecontent CodeRay">
19 <thead>
20 <tr>
21 <th colspan="4" class="filename">
22 <%= table_file.file_name %>
23 </th>
24 </tr>
25 <tr>
26 <th colspan="2">@<%= format_revision @rev %></th>
27 <th colspan="2">@<%= format_revision @rev_to %></th>
28 </tr>
29 </thead>
30 <tbody>
31 <% table_file.keys.sort.each do |key| %>
32 <tr>
33 <th class="line-num">
34 <%= table_file[key].nb_line_left %>
35 </th>
36 <td class="line-code <%= table_file[key].type_diff_left %>">
37 <pre><%=to_utf8 table_file[key].line_left %></pre>
38 </td>
39 <th class="line-num">
40 <%= table_file[key].nb_line_right %>
41 </th>
42 <td class="line-code <%= table_file[key].type_diff_right %>">
43 <pre><%=to_utf8 table_file[key].line_right %></pre>
44 </td>
45 </tr>
46 <% end %>
47 </tbody>
48 </table>
17 <% if @diff_type == 'sbs' -%>
18 <table class="filecontent CodeRay">
19 <thead>
20 <tr><th colspan="4" class="filename"><%= table_file.file_name %></th></tr>
21 <tr>
22 <th colspan="2">@<%= format_revision @rev %></th>
23 <th colspan="2">@<%= format_revision @rev_to %></th>
24 </tr>
25 </thead>
26 <tbody>
27 <% prev_line_left, prev_line_right = nil, nil -%>
28 <% table_file.keys.sort.each do |key| -%>
29 <% if prev_line_left && prev_line_right && (table_file[key].nb_line_left != prev_line_left+1) && (table_file[key].nb_line_right != prev_line_right+1) -%>
30 <tr class="spacing"><td colspan="4"></td></tr>
31 <% end -%>
32 <tr>
33 <th class="line-num"><%= table_file[key].nb_line_left %></th>
34 <td class="line-code <%= table_file[key].type_diff_left %>">
35 <pre><%=to_utf8 table_file[key].line_left %></pre>
36 </td>
37 <th class="line-num"><%= table_file[key].nb_line_right %></th>
38 <td class="line-code <%= table_file[key].type_diff_right %>">
39 <pre><%=to_utf8 table_file[key].line_right %></pre>
40 </td>
41 </tr>
42 <% prev_line_left, prev_line_right = table_file[key].nb_line_left.to_i, table_file[key].nb_line_right.to_i -%>
43 <% end -%>
44 </tbody>
45 </table>
46
47 <% else -%>
48 <table class="filecontent CodeRay">
49 <thead>
50 <tr><th colspan="3" class="filename"><%= table_file.file_name %></th></tr>
51 <tr>
52 <th>@<%= format_revision @rev %></th>
53 <th>@<%= format_revision @rev_to %></th>
54 <th></th>
55 </tr>
56 </thead>
57 <tbody>
58 <% prev_line_left, prev_line_right = nil, nil -%>
59 <% table_file.keys.sort.each do |key, line| %>
60 <% if prev_line_left && prev_line_right && (table_file[key].nb_line_left != prev_line_left+1) && (table_file[key].nb_line_right != prev_line_right+1) -%>
61 <tr class="spacing"><td colspan="3"></td></tr>
62 <% end -%>
63 <tr>
64 <th class="line-num"><%= table_file[key].nb_line_left %></th>
65 <th class="line-num"><%= table_file[key].nb_line_right %></th>
66 <% if table_file[key].line_left.empty? -%>
67 <td class="line-code <%= table_file[key].type_diff_right %>">
68 <pre><%=to_utf8 table_file[key].line_right %></pre>
69 </td>
70 <% else -%>
71 <td class="line-code <%= table_file[key].type_diff_left %>">
72 <pre><%=to_utf8 table_file[key].line_left %></pre>
73 </td>
74 <% end -%>
75 </tr>
76 <% prev_line_left = table_file[key].nb_line_left.to_i if table_file[key].nb_line_left.to_i > 0 -%>
77 <% prev_line_right = table_file[key].nb_line_right.to_i if table_file[key].nb_line_right.to_i > 0 -%>
78 <% end -%>
79 </tbody>
80 </table>
81 <% end -%>
49 82
50 <% else %>
51 <table class="filecontent CodeRay">
52 <thead>
53 <tr>
54 <th colspan="3" class="filename">
55 <%= table_file.file_name %>
56 </th>
57 </tr>
58 <tr>
59 <th>@<%= format_revision @rev %></th>
60 <th>@<%= format_revision @rev_to %></th>
61 <th></th>
62 </tr>
63 </thead>
64 <tbody>
65 <% table_file.keys.sort.each do |key, line| %>
66 <tr>
67 <th class="line-num">
68 <%= table_file[key].nb_line_left %>
69 </th>
70 <th class="line-num">
71 <%= table_file[key].nb_line_right %>
72 </th>
73 <% if table_file[key].line_left.empty? %>
74 <td class="line-code <%= table_file[key].type_diff_right %>">
75 <pre><%=to_utf8 table_file[key].line_right %></pre>
76 </td>
77 <% else %>
78 <td class="line-code <%= table_file[key].type_diff_left %>">
79 <pre><%=to_utf8 table_file[key].line_left %></pre>
80 </td>
81 <% end %>
82 </tr>
83 <% end %>
84 </tbody>
85 </table>
86 <% end %>
87 83 </div>
88 <% end %>
89 <% end %>
84 <% end -%>
85 <% end -%>
90 86
91 87 <% html_title(with_leading_slash(@path), 'Diff') -%>
92 88
93 89 <% content_for :header_tags do %>
94 90 <%= stylesheet_link_tag "scm" %>
95 91 <% end %>
@@ -1,150 +1,150
1 1
2 2 table.filecontent { border: 1px solid #ccc; border-collapse: collapse; width:98%; }
3 3 table.filecontent th { border: 1px solid #ccc; background-color: #eee; }
4 4 table.filecontent th.filename { background-color: #ddc; text-align: left; }
5 table.filecontent tr.spacing { border: 1px solid #d7d7d7; }
5 table.filecontent tr.spacing td { border: 1px solid #d7d7d7; height: 0.4em; }
6 6 table.filecontent th.line-num {
7 7 border: 1px solid #d7d7d7;
8 8 font-size: 0.8em;
9 9 text-align: right;
10 10 width: 2%;
11 11 padding-right: 3px;
12 12 }
13 13 table.filecontent td.line-code pre {
14 14 white-space: pre-wrap; /* CSS2.1 compliant */
15 15 white-space: -moz-pre-wrap; /* Mozilla-based browsers */
16 16 white-space: -o-pre-wrap; /* Opera 7+ */
17 17 }
18 18
19 19 /* 12 different colors for the annonate view */
20 20 table.annotate tr.bloc-0 {background: #FFFFBF;}
21 21 table.annotate tr.bloc-1 {background: #EABFFF;}
22 22 table.annotate tr.bloc-2 {background: #BFFFFF;}
23 23 table.annotate tr.bloc-3 {background: #FFD9BF;}
24 24 table.annotate tr.bloc-4 {background: #E6FFBF;}
25 25 table.annotate tr.bloc-5 {background: #BFCFFF;}
26 26 table.annotate tr.bloc-6 {background: #FFBFEF;}
27 27 table.annotate tr.bloc-7 {background: #FFE6BF;}
28 28 table.annotate tr.bloc-8 {background: #FFE680;}
29 29 table.annotate tr.bloc-9 {background: #AA80FF;}
30 30 table.annotate tr.bloc-10 {background: #FFBFDC;}
31 31 table.annotate tr.bloc-11 {background: #BFE4FF;}
32 32
33 33 table.annotate td.revision {
34 34 text-align: center;
35 35 width: 2%;
36 36 padding-left: 1em;
37 37 background: inherit;
38 38 }
39 39
40 40 table.annotate td.author {
41 41 text-align: center;
42 42 border-right: 1px solid #d7d7d7;
43 43 white-space: nowrap;
44 44 padding-left: 1em;
45 45 padding-right: 1em;
46 46 width: 3%;
47 47 background: inherit;
48 48 font-size: 90%;
49 49 }
50 50
51 51 table.annotate td.line-code { background-color: #fafafa; }
52 52
53 53 div.action_M { background: #fd8 }
54 54 div.action_D { background: #f88 }
55 55 div.action_A { background: #bfb }
56 56
57 57 /************* Coderay styles *************/
58 58
59 59 table.CodeRay {
60 60 background-color: #fafafa;
61 61 }
62 62 .CodeRay pre { margin: 0px }
63 63
64 64 span.CodeRay { white-space: pre; border: 0px; padding: 2px }
65 65
66 66 .CodeRay .no { padding: 0px 4px }
67 67 .CodeRay .code { }
68 68
69 69 ol.CodeRay { font-size: 10pt }
70 70 ol.CodeRay li { white-space: pre }
71 71
72 72 .CodeRay .code pre { overflow: auto }
73 73
74 74 .CodeRay .debug { color:white ! important; background:blue ! important; }
75 75
76 76 .CodeRay .af { color:#00C }
77 77 .CodeRay .an { color:#007 }
78 78 .CodeRay .av { color:#700 }
79 79 .CodeRay .aw { color:#C00 }
80 80 .CodeRay .bi { color:#509; font-weight:bold }
81 81 .CodeRay .c { color:#666; }
82 82
83 83 .CodeRay .ch { color:#04D }
84 84 .CodeRay .ch .k { color:#04D }
85 85 .CodeRay .ch .dl { color:#039 }
86 86
87 87 .CodeRay .cl { color:#B06; font-weight:bold }
88 88 .CodeRay .co { color:#036; font-weight:bold }
89 89 .CodeRay .cr { color:#0A0 }
90 90 .CodeRay .cv { color:#369 }
91 91 .CodeRay .df { color:#099; font-weight:bold }
92 92 .CodeRay .di { color:#088; font-weight:bold }
93 93 .CodeRay .dl { color:black }
94 94 .CodeRay .do { color:#970 }
95 95 .CodeRay .ds { color:#D42; font-weight:bold }
96 96 .CodeRay .e { color:#666; font-weight:bold }
97 97 .CodeRay .en { color:#800; font-weight:bold }
98 98 .CodeRay .er { color:#F00; background-color:#FAA }
99 99 .CodeRay .ex { color:#F00; font-weight:bold }
100 100 .CodeRay .fl { color:#60E; font-weight:bold }
101 101 .CodeRay .fu { color:#06B; font-weight:bold }
102 102 .CodeRay .gv { color:#d70; font-weight:bold }
103 103 .CodeRay .hx { color:#058; font-weight:bold }
104 104 .CodeRay .i { color:#00D; font-weight:bold }
105 105 .CodeRay .ic { color:#B44; font-weight:bold }
106 106
107 107 .CodeRay .il { background: #eee }
108 108 .CodeRay .il .il { background: #ddd }
109 109 .CodeRay .il .il .il { background: #ccc }
110 110 .CodeRay .il .idl { font-weight: bold; color: #888 }
111 111
112 112 .CodeRay .in { color:#B2B; font-weight:bold }
113 113 .CodeRay .iv { color:#33B }
114 114 .CodeRay .la { color:#970; font-weight:bold }
115 115 .CodeRay .lv { color:#963 }
116 116 .CodeRay .oc { color:#40E; font-weight:bold }
117 117 .CodeRay .of { color:#000; font-weight:bold }
118 118 .CodeRay .op { }
119 119 .CodeRay .pc { color:#038; font-weight:bold }
120 120 .CodeRay .pd { color:#369; font-weight:bold }
121 121 .CodeRay .pp { color:#579 }
122 122 .CodeRay .pt { color:#339; font-weight:bold }
123 123 .CodeRay .r { color:#080; font-weight:bold }
124 124
125 125 .CodeRay .rx { background-color:#fff0ff }
126 126 .CodeRay .rx .k { color:#808 }
127 127 .CodeRay .rx .dl { color:#404 }
128 128 .CodeRay .rx .mod { color:#C2C }
129 129 .CodeRay .rx .fu { color:#404; font-weight: bold }
130 130
131 131 .CodeRay .s { background-color:#fff0f0 }
132 132 .CodeRay .s .s { background-color:#ffe0e0 }
133 133 .CodeRay .s .s .s { background-color:#ffd0d0 }
134 134 .CodeRay .s .k { color:#D20 }
135 135 .CodeRay .s .dl { color:#710 }
136 136
137 137 .CodeRay .sh { background-color:#f0fff0 }
138 138 .CodeRay .sh .k { color:#2B2 }
139 139 .CodeRay .sh .dl { color:#161 }
140 140
141 141 .CodeRay .sy { color:#A60 }
142 142 .CodeRay .sy .k { color:#A60 }
143 143 .CodeRay .sy .dl { color:#630 }
144 144
145 145 .CodeRay .ta { color:#070 }
146 146 .CodeRay .tf { color:#070; font-weight:bold }
147 147 .CodeRay .ts { color:#D70; font-weight:bold }
148 148 .CodeRay .ty { color:#339; font-weight:bold }
149 149 .CodeRay .v { color:#036 }
150 150 .CodeRay .xt { color:#444 }
General Comments 0
You need to be logged in to leave comments. Login now