##// END OF EJS Templates
clipboard: added dummy placeholders for copying commits/paths via clipboard.js
marcink -
r1935:51b8a8f9 default
parent child Browse files
Show More
@@ -1,121 +1,122 b''
1 1 @font-face {
2 2 font-family: 'rcicons';
3 3 src: url('../fonts/RCIcons/rcicons.eot?88634534');
4 4 src: url('../fonts/RCIcons/rcicons.eot?88634534#iefix') format('embedded-opentype'),
5 5 url('../fonts/RCIcons/rcicons.woff2?88634534') format('woff2'),
6 6 url('../fonts/RCIcons/rcicons.woff?88634534') format('woff'),
7 7 url('../fonts/RCIcons/rcicons.ttf?88634534') format('truetype'),
8 8 url('../fonts/RCIcons/rcicons.svg?88634534#rcicons') format('svg');
9 9 font-weight: normal;
10 10 font-style: normal;
11 11 }
12 12 /* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
13 13 /* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
14 14 /*
15 15 @media screen and (-webkit-min-device-pixel-ratio:0) {
16 16 @font-face {
17 17 font-family: 'rcicons';
18 18 src: url('../fonts/RCIcons/rcicons.svg?88634534#rcicons') format('svg');
19 19 }
20 20 }
21 21 */
22 22
23 23 [class^="icon-"]:before, [class*=" icon-"]:before {
24 24 font-family: "rcicons";
25 25 font-style: normal;
26 26 font-weight: normal;
27 27 speak: none;
28 28
29 29 display: inline-block;
30 30 text-decoration: inherit;
31 31 width: 1em;
32 32 margin-right: .2em;
33 33 text-align: center;
34 34 /* opacity: .8; */
35 35
36 36 /* For safety - reset parent styles, that can break glyph codes*/
37 37 font-variant: normal;
38 38 text-transform: none;
39 39
40 40 /* fix buttons height, for twitter bootstrap */
41 41 line-height: 1em;
42 42
43 43 /* Animation center compensation - margins should be symmetric */
44 44 /* remove if not needed */
45 45 margin-left: .2em;
46 46
47 47 /* you can be more comfortable with increased icons size */
48 48 /* font-size: 120%; */
49 49
50 50 /* Font smoothing. That was taken from TWBS */
51 51 -webkit-font-smoothing: antialiased;
52 52 -moz-osx-font-smoothing: grayscale;
53 53
54 54 /* Uncomment for 3D effect */
55 55 /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
56 56 }
57 57
58 58
59 59 .icon-git:before { content: '\e82a'; } /* '' */
60 60 .icon-hg:before { content: '\e82d'; } /* '' */
61 61 .icon-svn:before { content: '\e82e'; } /* '' */
62 62 .icon-plus:before { content: '\e813'; } /* '' */
63 .icon-clipboard:before { content: '\e813'; } /* '' */
63 64 .icon-minus:before { content: '\e814'; } /* '' */
64 65 .icon-remove:before { content: '\e815'; } /* '' */
65 66 .icon-bookmark:before { content: '\e803'; } /* '' */
66 67 .icon-branch:before { content: '\e804'; } /* '' */
67 68 .icon-merge:before { content: '\e833'; } /* '' */
68 69 .icon-tag:before { content: '\e805'; } /* '' */
69 70 .icon-lock:before { content: '\e806'; } /* '' */
70 71 .icon-unlock:before { content: '\e807'; } /* '' */
71 72 .icon-delete:before,
72 73 .icon-false:before { content: '\e800'; } /* '' */
73 74 .icon-ok:before,
74 75 .icon-true:before { content: '\e801'; } /* '' */
75 76 .icon-feed:before { content: '\e808'; } /* '' */
76 77 .icon-left:before { content: '\e809'; } /* '' */
77 78 .icon-right:before { content: '\e80a'; } /* '' */
78 79 .icon-arrow_down:before { content: '\e80b'; } /* '' */
79 80 .icon-arrow_up:before { content: '\e832'; } /* '' */
80 81 .icon-group:before { content: '\e80f'; } /* '' */
81 82 .icon-folder:before { content: '\e810'; } /* '' */
82 83 .icon-fork:before { content: '\e811'; } /* '' */
83 84 .icon-more:before { content: '\e812'; } /* '' */
84 85 .icon-comment:before { content: '\e802'; } /* '' */
85 86 .icon-comment-add:before { content: '\e82f'; } /* '' */
86 87 .icon-comment-toggle:before { content: '\e830'; } /* '' */
87 88 .icon-rhodecode:before { content: '\e831'; } /* '' */
88 89 .icon-remove-sign:before { &:extend(.icon-remove:before); }
89 90 .icon-repo-private:before,
90 91 .icon-repo-lock:before { &:extend(.icon-lock:before); }
91 92 .icon-unlock-alt:before,
92 93 .icon-repo-unlock:before,
93 94 .icon-repo-public:before { &:extend(.icon-unlock:before); }
94 95 .icon-rss-sign:before { &:extend(.icon-feed:before); }
95 96 .icon-chevron-right:before { &:extend(.icon-right:before); }
96 97 .icon-chevron-left:before { &:extend(.icon-left:before); }
97 98 .icon-caret-down:before { &:extend(.icon-arrow_down:before); }
98 99 .icon-folder-close:before { &:extend(.icon-folder:before); }
99 100 .icon-code-fork:before { &:extend(.icon-fork:before); }
100 101
101 102
102 103 //--- ICONS STYLING ------------------//
103 104
104 105 .icon-git { color: @color4 !important; }
105 106 .icon-hg { color: @color8 !important; }
106 107 .icon-svn { color: @color1 !important; }
107 108 .icon-repo-lock { color: #FF0000; }
108 109 .icon-repo-unlock { color: #FF0000; }
109 110
110 111 .repo-switcher-dropdown .select2-result-label {
111 112 .icon-git:before {
112 113 &:extend(.icon-git-transparent:before);
113 114 }
114 115 .icon-hg:before {
115 116 &:extend(.icon-hg-transparent:before);
116 117 color: @alert4;
117 118 }
118 119 .icon-svn:before {
119 120 &:extend(.icon-svn-transparent:before);
120 121 }
121 122 }
@@ -1,483 +1,497 b''
1 1 // # Copyright (C) 2010-2017 RhodeCode GmbH
2 2 // #
3 3 // # This program is free software: you can redistribute it and/or modify
4 4 // # it under the terms of the GNU Affero General Public License, version 3
5 5 // # (only), as published by the Free Software Foundation.
6 6 // #
7 7 // # This program is distributed in the hope that it will be useful,
8 8 // # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 9 // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 10 // # GNU General Public License for more details.
11 11 // #
12 12 // # You should have received a copy of the GNU Affero General Public License
13 13 // # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 14 // #
15 15 // # This program is dual-licensed. If you wish to learn more about the
16 16 // # RhodeCode Enterprise Edition, including its added features, Support services,
17 17 // # and proprietary license terms, please see https://rhodecode.com/licenses/
18 18
19 19 /**
20 20 RhodeCode JS Files
21 21 **/
22 22
23 23 if (typeof console == "undefined" || typeof console.log == "undefined"){
24 24 console = { log: function() {} }
25 25 }
26 26
27 27 // TODO: move the following function to submodules
28 28
29 29 /**
30 30 * show more
31 31 */
32 32 var show_more_event = function(){
33 33 $('table .show_more').click(function(e) {
34 34 var cid = e.target.id.substring(1);
35 35 var button = $(this);
36 36 if (button.hasClass('open')) {
37 37 $('#'+cid).hide();
38 38 button.removeClass('open');
39 39 } else {
40 40 $('#'+cid).show();
41 41 button.addClass('open one');
42 42 }
43 43 });
44 44 };
45 45
46 46 var compare_radio_buttons = function(repo_name, compare_ref_type){
47 47 $('#compare_action').on('click', function(e){
48 48 e.preventDefault();
49 49
50 50 var source = $('input[name=compare_source]:checked').val();
51 51 var target = $('input[name=compare_target]:checked').val();
52 52 if(source && target){
53 53 var url_data = {
54 54 repo_name: repo_name,
55 55 source_ref: source,
56 56 source_ref_type: compare_ref_type,
57 57 target_ref: target,
58 58 target_ref_type: compare_ref_type,
59 59 merge: 1
60 60 };
61 61 window.location = pyroutes.url('compare_url', url_data);
62 62 }
63 63 });
64 64 $('.compare-radio-button').on('click', function(e){
65 65 var source = $('input[name=compare_source]:checked').val();
66 66 var target = $('input[name=compare_target]:checked').val();
67 67 if(source && target){
68 68 $('#compare_action').removeAttr("disabled");
69 69 $('#compare_action').removeClass("disabled");
70 70 }
71 71 })
72 72 };
73 73
74 74 var showRepoSize = function(target, repo_name, commit_id, callback) {
75 75 var container = $('#' + target);
76 76 var url = pyroutes.url('repo_stats',
77 77 {"repo_name": repo_name, "commit_id": commit_id});
78 78
79 79 if (!container.hasClass('loaded')) {
80 80 $.ajax({url: url})
81 81 .complete(function (data) {
82 82 var responseJSON = data.responseJSON;
83 83 container.addClass('loaded');
84 84 container.html(responseJSON.size);
85 85 callback(responseJSON.code_stats)
86 86 })
87 87 .fail(function (data) {
88 88 console.log('failed to load repo stats');
89 89 });
90 90 }
91 91
92 92 };
93 93
94 94 var showRepoStats = function(target, data){
95 95 var container = $('#' + target);
96 96
97 97 if (container.hasClass('loaded')) {
98 98 return
99 99 }
100 100
101 101 var total = 0;
102 102 var no_data = true;
103 103 var tbl = document.createElement('table');
104 104 tbl.setAttribute('class', 'trending_language_tbl');
105 105
106 106 $.each(data, function(key, val){
107 107 total += val.count;
108 108 });
109 109
110 110 var sortedStats = [];
111 111 for (var obj in data){
112 112 sortedStats.push([obj, data[obj]])
113 113 }
114 114 var sortedData = sortedStats.sort(function (a, b) {
115 115 return b[1].count - a[1].count
116 116 });
117 117 var cnt = 0;
118 118 $.each(sortedData, function(idx, val){
119 119 cnt += 1;
120 120 no_data = false;
121 121
122 122 var hide = cnt > 2;
123 123 var tr = document.createElement('tr');
124 124 if (hide) {
125 125 tr.setAttribute('style', 'display:none');
126 126 tr.setAttribute('class', 'stats_hidden');
127 127 }
128 128
129 129 var key = val[0];
130 130 var obj = {"desc": val[1].desc, "count": val[1].count};
131 131
132 132 var percentage = Math.round((obj.count / total * 100), 2);
133 133
134 134 var td1 = document.createElement('td');
135 135 td1.width = 300;
136 136 var trending_language_label = document.createElement('div');
137 137 trending_language_label.innerHTML = obj.desc + " (.{0})".format(key);
138 138 td1.appendChild(trending_language_label);
139 139
140 140 var td2 = document.createElement('td');
141 141 var trending_language = document.createElement('div');
142 142 var nr_files = obj.count +" "+ _ngettext('file', 'files', obj.count);
143 143
144 144 trending_language.title = key + " " + nr_files;
145 145
146 146 trending_language.innerHTML = "<span>" + percentage + "% " + nr_files
147 147 + "</span><b>" + percentage + "% " + nr_files + "</b>";
148 148
149 149 trending_language.setAttribute("class", 'trending_language');
150 150 $('b', trending_language)[0].style.width = percentage + "%";
151 151 td2.appendChild(trending_language);
152 152
153 153 tr.appendChild(td1);
154 154 tr.appendChild(td2);
155 155 tbl.appendChild(tr);
156 156 if (cnt == 3) {
157 157 var show_more = document.createElement('tr');
158 158 var td = document.createElement('td');
159 159 lnk = document.createElement('a');
160 160
161 161 lnk.href = '#';
162 162 lnk.innerHTML = _gettext('Show more');
163 163 lnk.id = 'code_stats_show_more';
164 164 td.appendChild(lnk);
165 165
166 166 show_more.appendChild(td);
167 167 show_more.appendChild(document.createElement('td'));
168 168 tbl.appendChild(show_more);
169 169 }
170 170 });
171 171
172 172 $(container).html(tbl);
173 173 $(container).addClass('loaded');
174 174
175 175 $('#code_stats_show_more').on('click', function (e) {
176 176 e.preventDefault();
177 177 $('.stats_hidden').each(function (idx) {
178 178 $(this).css("display", "");
179 179 });
180 180 $('#code_stats_show_more').hide();
181 181 });
182 182
183 183 };
184 184
185 185 // returns a node from given html;
186 186 var fromHTML = function(html){
187 187 var _html = document.createElement('element');
188 188 _html.innerHTML = html;
189 189 return _html;
190 190 };
191 191
192 192 // Toggle Collapsable Content
193 193 function collapsableContent() {
194 194
195 195 $('.collapsable-content').not('.no-hide').hide();
196 196
197 197 $('.btn-collapse').unbind(); //in case we've been here before
198 198 $('.btn-collapse').click(function() {
199 199 var button = $(this);
200 200 var togglename = $(this).data("toggle");
201 201 $('.collapsable-content[data-toggle='+togglename+']').toggle();
202 202 if ($(this).html()=="Show Less")
203 203 $(this).html("Show More");
204 204 else
205 205 $(this).html("Show Less");
206 206 });
207 207 };
208 208
209 209 var timeagoActivate = function() {
210 210 $("time.timeago").timeago();
211 211 };
212 212
213
214 var clipboardActivate = function() {
215 /*
216 *
217 * <i class="tooltip icon-plus clipboard-action" data-clipboard-text="${commit.raw_id}" title="${_('Copy the full commit id')}"></i>
218 * */
219 var clipboard = new Clipboard('.clipboard-action');
220
221 clipboard.on('success', function(e) {
222 e.clearSelection();
223 });
224 };
225
226
213 227 // Formatting values in a Select2 dropdown of commit references
214 228 var formatSelect2SelectionRefs = function(commit_ref){
215 229 var tmpl = '';
216 230 if (!commit_ref.text || commit_ref.type === 'sha'){
217 231 return commit_ref.text;
218 232 }
219 233 if (commit_ref.type === 'branch'){
220 234 tmpl = tmpl.concat('<i class="icon-branch"></i> ');
221 235 } else if (commit_ref.type === 'tag'){
222 236 tmpl = tmpl.concat('<i class="icon-tag"></i> ');
223 237 } else if (commit_ref.type === 'book'){
224 238 tmpl = tmpl.concat('<i class="icon-bookmark"></i> ');
225 239 }
226 240 return tmpl.concat(commit_ref.text);
227 241 };
228 242
229 243 // takes a given html element and scrolls it down offset pixels
230 244 function offsetScroll(element, offset) {
231 245 setTimeout(function() {
232 246 var location = element.offset().top;
233 247 // some browsers use body, some use html
234 248 $('html, body').animate({ scrollTop: (location - offset) });
235 249 }, 100);
236 250 }
237 251
238 252 // scroll an element `percent`% from the top of page in `time` ms
239 253 function scrollToElement(element, percent, time) {
240 254 percent = (percent === undefined ? 25 : percent);
241 255 time = (time === undefined ? 100 : time);
242 256
243 257 var $element = $(element);
244 258 if ($element.length == 0) {
245 259 throw('Cannot scroll to {0}'.format(element))
246 260 }
247 261 var elOffset = $element.offset().top;
248 262 var elHeight = $element.height();
249 263 var windowHeight = $(window).height();
250 264 var offset = elOffset;
251 265 if (elHeight < windowHeight) {
252 266 offset = elOffset - ((windowHeight / (100 / percent)) - (elHeight / 2));
253 267 }
254 268 setTimeout(function() {
255 269 $('html, body').animate({ scrollTop: offset});
256 270 }, time);
257 271 }
258 272
259 273 /**
260 274 * global hooks after DOM is loaded
261 275 */
262 276 $(document).ready(function() {
263 277 firefoxAnchorFix();
264 278
265 279 $('.navigation a.menulink').on('click', function(e){
266 280 var menuitem = $(this).parent('li');
267 281 if (menuitem.hasClass('open')) {
268 282 menuitem.removeClass('open');
269 283 } else {
270 284 menuitem.addClass('open');
271 285 $(document).on('click', function(event) {
272 286 if (!$(event.target).closest(menuitem).length) {
273 287 menuitem.removeClass('open');
274 288 }
275 289 });
276 290 }
277 291 });
278 292 $('.compare_view_files').on(
279 293 'mouseenter mouseleave', 'tr.line .lineno a',function(event) {
280 294 if (event.type === "mouseenter") {
281 295 $(this).parents('tr.line').addClass('hover');
282 296 } else {
283 297 $(this).parents('tr.line').removeClass('hover');
284 298 }
285 299 });
286 300
287 301 $('.compare_view_files').on(
288 302 'mouseenter mouseleave', 'tr.line .add-comment-line a',function(event){
289 303 if (event.type === "mouseenter") {
290 304 $(this).parents('tr.line').addClass('commenting');
291 305 } else {
292 306 $(this).parents('tr.line').removeClass('commenting');
293 307 }
294 308 });
295 309
296 310 $('body').on( /* TODO: replace the $('.compare_view_files').on('click') below
297 311 when new diffs are integrated */
298 312 'click', '.cb-lineno a', function(event) {
299 313
300 314 if ($(this).attr('data-line-no') !== ""){
301 315 $('.cb-line-selected').removeClass('cb-line-selected');
302 316 var td = $(this).parent();
303 317 td.addClass('cb-line-selected'); // line number td
304 318 td.prev().addClass('cb-line-selected'); // line data td
305 319 td.next().addClass('cb-line-selected'); // line content td
306 320
307 321 // Replace URL without jumping to it if browser supports.
308 322 // Default otherwise
309 323 if (history.pushState) {
310 324 var new_location = location.href.rstrip('#');
311 325 if (location.hash) {
312 326 new_location = new_location.replace(location.hash, "");
313 327 }
314 328
315 329 // Make new anchor url
316 330 new_location = new_location + $(this).attr('href');
317 331 history.pushState(true, document.title, new_location);
318 332
319 333 return false;
320 334 }
321 335 }
322 336 });
323 337
324 338 $('.compare_view_files').on( /* TODO: replace this with .cb function above
325 339 when new diffs are integrated */
326 340 'click', 'tr.line .lineno a',function(event) {
327 341 if ($(this).text() != ""){
328 342 $('tr.line').removeClass('selected');
329 343 $(this).parents("tr.line").addClass('selected');
330 344
331 345 // Replace URL without jumping to it if browser supports.
332 346 // Default otherwise
333 347 if (history.pushState) {
334 348 var new_location = location.href;
335 349 if (location.hash){
336 350 new_location = new_location.replace(location.hash, "");
337 351 }
338 352
339 353 // Make new anchor url
340 354 var new_location = new_location+$(this).attr('href');
341 355 history.pushState(true, document.title, new_location);
342 356
343 357 return false;
344 358 }
345 359 }
346 360 });
347 361
348 362 $('.compare_view_files').on(
349 363 'click', 'tr.line .add-comment-line a',function(event) {
350 364 var tr = $(event.currentTarget).parents('tr.line')[0];
351 365 injectInlineForm(tr);
352 366 return false;
353 367 });
354 368
355 369 $('.collapse_file').on('click', function(e) {
356 370 e.stopPropagation();
357 371 if ($(e.target).is('a')) { return; }
358 372 var node = $(e.delegateTarget).first();
359 373 var icon = $($(node.children().first()).children().first());
360 374 var id = node.attr('fid');
361 375 var target = $('#'+id);
362 376 var tr = $('#tr_'+id);
363 377 var diff = $('#diff_'+id);
364 378 if(node.hasClass('expand_file')){
365 379 node.removeClass('expand_file');
366 380 icon.removeClass('expand_file_icon');
367 381 node.addClass('collapse_file');
368 382 icon.addClass('collapse_file_icon');
369 383 diff.show();
370 384 tr.show();
371 385 target.show();
372 386 } else {
373 387 node.removeClass('collapse_file');
374 388 icon.removeClass('collapse_file_icon');
375 389 node.addClass('expand_file');
376 390 icon.addClass('expand_file_icon');
377 391 diff.hide();
378 392 tr.hide();
379 393 target.hide();
380 394 }
381 395 });
382 396
383 397 $('#expand_all_files').click(function() {
384 398 $('.expand_file').each(function() {
385 399 var node = $(this);
386 400 var icon = $($(node.children().first()).children().first());
387 401 var id = $(this).attr('fid');
388 402 var target = $('#'+id);
389 403 var tr = $('#tr_'+id);
390 404 var diff = $('#diff_'+id);
391 405 node.removeClass('expand_file');
392 406 icon.removeClass('expand_file_icon');
393 407 node.addClass('collapse_file');
394 408 icon.addClass('collapse_file_icon');
395 409 diff.show();
396 410 tr.show();
397 411 target.show();
398 412 });
399 413 });
400 414
401 415 $('#collapse_all_files').click(function() {
402 416 $('.collapse_file').each(function() {
403 417 var node = $(this);
404 418 var icon = $($(node.children().first()).children().first());
405 419 var id = $(this).attr('fid');
406 420 var target = $('#'+id);
407 421 var tr = $('#tr_'+id);
408 422 var diff = $('#diff_'+id);
409 423 node.removeClass('collapse_file');
410 424 icon.removeClass('collapse_file_icon');
411 425 node.addClass('expand_file');
412 426 icon.addClass('expand_file_icon');
413 427 diff.hide();
414 428 tr.hide();
415 429 target.hide();
416 430 });
417 431 });
418 432
419 433 // Mouse over behavior for comments and line selection
420 434
421 435 // Select the line that comes from the url anchor
422 436 // At the time of development, Chrome didn't seem to support jquery's :target
423 437 // element, so I had to scroll manually
424 438
425 439 if (location.hash) {
426 440 var result = splitDelimitedHash(location.hash);
427 441 var loc = result.loc;
428 442 if (loc.length > 1) {
429 443
430 444 var highlightable_line_tds = [];
431 445
432 446 // source code line format
433 447 var page_highlights = loc.substring(
434 448 loc.indexOf('#') + 1).split('L');
435 449
436 450 if (page_highlights.length > 1) {
437 451 var highlight_ranges = page_highlights[1].split(",");
438 452 var h_lines = [];
439 453 for (var pos in highlight_ranges) {
440 454 var _range = highlight_ranges[pos].split('-');
441 455 if (_range.length === 2) {
442 456 var start = parseInt(_range[0]);
443 457 var end = parseInt(_range[1]);
444 458 if (start < end) {
445 459 for (var i = start; i <= end; i++) {
446 460 h_lines.push(i);
447 461 }
448 462 }
449 463 }
450 464 else {
451 465 h_lines.push(parseInt(highlight_ranges[pos]));
452 466 }
453 467 }
454 468 for (pos in h_lines) {
455 469 var line_td = $('td.cb-lineno#L' + h_lines[pos]);
456 470 if (line_td.length) {
457 471 highlightable_line_tds.push(line_td);
458 472 }
459 473 }
460 474 }
461 475
462 476 // now check a direct id reference (diff page)
463 477 if ($(loc).length && $(loc).hasClass('cb-lineno')) {
464 478 highlightable_line_tds.push($(loc));
465 479 }
466 480 $.each(highlightable_line_tds, function (i, $td) {
467 481 $td.addClass('cb-line-selected'); // line number td
468 482 $td.prev().addClass('cb-line-selected'); // line data
469 483 $td.next().addClass('cb-line-selected'); // line content
470 484 });
471 485
472 486 if (highlightable_line_tds.length) {
473 487 var $first_line_td = highlightable_line_tds[0];
474 488 scrollToElement($first_line_td);
475 489 $.Topic('/ui/plugins/code/anchor_focus').prepareOrPublish({
476 490 td: $first_line_td,
477 491 remainder: result.remainder
478 492 });
479 493 }
480 494 }
481 495 }
482 496 collapsableContent();
483 497 });
@@ -1,175 +1,176 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <!DOCTYPE html>
3 3
4 4 <%
5 5 c.template_context['repo_name'] = getattr(c, 'repo_name', '')
6 6
7 7 if hasattr(c, 'rhodecode_db_repo'):
8 8 c.template_context['repo_type'] = c.rhodecode_db_repo.repo_type
9 9 c.template_context['repo_landing_commit'] = c.rhodecode_db_repo.landing_rev[1]
10 10
11 11 if getattr(c, 'rhodecode_user', None) and c.rhodecode_user.user_id:
12 12 c.template_context['rhodecode_user']['username'] = c.rhodecode_user.username
13 13 c.template_context['rhodecode_user']['email'] = c.rhodecode_user.email
14 14 c.template_context['rhodecode_user']['notification_status'] = c.rhodecode_user.get_instance().user_data.get('notification_status', True)
15 15 c.template_context['rhodecode_user']['first_name'] = c.rhodecode_user.first_name
16 16 c.template_context['rhodecode_user']['last_name'] = c.rhodecode_user.last_name
17 17
18 18 c.template_context['visual']['default_renderer'] = h.get_visual_attr(c, 'default_renderer')
19 19 c.template_context['default_user'] = {
20 20 'username': h.DEFAULT_USER,
21 21 'user_id': 1
22 22 }
23 23
24 24 %>
25 25 <html xmlns="http://www.w3.org/1999/xhtml">
26 26 <head>
27 27 <script src="${h.asset('js/vendors/webcomponentsjs/webcomponents-lite.min.js', ver=c.rhodecode_version_hash)}"></script>
28 28 <link rel="import" href="${h.asset('js/rhodecode-components.html', ver=c.rhodecode_version_hash)}">
29 29 <title>${self.title()}</title>
30 30 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
31 31 <%def name="robots()">
32 32 <meta name="robots" content="index, nofollow"/>
33 33 </%def>
34 34 ${self.robots()}
35 35 <link rel="icon" href="${h.asset('images/favicon.ico', ver=c.rhodecode_version_hash)}" sizes="16x16 32x32" type="image/png" />
36 36
37 37 ## CSS definitions
38 38 <%def name="css()">
39 39 <link rel="stylesheet" type="text/css" href="${h.asset('css/style.css', ver=c.rhodecode_version_hash)}" media="screen"/>
40 40 <!--[if lt IE 9]>
41 41 <link rel="stylesheet" type="text/css" href="${h.asset('css/ie.css', ver=c.rhodecode_version_hash)}" media="screen"/>
42 42 <![endif]-->
43 43 ## EXTRA FOR CSS
44 44 ${self.css_extra()}
45 45 </%def>
46 46 ## CSS EXTRA - optionally inject some extra CSS stuff needed for specific websites
47 47 <%def name="css_extra()">
48 48 </%def>
49 49
50 50 ${self.css()}
51 51
52 52 ## JAVASCRIPT
53 53 <%def name="js()">
54 54 <script>
55 55 // setup Polymer options
56 56 window.Polymer = {lazyRegister: true, dom: 'shadow'};
57 57
58 58 // Load webcomponentsjs polyfill if browser does not support native Web Components
59 59 (function() {
60 60 'use strict';
61 61 var onload = function() {
62 62 // For native Imports, manually fire WebComponentsReady so user code
63 63 // can use the same code path for native and polyfill'd imports.
64 64 if (!window.HTMLImports) {
65 65 document.dispatchEvent(
66 66 new CustomEvent('WebComponentsReady', {bubbles: true})
67 67 );
68 68 }
69 69 };
70 70 var webComponentsSupported = (
71 71 'registerElement' in document
72 72 && 'import' in document.createElement('link')
73 73 && 'content' in document.createElement('template')
74 74 );
75 75 if (!webComponentsSupported) {
76 76 } else {
77 77 onload();
78 78 }
79 79 })();
80 80 </script>
81 81
82 82 <script src="${h.asset('js/rhodecode/i18n/%s.js' % c.language, ver=c.rhodecode_version_hash)}"></script>
83 83 <script type="text/javascript">
84 84 // register templateContext to pass template variables to JS
85 85 var templateContext = ${h.json.dumps(c.template_context)|n};
86 86
87 87 var APPLICATION_URL = "${h.route_path('home').rstrip('/')}";
88 88 var ASSET_URL = "${h.asset('')}";
89 89 var DEFAULT_RENDERER = "${h.get_visual_attr(c, 'default_renderer')}";
90 90 var CSRF_TOKEN = "${getattr(c, 'csrf_token', '')}";
91 91
92 92 var APPENLIGHT = {
93 93 enabled: ${'true' if getattr(c, 'appenlight_enabled', False) else 'false'},
94 94 key: '${getattr(c, "appenlight_api_public_key", "")}',
95 95 % if getattr(c, 'appenlight_server_url', None):
96 96 serverUrl: '${getattr(c, "appenlight_server_url", "")}',
97 97 % endif
98 98 requestInfo: {
99 99 % if getattr(c, 'rhodecode_user', None):
100 100 ip: '${c.rhodecode_user.ip_addr}',
101 101 username: '${c.rhodecode_user.username}'
102 102 % endif
103 103 },
104 104 tags: {
105 105 rhodecode_version: '${c.rhodecode_version}',
106 106 rhodecode_edition: '${c.rhodecode_edition}'
107 107 }
108 108 };
109 109
110 110 </script>
111 111 <%include file="/base/plugins_base.mako"/>
112 112 <!--[if lt IE 9]>
113 113 <script language="javascript" type="text/javascript" src="${h.asset('js/excanvas.min.js')}"></script>
114 114 <![endif]-->
115 115 <script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode/routes.js', ver=c.rhodecode_version_hash)}"></script>
116 116 <script> var alertMessagePayloads = ${h.flash.json_alerts(request)|n}; </script>
117 117 ## avoide escaping the %N
118 118 <script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode-components.js', ver=c.rhodecode_version_hash)}"></script>
119 119 <script>CodeMirror.modeURL = "${h.asset('') + 'js/mode/%N/%N.js?ver='+c.rhodecode_version_hash}";</script>
120 120
121 121
122 122 ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates
123 123 ${self.js_extra()}
124 124
125 125 <script type="text/javascript">
126 126 Rhodecode = (function() {
127 127 function _Rhodecode() {
128 128 this.comments = new CommentsController();
129 129 }
130 130 return new _Rhodecode();
131 131 })();
132 132
133 133 $(document).ready(function(){
134 134 show_more_event();
135 135 timeagoActivate();
136 clipboardActivate();
136 137 })
137 138 </script>
138 139
139 140 </%def>
140 141
141 142 ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates
142 143 <%def name="js_extra()"></%def>
143 144 ${self.js()}
144 145
145 146 <%def name="head_extra()"></%def>
146 147 ${self.head_extra()}
147 148 ## extra stuff
148 149 %if c.pre_code:
149 150 ${c.pre_code|n}
150 151 %endif
151 152 </head>
152 153 <body id="body">
153 154 <noscript>
154 155 <div class="noscript-error">
155 156 ${_('Please enable JavaScript to use RhodeCode Enterprise')}
156 157 </div>
157 158 </noscript>
158 159 ## IE hacks
159 160 <!--[if IE 7]>
160 161 <script>$(document.body).addClass('ie7')</script>
161 162 <![endif]-->
162 163 <!--[if IE 8]>
163 164 <script>$(document.body).addClass('ie8')</script>
164 165 <![endif]-->
165 166 <!--[if IE 9]>
166 167 <script>$(document.body).addClass('ie9')</script>
167 168 <![endif]-->
168 169
169 170 ${next.body()}
170 171 %if c.post_code:
171 172 ${c.post_code|n}
172 173 %endif
173 174 <rhodecode-app></rhodecode-app>
174 175 </body>
175 176 </html>
@@ -1,142 +1,144 b''
1 1 ## small box that displays changed/added/removed details fetched by AJAX
2 2 <%namespace name="base" file="/base/base.mako"/>
3 3
4 4
5 5 % if c.prev_page:
6 6 <tr>
7 7 <td colspan="9" class="load-more-commits">
8 8 <a class="prev-commits" href="#loadPrevCommits" onclick="commitsController.loadPrev(this, ${c.prev_page}, '${c.branch_name}');return false">
9 9 ${_('load previous')}
10 10 </a>
11 11 </td>
12 12 </tr>
13 13 % endif
14 14
15 15 % for cnt,commit in enumerate(c.pagination):
16 16 <tr id="sha_${commit.raw_id}" class="changelogRow container ${'tablerow%s' % (cnt%2)}">
17 17
18 18 <td class="td-checkbox">
19 19 ${h.checkbox(commit.raw_id,class_="commit-range")}
20 20 </td>
21 21 <td class="td-status">
22 22
23 23 %if c.statuses.get(commit.raw_id):
24 24 <div class="changeset-status-ico">
25 25 %if c.statuses.get(commit.raw_id)[2]:
26 26 <a class="tooltip" title="${_('Commit status: %s\nClick to open associated pull request #%s') % (h.commit_status_lbl(c.statuses.get(commit.raw_id)[0]), c.statuses.get(commit.raw_id)[2])}" href="${h.route_path('pullrequest_show',repo_name=c.statuses.get(commit.raw_id)[3],pull_request_id=c.statuses.get(commit.raw_id)[2])}">
27 27 <div class="${'flag_status %s' % c.statuses.get(commit.raw_id)[0]}"></div>
28 28 </a>
29 29 %else:
30 30 <a class="tooltip" title="${_('Commit status: %s') % h.commit_status_lbl(c.statuses.get(commit.raw_id)[0])}" href="${h.url('changeset_home',repo_name=c.repo_name,revision=commit.raw_id,anchor='comment-%s' % c.comments[commit.raw_id][0].comment_id)}">
31 31 <div class="${'flag_status %s' % c.statuses.get(commit.raw_id)[0]}"></div>
32 32 </a>
33 33 %endif
34 34 </div>
35 35 %else:
36 36 <div class="tooltip flag_status not_reviewed" title="${_('Commit status: Not Reviewed')}"></div>
37 37 %endif
38 38 </td>
39 39 <td class="td-comments comments-col">
40 40 %if c.comments.get(commit.raw_id):
41 41 <a title="${_('Commit has comments')}" href="${h.url('changeset_home',repo_name=c.repo_name,revision=commit.raw_id,anchor='comment-%s' % c.comments[commit.raw_id][0].comment_id)}">
42 42 <i class="icon-comment"></i> ${len(c.comments[commit.raw_id])}
43 43 </a>
44 44 %endif
45 45 </td>
46 46 <td class="td-hash">
47 47 <code>
48 <i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${commit.raw_id}" title="${_('Copy the full commit id')}"></i>
49
48 50 <a href="${h.url('changeset_home',repo_name=c.repo_name,revision=commit.raw_id)}">
49 51 <span class="${'commit_hash obsolete' if getattr(commit, 'obsolete', None) else 'commit_hash'}">${h.show_id(commit)}</span>
50 52 </a>
51 53 % if hasattr(commit, 'phase'):
52 54 % if commit.phase != 'public':
53 55 <span class="tag phase-${commit.phase} tooltip" title="${_('Commit phase')}">${commit.phase}</span>
54 56 % endif
55 57 % endif
56 58
57 59 ## obsolete commits
58 60 % if hasattr(commit, 'obsolete'):
59 61 % if commit.obsolete:
60 62 <span class="tag obsolete-${commit.obsolete} tooltip" title="${_('Evolve State')}">${_('obsolete')}</span>
61 63 % endif
62 64 % endif
63 65
64 66 ## hidden commits
65 67 % if hasattr(commit, 'hidden'):
66 68 % if commit.hidden:
67 69 <span class="tag obsolete-${commit.hidden} tooltip" title="${_('Evolve State')}">${_('hidden')}</span>
68 70 % endif
69 71 % endif
70 72
71 73 </code>
72 74 </td>
73 75 <td class="td-message expand_commit" data-commit-id="${commit.raw_id}" title="${_('Expand commit message')}" onclick="commitsController.expandCommit(this); return false">
74 76 <div class="show_more_col">
75 77 <i class="show_more"></i>&nbsp;
76 78 </div>
77 79 </td>
78 80 <td class="td-description mid">
79 81 <div class="log-container truncate-wrap">
80 82 <div class="message truncate" id="c-${commit.raw_id}">${h.urlify_commit_message(commit.message, c.repo_name)}</div>
81 83 </div>
82 84 </td>
83 85
84 86 <td class="td-time">
85 87 ${h.age_component(commit.date)}
86 88 </td>
87 89 <td class="td-user">
88 90 ${base.gravatar_with_user(commit.author)}
89 91 </td>
90 92
91 93 <td class="td-tags tags-col">
92 94 <div id="t-${commit.raw_id}">
93 95
94 96 ## merge
95 97 %if commit.merge:
96 98 <span class="tag mergetag">
97 99 <i class="icon-merge"></i>${_('merge')}
98 100 </span>
99 101 %endif
100 102
101 103 ## branch
102 104 %if commit.branch:
103 105 <span class="tag branchtag" title="${h.tooltip(_('Branch %s') % commit.branch)}">
104 106 <a href="${h.route_path('repo_changelog',repo_name=c.repo_name,_query=dict(branch=commit.branch))}"><i class="icon-code-fork"></i>${h.shorter(commit.branch)}</a>
105 107 </span>
106 108 %endif
107 109
108 110 ## bookmarks
109 111 %if h.is_hg(c.rhodecode_repo):
110 112 %for book in commit.bookmarks:
111 113 <span class="tag booktag" title="${h.tooltip(_('Bookmark %s') % book)}">
112 114 <a href="${h.route_path('repo_files:default_path',repo_name=c.repo_name,commit_id=commit.raw_id, _query=dict(at=book))}"><i class="icon-bookmark"></i>${h.shorter(book)}</a>
113 115 </span>
114 116 %endfor
115 117 %endif
116 118
117 119 ## tags
118 120 %for tag in commit.tags:
119 121 <span class="tag tagtag" title="${h.tooltip(_('Tag %s') % tag)}">
120 122 <a href="${h.route_path('repo_files:default_path',repo_name=c.repo_name,commit_id=commit.raw_id, _query=dict(at=tag))}"><i class="icon-tag"></i>${h.shorter(tag)}</a>
121 123 </span>
122 124 %endfor
123 125
124 126 </div>
125 127 </td>
126 128 </tr>
127 129 % endfor
128 130
129 131 % if c.next_page:
130 132 <tr>
131 133 <td colspan="9" class="load-more-commits">
132 134 <a class="next-commits" href="#loadNextCommits" onclick="commitsController.loadNext(this, ${c.next_page}, '${c.branch_name}');return false">
133 135 ${_('load next')}
134 136 </a>
135 137 </td>
136 138 </tr>
137 139 % endif
138 140 <tr class="chunk-graph-data" style="display:none"
139 141 data-graph='${c.graph_data|n}'
140 142 data-node='${c.prev_page}:${c.next_page}'
141 143 data-commits='${c.graph_commits|n}'>
142 144 </tr> No newline at end of file
@@ -1,351 +1,352 b''
1 1 ## -*- coding: utf-8 -*-
2 2
3 3 <%inherit file="/base/base.mako"/>
4 4 <%namespace name="diff_block" file="/changeset/diff_block.mako"/>
5 5
6 6 <%def name="title()">
7 7 ${_('%s Commit') % c.repo_name} - ${h.show_id(c.commit)}
8 8 %if c.rhodecode_name:
9 9 &middot; ${h.branding(c.rhodecode_name)}
10 10 %endif
11 11 </%def>
12 12
13 13 <%def name="menu_bar_nav()">
14 14 ${self.menu_items(active='repositories')}
15 15 </%def>
16 16
17 17 <%def name="menu_bar_subnav()">
18 18 ${self.repo_menu(active='changelog')}
19 19 </%def>
20 20
21 21 <%def name="main()">
22 22 <script>
23 23 // TODO: marcink switch this to pyroutes
24 24 AJAX_COMMENT_DELETE_URL = "${h.url('changeset_comment_delete',repo_name=c.repo_name,comment_id='__COMMENT_ID__')}";
25 25 templateContext.commit_data.commit_id = "${c.commit.raw_id}";
26 26 </script>
27 27 <div class="box">
28 28 <div class="title">
29 29 ${self.repo_page_title(c.rhodecode_db_repo)}
30 30 </div>
31 31
32 32 <div id="changeset_compare_view_content" class="summary changeset">
33 33 <div class="summary-detail">
34 34 <div class="summary-detail-header">
35 35 <span class="breadcrumbs files_location">
36 36 <h4>${_('Commit')}
37 37 <code>
38 <i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${c.commit.raw_id}" title="${_('Copy the full commit id')}"></i>
38 39 ${h.show_id(c.commit)}
39 40 % if hasattr(c.commit, 'phase'):
40 41 <span class="tag phase-${c.commit.phase} tooltip" title="${_('Commit phase')}">${c.commit.phase}</span>
41 42 % endif
42 43
43 44 ## obsolete commits
44 45 % if hasattr(c.commit, 'obsolete'):
45 46 % if c.commit.obsolete:
46 47 <span class="tag obsolete-${c.commit.obsolete} tooltip" title="${_('Evolve State')}">${_('obsolete')}</span>
47 48 % endif
48 49 % endif
49 50
50 51 ## hidden commits
51 52 % if hasattr(c.commit, 'hidden'):
52 53 % if c.commit.hidden:
53 54 <span class="tag hidden-${c.commit.hidden} tooltip" title="${_('Evolve State')}">${_('hidden')}</span>
54 55 % endif
55 56 % endif
56 57
57 58 </code>
58 59 </h4>
59 60 </span>
60 61 <div class="pull-right">
61 62 <span id="parent_link">
62 63 <a href="#" title="${_('Parent Commit')}">${_('Parent')}</a>
63 64 </span>
64 65 |
65 66 <span id="child_link">
66 67 <a href="#" title="${_('Child Commit')}">${_('Child')}</a>
67 68 </span>
68 69 </div>
69 70 </div>
70 71
71 72 <div class="fieldset">
72 73 <div class="left-label">
73 74 ${_('Description')}:
74 75 </div>
75 76 <div class="right-content">
76 77 <div id="trimmed_message_box" class="commit">${h.urlify_commit_message(c.commit.message,c.repo_name)}</div>
77 78 <div id="message_expand" style="display:none;">
78 79 ${_('Expand')}
79 80 </div>
80 81 </div>
81 82 </div>
82 83
83 84 %if c.statuses:
84 85 <div class="fieldset">
85 86 <div class="left-label">
86 87 ${_('Commit status')}:
87 88 </div>
88 89 <div class="right-content">
89 90 <div class="changeset-status-ico">
90 91 <div class="${'flag_status %s' % c.statuses[0]} pull-left"></div>
91 92 </div>
92 93 <div title="${_('Commit status')}" class="changeset-status-lbl">[${h.commit_status_lbl(c.statuses[0])}]</div>
93 94 </div>
94 95 </div>
95 96 %endif
96 97
97 98 <div class="fieldset">
98 99 <div class="left-label">
99 100 ${_('References')}:
100 101 </div>
101 102 <div class="right-content">
102 103 <div class="tags">
103 104
104 105 %if c.commit.merge:
105 106 <span class="mergetag tag">
106 107 <i class="icon-merge"></i>${_('merge')}
107 108 </span>
108 109 %endif
109 110
110 111 %if h.is_hg(c.rhodecode_repo):
111 112 %for book in c.commit.bookmarks:
112 113 <span class="booktag tag" title="${h.tooltip(_('Bookmark %s') % book)}">
113 114 <a href="${h.route_path('repo_files:default_path',repo_name=c.repo_name,commit_id=c.commit.raw_id,_query=dict(at=book))}"><i class="icon-bookmark"></i>${h.shorter(book)}</a>
114 115 </span>
115 116 %endfor
116 117 %endif
117 118
118 119 %for tag in c.commit.tags:
119 120 <span class="tagtag tag" title="${h.tooltip(_('Tag %s') % tag)}">
120 121 <a href="${h.route_path('repo_files:default_path',repo_name=c.repo_name,commit_id=c.commit.raw_id,_query=dict(at=tag))}"><i class="icon-tag"></i>${tag}</a>
121 122 </span>
122 123 %endfor
123 124
124 125 %if c.commit.branch:
125 126 <span class="branchtag tag" title="${h.tooltip(_('Branch %s') % c.commit.branch)}">
126 127 <a href="${h.route_path('repo_files:default_path',repo_name=c.repo_name,commit_id=c.commit.raw_id,_query=dict(at=c.commit.branch))}"><i class="icon-code-fork"></i>${h.shorter(c.commit.branch)}</a>
127 128 </span>
128 129 %endif
129 130 </div>
130 131 </div>
131 132 </div>
132 133
133 134 <div class="fieldset">
134 135 <div class="left-label">
135 136 ${_('Diff options')}:
136 137 </div>
137 138 <div class="right-content">
138 139 <div class="diff-actions">
139 140 <a href="${h.url('changeset_raw_home',repo_name=c.repo_name,revision=c.commit.raw_id)}" class="tooltip" title="${h.tooltip(_('Raw diff'))}">
140 141 ${_('Raw Diff')}
141 142 </a>
142 143 |
143 144 <a href="${h.url('changeset_patch_home',repo_name=c.repo_name,revision=c.commit.raw_id)}" class="tooltip" title="${h.tooltip(_('Patch diff'))}">
144 145 ${_('Patch Diff')}
145 146 </a>
146 147 |
147 148 <a href="${h.url('changeset_download_home',repo_name=c.repo_name,revision=c.commit.raw_id,diff='download')}" class="tooltip" title="${h.tooltip(_('Download diff'))}">
148 149 ${_('Download Diff')}
149 150 </a>
150 151 |
151 152 ${c.ignorews_url(request.GET)}
152 153 |
153 154 ${c.context_url(request.GET)}
154 155 </div>
155 156 </div>
156 157 </div>
157 158
158 159 <div class="fieldset">
159 160 <div class="left-label">
160 161 ${_('Comments')}:
161 162 </div>
162 163 <div class="right-content">
163 164 <div class="comments-number">
164 165 %if c.comments:
165 166 <a href="#comments">${ungettext("%d Commit comment", "%d Commit comments", len(c.comments)) % len(c.comments)}</a>,
166 167 %else:
167 168 ${ungettext("%d Commit comment", "%d Commit comments", len(c.comments)) % len(c.comments)}
168 169 %endif
169 170 %if c.inline_cnt:
170 171 <a href="#" onclick="return Rhodecode.comments.nextComment();" id="inline-comments-counter">${ungettext("%d Inline Comment", "%d Inline Comments", c.inline_cnt) % c.inline_cnt}</a>
171 172 %else:
172 173 ${ungettext("%d Inline Comment", "%d Inline Comments", c.inline_cnt) % c.inline_cnt}
173 174 %endif
174 175 </div>
175 176 </div>
176 177 </div>
177 178
178 179 <div class="fieldset">
179 180 <div class="left-label">
180 181 ${_('Unresolved TODOs')}:
181 182 </div>
182 183 <div class="right-content">
183 184 <div class="comments-number">
184 185 % if c.unresolved_comments:
185 186 % for co in c.unresolved_comments:
186 187 <a class="permalink" href="#comment-${co.comment_id}" onclick="Rhodecode.comments.scrollToComment($('#comment-${co.comment_id}'))"> #${co.comment_id}</a>${'' if loop.last else ','}
187 188 % endfor
188 189 % else:
189 190 ${_('There are no unresolved TODOs')}
190 191 % endif
191 192 </div>
192 193 </div>
193 194 </div>
194 195
195 196 </div> <!-- end summary-detail -->
196 197
197 198 <div id="commit-stats" class="sidebar-right">
198 199 <div class="summary-detail-header">
199 200 <h4 class="item">
200 201 ${_('Author')}
201 202 </h4>
202 203 </div>
203 204 <div class="sidebar-right-content">
204 205 ${self.gravatar_with_user(c.commit.author)}
205 206 <div class="user-inline-data">- ${h.age_component(c.commit.date)}</div>
206 207 </div>
207 208 </div><!-- end sidebar -->
208 209 </div> <!-- end summary -->
209 210 <div class="cs_files">
210 211 <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/>
211 212 ${cbdiffs.render_diffset_menu()}
212 213 ${cbdiffs.render_diffset(
213 214 c.changes[c.commit.raw_id], commit=c.commit, use_comments=True)}
214 215 </div>
215 216
216 217 ## template for inline comment form
217 218 <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/>
218 219
219 220 ## render comments
220 221 ${comment.generate_comments(c.comments)}
221 222
222 223 ## main comment form and it status
223 224 ${comment.comments(h.url('changeset_comment', repo_name=c.repo_name, revision=c.commit.raw_id),
224 225 h.commit_status(c.rhodecode_db_repo, c.commit.raw_id))}
225 226 </div>
226 227
227 228 ## FORM FOR MAKING JS ACTION AS CHANGESET COMMENTS
228 229 <script type="text/javascript">
229 230
230 231 $(document).ready(function() {
231 232
232 233 var boxmax = parseInt($('#trimmed_message_box').css('max-height'), 10);
233 234 if($('#trimmed_message_box').height() === boxmax){
234 235 $('#message_expand').show();
235 236 }
236 237
237 238 $('#message_expand').on('click', function(e){
238 239 $('#trimmed_message_box').css('max-height', 'none');
239 240 $(this).hide();
240 241 });
241 242
242 243 $('.show-inline-comments').on('click', function(e){
243 244 var boxid = $(this).attr('data-comment-id');
244 245 var button = $(this);
245 246
246 247 if(button.hasClass("comments-visible")) {
247 248 $('#{0} .inline-comments'.format(boxid)).each(function(index){
248 249 $(this).hide();
249 250 });
250 251 button.removeClass("comments-visible");
251 252 } else {
252 253 $('#{0} .inline-comments'.format(boxid)).each(function(index){
253 254 $(this).show();
254 255 });
255 256 button.addClass("comments-visible");
256 257 }
257 258 });
258 259
259 260
260 261 // next links
261 262 $('#child_link').on('click', function(e){
262 263 // fetch via ajax what is going to be the next link, if we have
263 264 // >1 links show them to user to choose
264 265 if(!$('#child_link').hasClass('disabled')){
265 266 $.ajax({
266 267 url: '${h.url('changeset_children',repo_name=c.repo_name, revision=c.commit.raw_id)}',
267 268 success: function(data) {
268 269 if(data.results.length === 0){
269 270 $('#child_link').html("${_('No Child Commits')}").addClass('disabled');
270 271 }
271 272 if(data.results.length === 1){
272 273 var commit = data.results[0];
273 274 window.location = pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': commit.raw_id});
274 275 }
275 276 else if(data.results.length === 2){
276 277 $('#child_link').addClass('disabled');
277 278 $('#child_link').addClass('double');
278 279 var _html = '';
279 280 _html +='<a title="__title__" href="__url__">__rev__</a> '
280 281 .replace('__rev__','r{0}:{1}'.format(data.results[0].revision, data.results[0].raw_id.substr(0,6)))
281 282 .replace('__title__', data.results[0].message)
282 283 .replace('__url__', pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': data.results[0].raw_id}));
283 284 _html +=' | ';
284 285 _html +='<a title="__title__" href="__url__">__rev__</a> '
285 286 .replace('__rev__','r{0}:{1}'.format(data.results[1].revision, data.results[1].raw_id.substr(0,6)))
286 287 .replace('__title__', data.results[1].message)
287 288 .replace('__url__', pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': data.results[1].raw_id}));
288 289 $('#child_link').html(_html);
289 290 }
290 291 }
291 292 });
292 293 e.preventDefault();
293 294 }
294 295 });
295 296
296 297 // prev links
297 298 $('#parent_link').on('click', function(e){
298 299 // fetch via ajax what is going to be the next link, if we have
299 300 // >1 links show them to user to choose
300 301 if(!$('#parent_link').hasClass('disabled')){
301 302 $.ajax({
302 303 url: '${h.url("changeset_parents",repo_name=c.repo_name, revision=c.commit.raw_id)}',
303 304 success: function(data) {
304 305 if(data.results.length === 0){
305 306 $('#parent_link').html('${_('No Parent Commits')}').addClass('disabled');
306 307 }
307 308 if(data.results.length === 1){
308 309 var commit = data.results[0];
309 310 window.location = pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': commit.raw_id});
310 311 }
311 312 else if(data.results.length === 2){
312 313 $('#parent_link').addClass('disabled');
313 314 $('#parent_link').addClass('double');
314 315 var _html = '';
315 316 _html +='<a title="__title__" href="__url__">Parent __rev__</a>'
316 317 .replace('__rev__','r{0}:{1}'.format(data.results[0].revision, data.results[0].raw_id.substr(0,6)))
317 318 .replace('__title__', data.results[0].message)
318 319 .replace('__url__', pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': data.results[0].raw_id}));
319 320 _html +=' | ';
320 321 _html +='<a title="__title__" href="__url__">Parent __rev__</a>'
321 322 .replace('__rev__','r{0}:{1}'.format(data.results[1].revision, data.results[1].raw_id.substr(0,6)))
322 323 .replace('__title__', data.results[1].message)
323 324 .replace('__url__', pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': data.results[1].raw_id}));
324 325 $('#parent_link').html(_html);
325 326 }
326 327 }
327 328 });
328 329 e.preventDefault();
329 330 }
330 331 });
331 332
332 333 if (location.hash) {
333 334 var result = splitDelimitedHash(location.hash);
334 335 var line = $('html').find(result.loc);
335 336 if (line.length > 0){
336 337 offsetScroll(line, 70);
337 338 }
338 339 }
339 340
340 341 // browse tree @ revision
341 342 $('#files_link').on('click', function(e){
342 343 window.location = '${h.route_path('repo_files:default_path',repo_name=c.repo_name, commit_id=c.commit.raw_id)}';
343 344 e.preventDefault();
344 345 });
345 346
346 347 // inject comments into their proper positions
347 348 var file_comments = $('.inline-comment-placeholder');
348 349 })
349 350 </script>
350 351
351 352 </%def>
@@ -1,92 +1,93 b''
1 1 <%namespace name="sourceblock" file="/codeblocks/source.mako"/>
2 2
3 3 <div id="codeblock" class="codeblock">
4 4 <div class="codeblock-header">
5 5 <div class="stats">
6 6 <span> <strong>${c.file}</strong></span>
7 7 % if c.lf_node:
8 8 <span title="${_('This file is a pointer to large binary file')}"> | ${_('LargeFile')} ${h.format_byte_size_binary(c.lf_node.size)} </span>
9 9 % endif
10 10 <span> | ${c.file.lines()[0]} ${_ungettext('line', 'lines', c.file.lines()[0])}</span>
11 11 <span> | ${h.format_byte_size_binary(c.file.size)}</span>
12 12 <span> | ${c.file.mimetype} </span>
13 <span class="item last"> | ${h.get_lexer_for_filenode(c.file).__class__.__name__}</span>
13 <span> | ${h.get_lexer_for_filenode(c.file).__class__.__name__}</span>
14 <span class="item last"> | <i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${c.file.path}" title="${_('Copy the full path')}"></i></span>
14 15 </div>
15 16 <div class="buttons">
16 17 <a id="file_history_overview" href="#">
17 18 ${_('History')}
18 19 </a>
19 20 <a id="file_history_overview_full" style="display: none" href="${h.route_path('repo_changelog_file',repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path)}">
20 21 ${_('Show Full History')}
21 22 </a> |
22 23 %if c.annotate:
23 24 ${h.link_to(_('Source'), h.route_path('repo_files', repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))}
24 25 %else:
25 26 ${h.link_to(_('Annotation'), h.route_path('repo_files:annotated',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))}
26 27 %endif
27 28 | ${h.link_to(_('Raw'), h.route_path('repo_file_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))}
28 29 |
29 30 % if c.lf_node:
30 31 <a href="${h.route_path('repo_file_download',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path, _query=dict(lf=1))}">
31 32 ${_('Download largefile')}
32 33 </a>
33 34 % else:
34 35 <a href="${h.route_path('repo_file_download',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path)}">
35 36 ${_('Download')}
36 37 </a>
37 38 % endif
38 39
39 40 %if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name):
40 41 |
41 42 %if c.on_branch_head and c.branch_or_raw_id and not c.file.is_binary:
42 43 <a href="${h.route_path('repo_files_edit_file',repo_name=c.repo_name,commit_id=c.branch_or_raw_id,f_path=c.f_path, _anchor='edit')}">
43 44 ${_('Edit on Branch:{}').format(c.branch_name)}
44 45 </a>
45 46 | <a class="btn-danger btn-link" href="${h.route_path('repo_files_remove_file',repo_name=c.repo_name,commit_id=c.branch_or_raw_id,f_path=c.f_path, _anchor='edit')}">${_('Delete')}
46 47 </a>
47 48 %elif c.on_branch_head and c.branch_or_raw_id and c.file.is_binary:
48 49 ${h.link_to(_('Edit'), '#', class_="btn btn-link disabled tooltip", title=_('Editing binary files not allowed'))}
49 50 | ${h.link_to(_('Delete'), h.route_path('repo_files_remove_file',repo_name=c.repo_name,commit_id=c.branch_or_raw_id,f_path=c.f_path, _anchor='edit'),class_="btn-danger btn-link")}
50 51 %else:
51 52 ${h.link_to(_('Edit'), '#', class_="btn btn-link disabled tooltip", title=_('Editing files allowed only when on branch head commit'))}
52 53 | ${h.link_to(_('Delete'), '#', class_="btn btn-danger btn-link disabled tooltip", title=_('Deleting files allowed only when on branch head commit'))}
53 54 %endif
54 55 %endif
55 56 </div>
56 57 </div>
57 58 <div id="file_history_container"></div>
58 59 <div class="code-body">
59 60 %if c.file.is_binary:
60 61 <% rendered_binary = h.render_binary(c.repo_name, c.file)%>
61 62 % if rendered_binary:
62 63 ${rendered_binary}
63 64 % else:
64 65 <div>
65 66 ${_('Binary file (%s)') % c.file.mimetype}
66 67 </div>
67 68 % endif
68 69 %else:
69 70 % if c.file.size < c.visual.cut_off_limit_file:
70 71 %if c.renderer and not c.annotate:
71 72 ${h.render(c.file.content, renderer=c.renderer, relative_url=h.route_path('repo_file_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))}
72 73 %else:
73 74 <table class="cb codehilite">
74 75 %if c.annotate:
75 76 <% color_hasher = h.color_hasher() %>
76 77 %for annotation, lines in c.annotated_lines:
77 78 ${sourceblock.render_annotation_lines(annotation, lines, color_hasher)}
78 79 %endfor
79 80 %else:
80 81 %for line_num, tokens in enumerate(c.lines, 1):
81 82 ${sourceblock.render_line(line_num, tokens)}
82 83 %endfor
83 84 %endif
84 85 </table>
85 86 %endif
86 87 %else:
87 88 ${_('File size {} is bigger then allowed limit {}. ').format(h.format_byte_size_binary(c.file.size), h.format_byte_size_binary(c.visual.cut_off_limit_file))} ${h.link_to(_('Show as raw'),
88 89 h.route_path('repo_file_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))}
89 90 %endif
90 91 %endif
91 92 </div>
92 93 </div> No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now