Show More
@@ -1,225 +1,225 b'' | |||||
1 | ## -*- coding: utf-8 -*- |
|
1 | ## -*- coding: utf-8 -*- | |
2 |
|
2 | |||
3 | <%inherit file="/base/base.html"/> |
|
3 | <%inherit file="/base/base.html"/> | |
4 | <%namespace name="diff_block" file="/changeset/diff_block.html"/> |
|
4 | <%namespace name="diff_block" file="/changeset/diff_block.html"/> | |
5 |
|
5 | |||
6 | <%def name="js_extra()"> |
|
6 | <%def name="js_extra()"> | |
7 | <script type="text/javascript" src="${h.url('/js/mergerly.js')}"></script> |
|
7 | <script type="text/javascript" src="${h.url('/js/mergerly.js')}"></script> | |
8 | </%def> |
|
8 | </%def> | |
9 |
|
9 | |||
10 | <%def name="css_extra()"> |
|
10 | <%def name="css_extra()"> | |
11 | <link rel="stylesheet" type="text/css" href="${h.url('/css/mergerly.css')}"/> |
|
11 | <link rel="stylesheet" type="text/css" href="${h.url('/css/mergerly.css')}"/> | |
12 | </%def> |
|
12 | </%def> | |
13 |
|
13 | |||
14 | <%def name="title()"> |
|
14 | <%def name="title()"> | |
15 | ${_('%s File side-by-side diff') % c.repo_name} |
|
15 | ${_('%s File side-by-side diff') % c.repo_name} | |
16 | %if c.rhodecode_name: |
|
16 | %if c.rhodecode_name: | |
17 | · ${h.branding(c.rhodecode_name)} |
|
17 | · ${h.branding(c.rhodecode_name)} | |
18 | %endif |
|
18 | %endif | |
19 | </%def> |
|
19 | </%def> | |
20 |
|
20 | |||
21 | <%def name="breadcrumbs_links()"> |
|
21 | <%def name="breadcrumbs_links()"> | |
22 | r${c.commit_1.revision}:${h.short_id(c.commit_1.raw_id)} ... r${c.commit_2.revision}:${h.short_id(c.commit_2.raw_id)} |
|
22 | r${c.commit_1.revision}:${h.short_id(c.commit_1.raw_id)} ... r${c.commit_2.revision}:${h.short_id(c.commit_2.raw_id)} | |
23 | </%def> |
|
23 | </%def> | |
24 |
|
24 | |||
25 | <%def name="menu_bar_nav()"> |
|
25 | <%def name="menu_bar_nav()"> | |
26 | ${self.menu_items(active='repositories')} |
|
26 | ${self.menu_items(active='repositories')} | |
27 | </%def> |
|
27 | </%def> | |
28 |
|
28 | |||
29 | <%def name="menu_bar_subnav()"> |
|
29 | <%def name="menu_bar_subnav()"> | |
30 | ${self.repo_menu(active='changelog')} |
|
30 | ${self.repo_menu(active='changelog')} | |
31 | </%def> |
|
31 | </%def> | |
32 |
|
32 | |||
33 | <%def name="main()"> |
|
33 | <%def name="main()"> | |
34 | <div class="box"> |
|
34 | <div class="box"> | |
35 | <div class="title"> |
|
35 | <div class="title"> | |
36 | ${self.repo_page_title(c.rhodecode_db_repo)} |
|
36 | ${self.repo_page_title(c.rhodecode_db_repo)} | |
37 | </div> |
|
37 | </div> | |
38 |
|
38 | |||
39 | <div class="breadcrumbs"> |
|
39 | <div class="breadcrumbs"> | |
40 | ${_('Side-by-side Diff')} r${c.commit_1.revision}:${h.short_id(c.commit_1.raw_id)} ... r${c.commit_2.revision}:${h.short_id(c.commit_2.raw_id)} |
|
40 | ${_('Side-by-side Diff')} r${c.commit_1.revision}:${h.short_id(c.commit_1.raw_id)} ... r${c.commit_2.revision}:${h.short_id(c.commit_2.raw_id)} | |
41 | </div> |
|
41 | </div> | |
42 | <div class="cs_files"> |
|
42 | <div class="cs_files"> | |
43 | <table class="compare_view_files commit_diff"> |
|
43 | <table class="compare_view_files commit_diff"> | |
44 | <tr class="cs_${c.diff_data['operation']} collapse_file" fid="${c.FID}"> |
|
44 | <tr class="cs_${c.diff_data['operation']} collapse_file" fid="${c.FID}"> | |
45 | <td class="cs_icon_td"> |
|
45 | <td class="cs_icon_td"> | |
46 | <span class="collapse_file_icon" fid="${c.FID}"></span> |
|
46 | <span class="collapse_file_icon" fid="${c.FID}"></span> | |
47 | </td> |
|
47 | </td> | |
48 | <td class="cs_icon_td"> |
|
48 | <td class="cs_icon_td"> | |
49 | <div class="flag_status not_reviewed hidden"></div> |
|
49 | <div class="flag_status not_reviewed hidden"></div> | |
50 | </td> |
|
50 | </td> | |
51 | <td class="cs_${c.diff_data['operation']}" id="a_${c.FID}"> |
|
51 | <td class="cs_${c.diff_data['operation']}" id="a_${c.FID}"> | |
52 | <div class="node"> |
|
52 | <div class="node"> | |
53 | <a href="#a_${c.FID}"> |
|
53 | <a href="#a_${c.FID}"> | |
54 | <i class="icon-file-${c.diff_data['operation'].lower()}"></i> |
|
54 | <i class="icon-file-${c.diff_data['operation'].lower()}"></i> | |
55 | ${h.safe_unicode(c.node1.path)} |
|
55 | ${h.safe_unicode(c.node1.path)} | |
56 | </a> |
|
56 | </a> | |
57 | </div> |
|
57 | </div> | |
58 | </td> |
|
58 | </td> | |
59 | <td> |
|
59 | <td> | |
60 | <div class="changes pull-right">${h.fancy_file_stats(c.diff_data['stats'])}</div> |
|
60 | <div class="changes pull-right">${h.fancy_file_stats(c.diff_data['stats'])}</div> | |
61 | <div class="comment-bubble pull-right" data-path="${c.node1.path}"> |
|
61 | <div class="comment-bubble pull-right" data-path="${h.safe_unicode(c.node1.path)}"> | |
62 | <i class="icon-comment"></i> |
|
62 | <i class="icon-comment"></i> | |
63 | </div> |
|
63 | </div> | |
64 | </td> |
|
64 | </td> | |
65 | </tr> |
|
65 | </tr> | |
66 | <tr fid="${c.FID}" id="diff_${c.FID}" class="diff_links"> |
|
66 | <tr fid="${c.FID}" id="diff_${c.FID}" class="diff_links"> | |
67 | <td></td> |
|
67 | <td></td> | |
68 | <td></td> |
|
68 | <td></td> | |
69 | <td class="cs_${c.diff_data['operation']}"> |
|
69 | <td class="cs_${c.diff_data['operation']}"> | |
70 | ${diff_block.diff_menu(c.repo_name, h.safe_unicode(c.node1.path), c.commit_1.raw_id, c.commit_2.raw_id, c.diff_data['operation'])} |
|
70 | ${diff_block.diff_menu(c.repo_name, h.safe_unicode(c.node1.path), c.commit_1.raw_id, c.commit_2.raw_id, c.diff_data['operation'])} | |
71 | </td> |
|
71 | </td> | |
72 | <td class="td-actions rc-form"> |
|
72 | <td class="td-actions rc-form"> | |
73 | <div id="ignorews" class="btn-link show-inline-comments"> |
|
73 | <div id="ignorews" class="btn-link show-inline-comments"> | |
74 | <span data-enabled=false class="toggle">${_('Ignore whitespace')}</span> |
|
74 | <span data-enabled=false class="toggle">${_('Ignore whitespace')}</span> | |
75 | <span data-enabled=true class="toggle" style="display: none">${_('Show whitespace')}</span> |
|
75 | <span data-enabled=true class="toggle" style="display: none">${_('Show whitespace')}</span> | |
76 | </div> | |
|
76 | </div> | | |
77 |
|
77 | |||
78 | <div id="edit_mode" class="btn-link show-inline-comments"> |
|
78 | <div id="edit_mode" class="btn-link show-inline-comments"> | |
79 | <span data-enabled=true class="toggle">${_('Enable editor mode')}</span> |
|
79 | <span data-enabled=true class="toggle">${_('Enable editor mode')}</span> | |
80 | <span data-enabled=false class="toggle" style="display: none">${_('Disable editor mode')}</span> |
|
80 | <span data-enabled=false class="toggle" style="display: none">${_('Disable editor mode')}</span> | |
81 | </div> | |
|
81 | </div> | | |
82 |
|
82 | |||
83 | <div class="btn-link show-inline-comments"> |
|
83 | <div class="btn-link show-inline-comments"> | |
84 | <span id="prev_change" title="${_('Previous change')}"><i class="icon-left"></i></span> |
|
84 | <span id="prev_change" title="${_('Previous change')}"><i class="icon-left"></i></span> | |
85 | <span id="next_change" title="${_('Next change')}"><i class="icon-right"></i></span> |
|
85 | <span id="next_change" title="${_('Next change')}"><i class="icon-right"></i></span> | |
86 | </div> |
|
86 | </div> | |
87 |
|
87 | |||
88 | </td> |
|
88 | </td> | |
89 | </tr> |
|
89 | </tr> | |
90 | <tr id="tr_${c.FID}"> |
|
90 | <tr id="tr_${c.FID}"> | |
91 | <td></td> |
|
91 | <td></td> | |
92 | <td></td> |
|
92 | <td></td> | |
93 | <td class="injected_diff" colspan="2"> |
|
93 | <td class="injected_diff" colspan="2"> | |
94 | <div class="diff-container" id="${'diff-container-%s' % (id(c.diff_data['operation']))}"> |
|
94 | <div class="diff-container" id="${'diff-container-%s' % (id(c.diff_data['operation']))}"> | |
95 | <div id="${c.FID}" class="diffblock margined comm"> |
|
95 | <div id="${c.FID}" class="diffblock margined comm"> | |
96 | <div class="diff-container" > |
|
96 | <div class="diff-container" > | |
97 | <div class="diffblock comm sidebyside"> |
|
97 | <div class="diffblock comm sidebyside"> | |
98 | <div class="code-header"> |
|
98 | <div class="code-header"> | |
99 | <div class="changeset_header"> |
|
99 | <div class="changeset_header"> | |
100 | ${_('mode')}: <span id="selected_mode">plain</span> | |
|
100 | ${_('mode')}: <span id="selected_mode">plain</span> | | |
101 | </div> |
|
101 | </div> | |
102 | </div> |
|
102 | </div> | |
103 | <div id="compare"></div> |
|
103 | <div id="compare"></div> | |
104 | </div> |
|
104 | </div> | |
105 | </div> |
|
105 | </div> | |
106 | </div> |
|
106 | </div> | |
107 | </div> |
|
107 | </div> | |
108 | </td> |
|
108 | </td> | |
109 | </tr> |
|
109 | </tr> | |
110 | </table> |
|
110 | </table> | |
111 | </div> |
|
111 | </div> | |
112 |
|
112 | |||
113 |
|
113 | |||
114 | <script> |
|
114 | <script> | |
115 | var orig1_url = '${h.url('files_raw_home',repo_name=c.repo_name,f_path=h.safe_unicode(c.node1.path),revision=c.commit_1.raw_id)}'; |
|
115 | var orig1_url = '${h.url('files_raw_home',repo_name=c.repo_name,f_path=h.safe_unicode(c.node1.path),revision=c.commit_1.raw_id)}'; | |
116 | var orig2_url = '${h.url('files_raw_home',repo_name=c.repo_name,f_path=h.safe_unicode(c.node2.path),revision=c.commit_2.raw_id)}'; |
|
116 | var orig2_url = '${h.url('files_raw_home',repo_name=c.repo_name,f_path=h.safe_unicode(c.node2.path),revision=c.commit_2.raw_id)}'; | |
117 | $(document).ready(function () { |
|
117 | $(document).ready(function () { | |
118 |
|
118 | |||
119 |
|
119 | |||
120 | var editor = $('#compare'); |
|
120 | var editor = $('#compare'); | |
121 | editor.mergely({ |
|
121 | editor.mergely({ | |
122 | autoupdate: true, |
|
122 | autoupdate: true, | |
123 | width: 'auto', |
|
123 | width: 'auto', | |
124 | height: '600', |
|
124 | height: '600', | |
125 | fgcolor: {a: '#ddffdd', c: '#cccccc', d: '#ffdddd'}, |
|
125 | fgcolor: {a: '#ddffdd', c: '#cccccc', d: '#ffdddd'}, | |
126 | bgcolor: '#fff', |
|
126 | bgcolor: '#fff', | |
127 | viewport: false, |
|
127 | viewport: false, | |
128 | cmsettings: { |
|
128 | cmsettings: { | |
129 | mode: 'text/plain', |
|
129 | mode: 'text/plain', | |
130 | readOnly: true, |
|
130 | readOnly: true, | |
131 | lineWrapping: false, |
|
131 | lineWrapping: false, | |
132 | lineNumbers: true |
|
132 | lineNumbers: true | |
133 | } |
|
133 | } | |
134 | }); |
|
134 | }); | |
135 |
|
135 | |||
136 |
|
136 | |||
137 | var lhs = function(deferred) { |
|
137 | var lhs = function(deferred) { | |
138 | if ("${c.node1.is_binary}" == "True") { |
|
138 | if ("${c.node1.is_binary}" == "True") { | |
139 | deferred.resolve('Binary file'); |
|
139 | deferred.resolve('Binary file'); | |
140 | } |
|
140 | } | |
141 | else if ("${c.node1.commit.__class__.__name__}" == "EmptyCommit") { |
|
141 | else if ("${c.node1.commit.__class__.__name__}" == "EmptyCommit") { | |
142 | deferred.resolve(''); |
|
142 | deferred.resolve(''); | |
143 | } |
|
143 | } | |
144 | else { |
|
144 | else { | |
145 | editor.mergely('lhs', 'loading diff...'); |
|
145 | editor.mergely('lhs', 'loading diff...'); | |
146 | $.ajax(orig1_url, { |
|
146 | $.ajax(orig1_url, { | |
147 | dataType: 'text', |
|
147 | dataType: 'text', | |
148 | success: function(data) { |
|
148 | success: function(data) { | |
149 | // call the complete function to let CodeMirror know |
|
149 | // call the complete function to let CodeMirror know | |
150 | deferred.resolve(data); |
|
150 | deferred.resolve(data); | |
151 | } |
|
151 | } | |
152 | }); |
|
152 | }); | |
153 | } |
|
153 | } | |
154 | }; |
|
154 | }; | |
155 |
|
155 | |||
156 | var rhs = function(deferred) { |
|
156 | var rhs = function(deferred) { | |
157 | if ("${c.node2.is_binary}" == "True") { |
|
157 | if ("${c.node2.is_binary}" == "True") { | |
158 | deferred.resolve('Binary file'); |
|
158 | deferred.resolve('Binary file'); | |
159 | } |
|
159 | } | |
160 | else if ("${c.node2.commit.__class__.__name__}" == "EmptyCommit") { |
|
160 | else if ("${c.node2.commit.__class__.__name__}" == "EmptyCommit") { | |
161 | deferred.resolve(''); |
|
161 | deferred.resolve(''); | |
162 | } |
|
162 | } | |
163 | else { |
|
163 | else { | |
164 | editor.mergely('rhs', 'loading diff...'); |
|
164 | editor.mergely('rhs', 'loading diff...'); | |
165 | $.ajax(orig2_url, { |
|
165 | $.ajax(orig2_url, { | |
166 | dataType: 'text', |
|
166 | dataType: 'text', | |
167 | success: function(data) { |
|
167 | success: function(data) { | |
168 | // call the complete function to let CodeMirror know |
|
168 | // call the complete function to let CodeMirror know | |
169 | deferred.resolve(data); |
|
169 | deferred.resolve(data); | |
170 | } |
|
170 | } | |
171 | }); |
|
171 | }); | |
172 | } |
|
172 | } | |
173 | }; |
|
173 | }; | |
174 |
|
174 | |||
175 | var deferred_lhs = $.Deferred(); |
|
175 | var deferred_lhs = $.Deferred(); | |
176 | var deferred_rhs = $.Deferred(); |
|
176 | var deferred_rhs = $.Deferred(); | |
177 | $.when( |
|
177 | $.when( | |
178 | deferred_lhs, deferred_rhs |
|
178 | deferred_lhs, deferred_rhs | |
179 | ).done(function(lhs_response, rhs_response) { |
|
179 | ).done(function(lhs_response, rhs_response) { | |
180 | editor.mergely('lhs', lhs_response); |
|
180 | editor.mergely('lhs', lhs_response); | |
181 | editor.mergely('rhs', rhs_response); |
|
181 | editor.mergely('rhs', rhs_response); | |
182 |
|
182 | |||
183 | var detected_mode = detectCodeMirrorModeFromExt( |
|
183 | var detected_mode = detectCodeMirrorModeFromExt( | |
184 | '${h.safe_unicode(c.node1.path.split("/")[-1])}', true); |
|
184 | '${h.safe_unicode(c.node1.path.split("/")[-1])}', true); | |
185 | if (detected_mode) { |
|
185 | if (detected_mode) { | |
186 | setCodeMirrorMode(editor.mergely('cm', 'lhs'), detected_mode); |
|
186 | setCodeMirrorMode(editor.mergely('cm', 'lhs'), detected_mode); | |
187 | setCodeMirrorMode(editor.mergely('cm', 'rhs'), detected_mode); |
|
187 | setCodeMirrorMode(editor.mergely('cm', 'rhs'), detected_mode); | |
188 | $('#selected_mode').html(detected_mode); |
|
188 | $('#selected_mode').html(detected_mode); | |
189 | } |
|
189 | } | |
190 | }); |
|
190 | }); | |
191 | // load via ajax, and use deferred signals to notify when finished. |
|
191 | // load via ajax, and use deferred signals to notify when finished. | |
192 | lhs(deferred_lhs); |
|
192 | lhs(deferred_lhs); | |
193 | rhs(deferred_rhs); |
|
193 | rhs(deferred_rhs); | |
194 |
|
194 | |||
195 | $("#ignorews").click(function() { |
|
195 | $("#ignorews").click(function() { | |
196 | $("#ignorews .toggle").toggle(); |
|
196 | $("#ignorews .toggle").toggle(); | |
197 | var val = $('#ignorews .toggle:visible').data()['enabled']; |
|
197 | var val = $('#ignorews .toggle:visible').data()['enabled']; | |
198 | editor.mergely('options', {ignorews: val}); |
|
198 | editor.mergely('options', {ignorews: val}); | |
199 | editor.mergely('update'); |
|
199 | editor.mergely('update'); | |
200 | }); |
|
200 | }); | |
201 |
|
201 | |||
202 | $("#edit_mode").click(function() { |
|
202 | $("#edit_mode").click(function() { | |
203 | $("#edit_mode .toggle").toggle(); |
|
203 | $("#edit_mode .toggle").toggle(); | |
204 | var val = $('#edit_mode .toggle:visible').data()['enabled']; |
|
204 | var val = $('#edit_mode .toggle:visible').data()['enabled']; | |
205 | editor.mergely('cm', 'lhs').setOption('readOnly', val); |
|
205 | editor.mergely('cm', 'lhs').setOption('readOnly', val); | |
206 | editor.mergely('cm', 'rhs').setOption('readOnly', val); |
|
206 | editor.mergely('cm', 'rhs').setOption('readOnly', val); | |
207 | editor.mergely('update'); |
|
207 | editor.mergely('update'); | |
208 | }); |
|
208 | }); | |
209 |
|
209 | |||
210 | $('#prev_change').on('click', function() { |
|
210 | $('#prev_change').on('click', function() { | |
211 | editor.mergely('scrollToDiff', 'prev'); |
|
211 | editor.mergely('scrollToDiff', 'prev'); | |
212 | }); |
|
212 | }); | |
213 | $('#next_change').on('click', function() { |
|
213 | $('#next_change').on('click', function() { | |
214 | editor.mergely('scrollToDiff', 'next'); |
|
214 | editor.mergely('scrollToDiff', 'next'); | |
215 | }); |
|
215 | }); | |
216 |
|
216 | |||
217 | // extend content dynamically on this component for readability |
|
217 | // extend content dynamically on this component for readability | |
218 | $('#content').css({'max-width': '2000px'}); |
|
218 | $('#content').css({'max-width': '2000px'}); | |
219 | editor.mergely('resize'); |
|
219 | editor.mergely('resize'); | |
220 |
|
220 | |||
221 | }); |
|
221 | }); | |
222 | </script> |
|
222 | </script> | |
223 |
|
223 | |||
224 | </div> |
|
224 | </div> | |
225 | </%def> |
|
225 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now