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