Show More
@@ -0,0 +1,15 b'' | |||||
|
1 | %if c.files_list: | |||
|
2 | <h3 class="files_location"> | |||
|
3 | ${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.changeset.raw_id,c.files_list.path)} | |||
|
4 | </h3> | |||
|
5 | %if c.files_list.is_dir(): | |||
|
6 | <%include file='files_browser.html'/> | |||
|
7 | %else: | |||
|
8 | <%include file='files_source.html'/> | |||
|
9 | %endif | |||
|
10 | %else: | |||
|
11 | <h2> | |||
|
12 | <a href="#" onClick="javascript:parent.history.back();" target="main">${_('Go back')}</a> | |||
|
13 | ${_('No files at given path')}: "${c.f_path or "/"}" | |||
|
14 | </h2> | |||
|
15 | %endif |
@@ -1919,6 +1919,9 b' h3.files_location {' | |||||
1919 | border: 1px solid #CCC; |
|
1919 | border: 1px solid #CCC; | |
1920 | padding: 10px; |
|
1920 | padding: 10px; | |
1921 | height: 45px; |
|
1921 | height: 45px; | |
|
1922 | -webkit-border-radius: 6px 6px 0px 0px; | |||
|
1923 | -moz-border-radius: 6px 6px 0px 0px; | |||
|
1924 | border-radius: 6px 6px 0px 0px; | |||
1922 | } |
|
1925 | } | |
1923 |
|
1926 | |||
1924 | #graph_content #rev_range_container { |
|
1927 | #graph_content #rev_range_container { | |
@@ -1978,7 +1981,7 b' h3.files_location {' | |||||
1978 | } |
|
1981 | } | |
1979 |
|
1982 | |||
1980 | .right .changes .changed_total { |
|
1983 | .right .changes .changed_total { | |
1981 |
border: |
|
1984 | border: 0px solid #DDD; | |
1982 | display: block; |
|
1985 | display: block; | |
1983 | float: right; |
|
1986 | float: right; | |
1984 | text-align: center; |
|
1987 | text-align: center; | |
@@ -1986,6 +1989,10 b' h3.files_location {' | |||||
1986 | cursor: pointer; |
|
1989 | cursor: pointer; | |
1987 | background: #FD8; |
|
1990 | background: #FD8; | |
1988 | font-weight: bold; |
|
1991 | font-weight: bold; | |
|
1992 | -webkit-border-radius: 0px 0px 0px 6px; | |||
|
1993 | -moz-border-radius: 0px 0px 0px 6px; | |||
|
1994 | border-radius: 0px 0px 0px 6px; | |||
|
1995 | padding: 2px; | |||
1989 | } |
|
1996 | } | |
1990 |
|
1997 | |||
1991 | .right .changes .added,.changed,.removed { |
|
1998 | .right .changes .added,.changed,.removed { |
@@ -7,10 +7,10 b' if (typeof console == "undefined" || typ' | |||||
7 | } |
|
7 | } | |
8 |
|
8 | |||
9 |
|
9 | |||
10 |
|
|
10 | var str_repeat = function(i, m) { | |
11 | for (var o = []; m > 0; o[--m] = i); |
|
11 | for (var o = []; m > 0; o[--m] = i); | |
12 | return o.join(''); |
|
12 | return o.join(''); | |
13 | } |
|
13 | }; | |
14 |
|
14 | |||
15 |
|
|
15 | /** | |
16 | * INJECT .format function into String |
|
16 | * INJECT .format function into String | |
@@ -55,7 +55,7 b' String.prototype.format = function() {' | |||||
55 | * |
|
55 | * | |
56 | * @returns {ColorGenerator} |
|
56 | * @returns {ColorGenerator} | |
57 | */ |
|
57 | */ | |
58 |
|
|
58 | var ColorGenerator = function(){ | |
59 | this.GOLDEN_RATIO = 0.618033988749895; |
|
59 | this.GOLDEN_RATIO = 0.618033988749895; | |
60 | this.CURRENT_RATIO = 0.22717784590367374 // this can be random |
|
60 | this.CURRENT_RATIO = 0.22717784590367374 // this can be random | |
61 | this.HSV_1 = 0.75;//saturation |
|
61 | this.HSV_1 = 0.75;//saturation | |
@@ -129,7 +129,7 b' var push_state_enabled = Boolean(' | |||||
129 | /* disable for the mercury iOS browser, or at least older versions of the webkit engine */ |
|
129 | /* disable for the mercury iOS browser, or at least older versions of the webkit engine */ | |
130 | || (/AppleWebKit\/5([0-2]|3[0-2])/i).test(navigator.userAgent) |
|
130 | || (/AppleWebKit\/5([0-2]|3[0-2])/i).test(navigator.userAgent) | |
131 | ) |
|
131 | ) | |
132 | ) |
|
132 | ); | |
133 |
|
133 | |||
134 |
|
|
134 | /** | |
135 | * Partial Ajax Implementation |
|
135 | * Partial Ajax Implementation | |
@@ -179,7 +179,7 b' function ypjax(url,container,s_call,f_ca' | |||||
179 | } |
|
179 | } | |
180 | },args); |
|
180 | },args); | |
181 |
|
181 | |||
182 | } |
|
182 | }; | |
183 |
|
183 | |||
184 |
|
|
184 | /** | |
185 | * tooltip activate |
|
185 | * tooltip activate | |
@@ -206,7 +206,7 b' var tooltip_activate = function(){' | |||||
206 | hidedelay:5, |
|
206 | hidedelay:5, | |
207 | showdelay:20, |
|
207 | showdelay:20, | |
208 | }); |
|
208 | }); | |
209 | } |
|
209 | }; | |
210 |
|
210 | |||
211 |
|
|
211 | /** | |
212 | * show more |
|
212 | * show more | |
@@ -217,7 +217,7 b' var show_more_event = function(){' | |||||
217 | YUD.setStyle(YUD.get(el.id.substring(1)),'display',''); |
|
217 | YUD.setStyle(YUD.get(el.id.substring(1)),'display',''); | |
218 | YUD.setStyle(el.parentNode,'display','none'); |
|
218 | YUD.setStyle(el.parentNode,'display','none'); | |
219 | }); |
|
219 | }); | |
220 | } |
|
220 | }; | |
221 |
|
221 | |||
222 |
|
222 | |||
223 |
|
|
223 | /** | |
@@ -284,7 +284,7 b' var q_filter = function(target,nodes,dis' | |||||
284 | } |
|
284 | } | |
285 |
|
285 | |||
286 | } |
|
286 | } | |
287 | } |
|
287 | }; | |
288 |
|
288 | |||
289 | var ajaxPOST = function(url,postData,success) { |
|
289 | var ajaxPOST = function(url,postData,success) { | |
290 | var sUrl = url; |
|
290 | var sUrl = url; | |
@@ -302,7 +302,7 b' var ajaxPOST = function(url,postData,suc' | |||||
302 | /** comments **/ |
|
302 | /** comments **/ | |
303 | var removeInlineForm = function(form) { |
|
303 | var removeInlineForm = function(form) { | |
304 | form.parentNode.removeChild(form); |
|
304 | form.parentNode.removeChild(form); | |
305 | } |
|
305 | }; | |
306 |
|
306 | |||
307 | var tableTr = function(cls,body){ |
|
307 | var tableTr = function(cls,body){ | |
308 | var form = document.createElement('tr'); |
|
308 | var form = document.createElement('tr'); | |
@@ -311,7 +311,7 b' var tableTr = function(cls,body){' | |||||
311 | '<td class="lineno-inline old-inline"></td>'+ |
|
311 | '<td class="lineno-inline old-inline"></td>'+ | |
312 | '<td>{0}</td>'.format(body); |
|
312 | '<td>{0}</td>'.format(body); | |
313 | return form; |
|
313 | return form; | |
314 | } |
|
314 | }; | |
315 |
|
315 | |||
316 | var createInlineForm = function(parent_tr, f_path, line) { |
|
316 | var createInlineForm = function(parent_tr, f_path, line) { | |
317 | var tmpl = YUD.get('comment-inline-form-template').innerHTML; |
|
317 | var tmpl = YUD.get('comment-inline-form-template').innerHTML; | |
@@ -327,7 +327,8 b' var createInlineForm = function(parent_t' | |||||
327 | YUD.removeClass(parent_tr, 'form-open'); |
|
327 | YUD.removeClass(parent_tr, 'form-open'); | |
328 | }); |
|
328 | }); | |
329 | return form |
|
329 | return form | |
330 | } |
|
330 | }; | |
|
331 | ||||
331 | var getLineNo = function(tr) { |
|
332 | var getLineNo = function(tr) { | |
332 | var line; |
|
333 | var line; | |
333 | var o = tr.children[0].id.split('_'); |
|
334 | var o = tr.children[0].id.split('_'); | |
@@ -340,4 +341,206 b' var getLineNo = function(tr) {' | |||||
340 | } |
|
341 | } | |
341 |
|
342 | |||
342 | return line |
|
343 | return line | |
343 | } No newline at end of file |
|
344 | }; | |
|
345 | ||||
|
346 | ||||
|
347 | var fileBrowserListeners = function(current_url, node_list_url, url_base){ | |||
|
348 | var current_url_branch = +"?branch=__BRANCH__"; | |||
|
349 | var url = url_base; | |||
|
350 | var node_url = node_list_url; | |||
|
351 | ||||
|
352 | YUE.on('stay_at_branch','click',function(e){ | |||
|
353 | if(e.target.checked){ | |||
|
354 | var uri = current_url_branch; | |||
|
355 | uri = uri.replace('__BRANCH__',e.target.value); | |||
|
356 | window.location = uri; | |||
|
357 | } | |||
|
358 | else{ | |||
|
359 | window.location = current_url; | |||
|
360 | } | |||
|
361 | }) | |||
|
362 | ||||
|
363 | var n_filter = YUD.get('node_filter'); | |||
|
364 | var F = YAHOO.namespace('node_filter'); | |||
|
365 | ||||
|
366 | url = url.replace('__REPO__','${c.repo_name}'); | |||
|
367 | url = url.replace('__REVISION__','${c.changeset.raw_id}'); | |||
|
368 | url = url.replace('__FPATH__','${c.files_list.path}'); | |||
|
369 | ||||
|
370 | node_url = node_url.replace('__REPO__','${c.repo_name}'); | |||
|
371 | node_url = node_url.replace('__REVISION__','${c.changeset.raw_id}'); | |||
|
372 | ||||
|
373 | F.filterTimeout = null; | |||
|
374 | var nodes = null; | |||
|
375 | ||||
|
376 | F.initFilter = function(){ | |||
|
377 | YUD.setStyle('node_filter_box_loading','display',''); | |||
|
378 | YUD.setStyle('search_activate_id','display','none'); | |||
|
379 | YUD.setStyle('add_node_id','display','none'); | |||
|
380 | YUC.initHeader('X-PARTIAL-XHR',true); | |||
|
381 | YUC.asyncRequest('GET',url,{ | |||
|
382 | success:function(o){ | |||
|
383 | nodes = JSON.parse(o.responseText); | |||
|
384 | YUD.setStyle('node_filter_box_loading','display','none'); | |||
|
385 | YUD.setStyle('node_filter_box','display',''); | |||
|
386 | }, | |||
|
387 | failure:function(o){ | |||
|
388 | console.log('failed to load'); | |||
|
389 | } | |||
|
390 | },null); | |||
|
391 | } | |||
|
392 | ||||
|
393 | F.updateFilter = function(e) { | |||
|
394 | ||||
|
395 | return function(){ | |||
|
396 | // Reset timeout | |||
|
397 | F.filterTimeout = null; | |||
|
398 | var query = e.target.value; | |||
|
399 | var match = []; | |||
|
400 | var matches = 0; | |||
|
401 | var matches_max = 20; | |||
|
402 | if (query != ""){ | |||
|
403 | for(var i=0;i<nodes.length;i++){ | |||
|
404 | var pos = nodes[i].toLowerCase().indexOf(query) | |||
|
405 | if(query && pos != -1){ | |||
|
406 | ||||
|
407 | matches++ | |||
|
408 | //show only certain amount to not kill browser | |||
|
409 | if (matches > matches_max){ | |||
|
410 | break; | |||
|
411 | } | |||
|
412 | ||||
|
413 | var n = nodes[i]; | |||
|
414 | var n_hl = n.substring(0,pos) | |||
|
415 | +"<b>{0}</b>".format(n.substring(pos,pos+query.length)) | |||
|
416 | +n.substring(pos+query.length) | |||
|
417 | match.push('<tr><td><a class="browser-file" href="{0}">{1}</a></td><td colspan="5"></td></tr>'.format(node_url.replace('__FPATH__',n),n_hl)); | |||
|
418 | } | |||
|
419 | if(match.length >= matches_max){ | |||
|
420 | match.push('<tr><td>{0}</td><td colspan="5"></td></tr>'.format("${_('search truncated')}")); | |||
|
421 | } | |||
|
422 | ||||
|
423 | } | |||
|
424 | } | |||
|
425 | ||||
|
426 | if(query != ""){ | |||
|
427 | YUD.setStyle('tbody','display','none'); | |||
|
428 | YUD.setStyle('tbody_filtered','display',''); | |||
|
429 | ||||
|
430 | if (match.length==0){ | |||
|
431 | match.push('<tr><td>{0}</td><td colspan="5"></td></tr>'.format("${_('no matching files')}")); | |||
|
432 | } | |||
|
433 | ||||
|
434 | YUD.get('tbody_filtered').innerHTML = match.join(""); | |||
|
435 | } | |||
|
436 | else{ | |||
|
437 | YUD.setStyle('tbody','display',''); | |||
|
438 | YUD.setStyle('tbody_filtered','display','none'); | |||
|
439 | } | |||
|
440 | ||||
|
441 | } | |||
|
442 | }; | |||
|
443 | ||||
|
444 | YUE.on(YUD.get('filter_activate'),'click',function(){ | |||
|
445 | F.initFilter(); | |||
|
446 | }) | |||
|
447 | YUE.on(n_filter,'click',function(){ | |||
|
448 | n_filter.value = ''; | |||
|
449 | }); | |||
|
450 | YUE.on(n_filter,'keyup',function(e){ | |||
|
451 | clearTimeout(F.filterTimeout); | |||
|
452 | F.filterTimeout = setTimeout(F.updateFilter(e),600); | |||
|
453 | }); | |||
|
454 | }; | |||
|
455 | ||||
|
456 | ||||
|
457 | var initCodeMirror = function(textAreadId,resetUrl){ | |||
|
458 | var myCodeMirror = CodeMirror.fromTextArea(YUD.get(textAreadId),{ | |||
|
459 | mode: "null", | |||
|
460 | lineNumbers:true | |||
|
461 | }); | |||
|
462 | YUE.on('reset','click',function(e){ | |||
|
463 | window.location=resetUrl | |||
|
464 | }); | |||
|
465 | ||||
|
466 | YUE.on('file_enable','click',function(){ | |||
|
467 | YUD.setStyle('editor_container','display',''); | |||
|
468 | YUD.setStyle('upload_file_container','display','none'); | |||
|
469 | YUD.setStyle('filename_container','display',''); | |||
|
470 | }); | |||
|
471 | ||||
|
472 | YUE.on('upload_file_enable','click',function(){ | |||
|
473 | YUD.setStyle('editor_container','display','none'); | |||
|
474 | YUD.setStyle('upload_file_container','display',''); | |||
|
475 | YUD.setStyle('filename_container','display','none'); | |||
|
476 | }); | |||
|
477 | }; | |||
|
478 | ||||
|
479 | ||||
|
480 | ||||
|
481 | var getIdentNode = function(n){ | |||
|
482 | //iterate thru nodes untill matched interesting node ! | |||
|
483 | ||||
|
484 | if (typeof n == 'undefined'){ | |||
|
485 | return -1 | |||
|
486 | } | |||
|
487 | ||||
|
488 | if(typeof n.id != "undefined" && n.id.match('L[0-9]+')){ | |||
|
489 | return n | |||
|
490 | } | |||
|
491 | else{ | |||
|
492 | return getIdentNode(n.parentNode); | |||
|
493 | } | |||
|
494 | }; | |||
|
495 | ||||
|
496 | var getSelectionLink = function(selection_link_label) { | |||
|
497 | return function(){ | |||
|
498 | //get selection from start/to nodes | |||
|
499 | if (typeof window.getSelection != "undefined") { | |||
|
500 | s = window.getSelection(); | |||
|
501 | ||||
|
502 | from = getIdentNode(s.anchorNode); | |||
|
503 | till = getIdentNode(s.focusNode); | |||
|
504 | ||||
|
505 | f_int = parseInt(from.id.replace('L','')); | |||
|
506 | t_int = parseInt(till.id.replace('L','')); | |||
|
507 | ||||
|
508 | if (f_int > t_int){ | |||
|
509 | //highlight from bottom | |||
|
510 | offset = -35; | |||
|
511 | ranges = [t_int,f_int]; | |||
|
512 | ||||
|
513 | } | |||
|
514 | else{ | |||
|
515 | //highligth from top | |||
|
516 | offset = 35; | |||
|
517 | ranges = [f_int,t_int]; | |||
|
518 | } | |||
|
519 | ||||
|
520 | if (ranges[0] != ranges[1]){ | |||
|
521 | if(YUD.get('linktt') == null){ | |||
|
522 | hl_div = document.createElement('div'); | |||
|
523 | hl_div.id = 'linktt'; | |||
|
524 | } | |||
|
525 | anchor = '#L'+ranges[0]+'-'+ranges[1]; | |||
|
526 | hl_div.innerHTML = ''; | |||
|
527 | l = document.createElement('a'); | |||
|
528 | l.href = location.href.substring(0,location.href.indexOf('#'))+anchor; | |||
|
529 | l.innerHTML = selection_link_label; | |||
|
530 | hl_div.appendChild(l); | |||
|
531 | ||||
|
532 | YUD.get('body').appendChild(hl_div); | |||
|
533 | ||||
|
534 | xy = YUD.getXY(till.id); | |||
|
535 | ||||
|
536 | YUD.addClass('linktt','yui-tt'); | |||
|
537 | YUD.setStyle('linktt','top',xy[1]+offset+'px'); | |||
|
538 | YUD.setStyle('linktt','left',xy[0]+'px'); | |||
|
539 | YUD.setStyle('linktt','visibility','visible'); | |||
|
540 | } | |||
|
541 | else{ | |||
|
542 | YUD.setStyle('linktt','visibility','hidden'); | |||
|
543 | } | |||
|
544 | } | |||
|
545 | } | |||
|
546 | }; |
@@ -32,24 +32,15 b'' | |||||
32 | </div> |
|
32 | </div> | |
33 | <div class="table"> |
|
33 | <div class="table"> | |
34 | <div id="files_data"> |
|
34 | <div id="files_data"> | |
35 | %if c.files_list: |
|
35 | <%include file='files_ypjax.html'/> | |
36 | <h3 class="files_location"> |
|
|||
37 | ${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.changeset.raw_id,c.files_list.path)} |
|
|||
38 | </h3> |
|
|||
39 | %if c.files_list.is_dir(): |
|
|||
40 | <%include file='files_browser.html'/> |
|
|||
41 | %else: |
|
|||
42 | <%include file='files_source.html'/> |
|
|||
43 | %endif |
|
|||
44 | %else: |
|
|||
45 | <h2> |
|
|||
46 | <a href="#" onClick="javascript:parent.history.back();" target="main">${_('Go back')}</a> |
|
|||
47 | ${_('No files at given path')}: "${c.f_path or "/"}" |
|
|||
48 | </h2> |
|
|||
49 | %endif |
|
|||
50 |
|
||||
51 | </div> |
|
36 | </div> | |
52 | </div> |
|
37 | </div> | |
53 | </div> |
|
38 | </div> | |
54 |
|
39 | <script type="text/javascript"> | ||
55 | </%def> No newline at end of file |
|
40 | var YPJAX_TITLE = "${c.repo_name} ${_('Files')} - ${c.rhodecode_name}"; | |
|
41 | var current_url = "${h.url.current()}"; | |||
|
42 | var node_list_url = '${h.url("files_home",repo_name="__REPO__",revision="__REVISION__",f_path="__FPATH__")}'; | |||
|
43 | var url_base = '${h.url("files_nodelist_home",repo_name="__REPO__",revision="__REVISION__",f_path="__FPATH__")}'; | |||
|
44 | fileBrowserListeners(current_url, node_list_url, url_base); | |||
|
45 | </script> | |||
|
46 | </%def> No newline at end of file |
@@ -83,26 +83,8 b'' | |||||
83 | </div> |
|
83 | </div> | |
84 | ${h.end_form()} |
|
84 | ${h.end_form()} | |
85 | <script type="text/javascript"> |
|
85 | <script type="text/javascript"> | |
86 | var myCodeMirror = CodeMirror.fromTextArea(YUD.get('editor'),{ |
|
86 | var reset_url = "${h.url('files_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path)}"; | |
87 | mode: "null", |
|
87 | initCodeMirror('editor',reset_url); | |
88 | lineNumbers:true |
|
|||
89 | }); |
|
|||
90 | YUE.on('reset','click',function(e){ |
|
|||
91 | window.location="${h.url('files_home',repo_name=c.repo_name,revision=c.cs.revision,f_path=c.f_path)}"; |
|
|||
92 | }); |
|
|||
93 |
|
||||
94 | YUE.on('file_enable','click',function(){ |
|
|||
95 | YUD.setStyle('editor_container','display',''); |
|
|||
96 | YUD.setStyle('upload_file_container','display','none'); |
|
|||
97 | YUD.setStyle('filename_container','display',''); |
|
|||
98 | }); |
|
|||
99 |
|
||||
100 | YUE.on('upload_file_enable','click',function(){ |
|
|||
101 | YUD.setStyle('editor_container','display','none'); |
|
|||
102 | YUD.setStyle('upload_file_container','display',''); |
|
|||
103 | YUD.setStyle('filename_container','display','none'); |
|
|||
104 | }); |
|
|||
105 |
|
||||
106 | </script> |
|
88 | </script> | |
107 | </div> |
|
89 | </div> | |
108 | </div> |
|
90 | </div> |
@@ -35,120 +35,6 b'' | |||||
35 | <div id="node_filter_box_loading" style="display:none">${_('Loading file list...')}</div> |
|
35 | <div id="node_filter_box_loading" style="display:none">${_('Loading file list...')}</div> | |
36 | <div id="node_filter_box" style="display:none"> |
|
36 | <div id="node_filter_box" style="display:none"> | |
37 | ${h.files_breadcrumbs(c.repo_name,c.changeset.raw_id,c.files_list.path)}/<input type="text" value="type to search..." name="filter" size="25" id="node_filter" autocomplete="off"> |
|
37 | ${h.files_breadcrumbs(c.repo_name,c.changeset.raw_id,c.files_list.path)}/<input type="text" value="type to search..." name="filter" size="25" id="node_filter" autocomplete="off"> | |
38 |
|
||||
39 | <script type="text/javascript"> |
|
|||
40 |
|
||||
41 | YUE.on('stay_at_branch','click',function(e){ |
|
|||
42 | if(e.target.checked){ |
|
|||
43 | var uri = "${h.url.current(branch='__BRANCH__')}" |
|
|||
44 | uri = uri.replace('__BRANCH__',e.target.value); |
|
|||
45 | window.location = uri; |
|
|||
46 | } |
|
|||
47 | else{ |
|
|||
48 | window.location = "${h.url.current()}"; |
|
|||
49 | } |
|
|||
50 |
|
||||
51 | }) |
|
|||
52 |
|
||||
53 | var n_filter = YUD.get('node_filter'); |
|
|||
54 | var F = YAHOO.namespace('node_filter'); |
|
|||
55 |
|
||||
56 | var url = '${h.url("files_nodelist_home",repo_name="__REPO__",revision="__REVISION__",f_path="__FPATH__")}'; |
|
|||
57 | var node_url = '${h.url("files_home",repo_name="__REPO__",revision="__REVISION__",f_path="__FPATH__")}'; |
|
|||
58 |
|
||||
59 | url = url.replace('__REPO__','${c.repo_name}'); |
|
|||
60 | url = url.replace('__REVISION__','${c.changeset.raw_id}'); |
|
|||
61 | url = url.replace('__FPATH__','${c.files_list.path}'); |
|
|||
62 |
|
||||
63 | node_url = node_url.replace('__REPO__','${c.repo_name}'); |
|
|||
64 | node_url = node_url.replace('__REVISION__','${c.changeset.raw_id}'); |
|
|||
65 |
|
||||
66 |
|
||||
67 | F.filterTimeout = null; |
|
|||
68 | var nodes = null; |
|
|||
69 |
|
||||
70 |
|
||||
71 | F.initFilter = function(){ |
|
|||
72 | YUD.setStyle('node_filter_box_loading','display',''); |
|
|||
73 | YUD.setStyle('search_activate_id','display','none'); |
|
|||
74 | YUD.setStyle('add_node_id','display','none'); |
|
|||
75 | YUC.initHeader('X-PARTIAL-XHR',true); |
|
|||
76 | YUC.asyncRequest('GET',url,{ |
|
|||
77 | success:function(o){ |
|
|||
78 | nodes = JSON.parse(o.responseText); |
|
|||
79 | YUD.setStyle('node_filter_box_loading','display','none'); |
|
|||
80 | YUD.setStyle('node_filter_box','display',''); |
|
|||
81 | }, |
|
|||
82 | failure:function(o){ |
|
|||
83 | console.log('failed to load'); |
|
|||
84 | } |
|
|||
85 | },null); |
|
|||
86 | } |
|
|||
87 |
|
||||
88 | F.updateFilter = function(e) { |
|
|||
89 |
|
||||
90 | return function(){ |
|
|||
91 | // Reset timeout |
|
|||
92 | F.filterTimeout = null; |
|
|||
93 | var query = e.target.value; |
|
|||
94 | var match = []; |
|
|||
95 | var matches = 0; |
|
|||
96 | var matches_max = 20; |
|
|||
97 | if (query != ""){ |
|
|||
98 | for(var i=0;i<nodes.length;i++){ |
|
|||
99 | var pos = nodes[i].toLowerCase().indexOf(query) |
|
|||
100 | if(query && pos != -1){ |
|
|||
101 |
|
||||
102 | matches++ |
|
|||
103 | //show only certain amount to not kill browser |
|
|||
104 | if (matches > matches_max){ |
|
|||
105 | break; |
|
|||
106 | } |
|
|||
107 |
|
||||
108 | var n = nodes[i]; |
|
|||
109 | var n_hl = n.substring(0,pos) |
|
|||
110 | +"<b>{0}</b>".format(n.substring(pos,pos+query.length)) |
|
|||
111 | +n.substring(pos+query.length) |
|
|||
112 | match.push('<tr><td><a class="browser-file" href="{0}">{1}</a></td><td colspan="5"></td></tr>'.format(node_url.replace('__FPATH__',n),n_hl)); |
|
|||
113 | } |
|
|||
114 | if(match.length >= matches_max){ |
|
|||
115 | match.push('<tr><td>{0}</td><td colspan="5"></td></tr>'.format("${_('search truncated')}")); |
|
|||
116 | } |
|
|||
117 |
|
||||
118 | } |
|
|||
119 | } |
|
|||
120 |
|
||||
121 | if(query != ""){ |
|
|||
122 | YUD.setStyle('tbody','display','none'); |
|
|||
123 | YUD.setStyle('tbody_filtered','display',''); |
|
|||
124 |
|
||||
125 | if (match.length==0){ |
|
|||
126 | match.push('<tr><td>{0}</td><td colspan="5"></td></tr>'.format("${_('no matching files')}")); |
|
|||
127 | } |
|
|||
128 |
|
||||
129 | YUD.get('tbody_filtered').innerHTML = match.join(""); |
|
|||
130 | } |
|
|||
131 | else{ |
|
|||
132 | YUD.setStyle('tbody','display',''); |
|
|||
133 | YUD.setStyle('tbody_filtered','display','none'); |
|
|||
134 | } |
|
|||
135 |
|
||||
136 | } |
|
|||
137 | } |
|
|||
138 |
|
||||
139 |
|
||||
140 | YUE.on(YUD.get('filter_activate'),'click',function(){ |
|
|||
141 | F.initFilter(); |
|
|||
142 | }) |
|
|||
143 | YUE.on(n_filter,'click',function(){ |
|
|||
144 | n_filter.value = ''; |
|
|||
145 | }); |
|
|||
146 | YUE.on(n_filter,'keyup',function(e){ |
|
|||
147 | clearTimeout(F.filterTimeout); |
|
|||
148 | F.filterTimeout = setTimeout(F.updateFilter(e),600); |
|
|||
149 | }); |
|
|||
150 | </script> |
|
|||
151 |
|
||||
152 | </div> |
|
38 | </div> | |
153 | </div> |
|
39 | </div> | |
154 | </div> |
|
40 | </div> | |
@@ -171,7 +57,7 b'' | |||||
171 | %if c.files_list.parent: |
|
57 | %if c.files_list.parent: | |
172 | <tr class="parity0"> |
|
58 | <tr class="parity0"> | |
173 | <td> |
|
59 | <td> | |
174 | ${h.link_to('..',h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.files_list.parent.path),class_="browser-dir")} |
|
60 | ${h.link_to('..',h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.files_list.parent.path),class_="browser-dir ypjax-link")} | |
175 | </td> |
|
61 | </td> | |
176 | <td></td> |
|
62 | <td></td> | |
177 | <td></td> |
|
63 | <td></td> | |
@@ -184,7 +70,7 b'' | |||||
184 | %for cnt,node in enumerate(c.files_list): |
|
70 | %for cnt,node in enumerate(c.files_list): | |
185 | <tr class="parity${cnt%2}"> |
|
71 | <tr class="parity${cnt%2}"> | |
186 | <td> |
|
72 | <td> | |
187 | ${h.link_to(node.name,h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=h.safe_unicode(node.path)),class_=file_class(node))} |
|
73 | ${h.link_to(node.name,h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=h.safe_unicode(node.path)),class_=file_class(node)+" ypjax-link")} | |
188 | </td> |
|
74 | </td> | |
189 | <td> |
|
75 | <td> | |
190 | %if node.is_file(): |
|
76 | %if node.is_file(): |
@@ -50,13 +50,8 b'' | |||||
50 | </div> |
|
50 | </div> | |
51 | ${h.end_form()} |
|
51 | ${h.end_form()} | |
52 | <script type="text/javascript"> |
|
52 | <script type="text/javascript"> | |
53 | var myCodeMirror = CodeMirror.fromTextArea(YUD.get('editor'),{ |
|
53 | var reset_url = "${h.url('files_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.file.path)}"; | |
54 | mode: "null", |
|
54 | initCodeMirror('editor',reset_url); | |
55 | lineNumbers:true |
|
|||
56 | }); |
|
|||
57 | YUE.on('reset','click',function(){ |
|
|||
58 | window.location="${h.url('files_home',repo_name=c.repo_name,revision=c.cs.revision,f_path=c.file.path)}"; |
|
|||
59 | }) |
|
|||
60 | </script> |
|
55 | </script> | |
61 | </div> |
|
56 | </div> | |
62 | </div> |
|
57 | </div> |
@@ -98,77 +98,10 b'' | |||||
98 | YUE.onDOMReady(function(){ |
|
98 | YUE.onDOMReady(function(){ | |
99 | YUE.on('show_rev','click',function(e){ |
|
99 | YUE.on('show_rev','click',function(e){ | |
100 | YUE.preventDefault(e); |
|
100 | YUE.preventDefault(e); | |
101 |
var cs = Y |
|
101 | var cs = YUD.get('diff1').value; | |
102 | var url = "${h.url('files_home',repo_name=c.repo_name,revision='__CS__',f_path=c.f_path)}".replace('__CS__',cs); |
|
102 | var url = "${h.url('files_home',repo_name=c.repo_name,revision='__CS__',f_path=c.f_path)}".replace('__CS__',cs); | |
103 | window.location = url; |
|
103 | window.location = url; | |
104 | }); |
|
104 | }); | |
105 |
|
105 | YUE.on('hlcode','mouseup',getSelectionLink("${_('Selection link')}")) | ||
106 | function getIdentNode(n){ |
|
|||
107 | //iterate thru nodes untill matched interesting node ! |
|
|||
108 |
|
||||
109 | if (typeof n == 'undefined'){ |
|
|||
110 | return -1 |
|
|||
111 | } |
|
|||
112 |
|
||||
113 | if(typeof n.id != "undefined" && n.id.match('L[0-9]+')){ |
|
|||
114 | return n |
|
|||
115 | } |
|
|||
116 | else{ |
|
|||
117 | return getIdentNode(n.parentNode); |
|
|||
118 | } |
|
|||
119 | } |
|
|||
120 |
|
||||
121 | function getSelectionLink() { |
|
|||
122 | //get selection from start/to nodes |
|
|||
123 | if (typeof window.getSelection != "undefined") { |
|
|||
124 | s = window.getSelection(); |
|
|||
125 |
|
||||
126 | from = getIdentNode(s.anchorNode); |
|
|||
127 | till = getIdentNode(s.focusNode); |
|
|||
128 |
|
||||
129 | f_int = parseInt(from.id.replace('L','')); |
|
|||
130 | t_int = parseInt(till.id.replace('L','')); |
|
|||
131 |
|
||||
132 | if (f_int > t_int){ |
|
|||
133 | //highlight from bottom |
|
|||
134 | offset = -35; |
|
|||
135 | ranges = [t_int,f_int]; |
|
|||
136 |
|
||||
137 | } |
|
|||
138 | else{ |
|
|||
139 | //highligth from top |
|
|||
140 | offset = 35; |
|
|||
141 | ranges = [f_int,t_int]; |
|
|||
142 | } |
|
|||
143 |
|
||||
144 | if (ranges[0] != ranges[1]){ |
|
|||
145 | if(YUD.get('linktt') == null){ |
|
|||
146 | hl_div = document.createElement('div'); |
|
|||
147 | hl_div.id = 'linktt'; |
|
|||
148 | } |
|
|||
149 | anchor = '#L'+ranges[0]+'-'+ranges[1]; |
|
|||
150 | hl_div.innerHTML = ''; |
|
|||
151 | l = document.createElement('a'); |
|
|||
152 | l.href = location.href.substring(0,location.href.indexOf('#'))+anchor; |
|
|||
153 | l.innerHTML = "${_('Selection link')}" |
|
|||
154 | hl_div.appendChild(l); |
|
|||
155 |
|
||||
156 | YUD.get('body').appendChild(hl_div); |
|
|||
157 |
|
||||
158 | xy = YUD.getXY(till.id); |
|
|||
159 |
|
||||
160 | YUD.addClass('linktt','yui-tt'); |
|
|||
161 | YUD.setStyle('linktt','top',xy[1]+offset+'px'); |
|
|||
162 | YUD.setStyle('linktt','left',xy[0]+'px'); |
|
|||
163 | YUD.setStyle('linktt','visibility','visible'); |
|
|||
164 | } |
|
|||
165 | else{ |
|
|||
166 | YUD.setStyle('linktt','visibility','hidden'); |
|
|||
167 | } |
|
|||
168 | } |
|
|||
169 | } |
|
|||
170 |
|
||||
171 | YUE.on('hlcode','mouseup',getSelectionLink) |
|
|||
172 |
|
||||
173 | }); |
|
106 | }); | |
174 | </script> |
|
107 | </script> |
General Comments 0
You need to be logged in to leave comments.
Login now