##// END OF EJS Templates
scrool into multi line selection in file view
marcink -
r3451:151a83be beta
parent child Browse files
Show More
@@ -1,106 +1,109 b''
1 <div id="node_history">
1 <div id="node_history">
2 %if c.load_full_history:
2 %if c.load_full_history:
3 <%include file='files_history_box.html'/>
3 <%include file='files_history_box.html'/>
4 %else:
4 %else:
5 <div style="padding-bottom:10px">
5 <div style="padding-bottom:10px">
6 <span id="load_node_history" class="ui-btn">${_('Load file history')}</span>
6 <span id="load_node_history" class="ui-btn">${_('Load file history')}</span>
7 </div>
7 </div>
8 %endif
8 %endif
9 </div>
9 </div>
10
10
11
11
12 <div id="body" class="codeblock">
12 <div id="body" class="codeblock">
13 <div class="code-header">
13 <div class="code-header">
14 <div class="stats">
14 <div class="stats">
15 <div class="left img"><img src="${h.url('/images/icons/file.png')}"/></div>
15 <div class="left img"><img src="${h.url('/images/icons/file.png')}"/></div>
16 <div class="left item"><pre class="tooltip" title="${h.tooltip(h.fmt_date(c.file_changeset.date))}">${h.link_to("r%s:%s" % (c.file_changeset.revision,h.short_id(c.file_changeset.raw_id)),h.url('changeset_home',repo_name=c.repo_name,revision=c.file_changeset.raw_id))}</pre></div>
16 <div class="left item"><pre class="tooltip" title="${h.tooltip(h.fmt_date(c.file_changeset.date))}">${h.link_to("r%s:%s" % (c.file_changeset.revision,h.short_id(c.file_changeset.raw_id)),h.url('changeset_home',repo_name=c.repo_name,revision=c.file_changeset.raw_id))}</pre></div>
17 <div class="left item"><pre>${h.format_byte_size(c.file.size,binary=True)}</pre></div>
17 <div class="left item"><pre>${h.format_byte_size(c.file.size,binary=True)}</pre></div>
18 <div class="left item last"><pre>${c.file.mimetype}</pre></div>
18 <div class="left item last"><pre>${c.file.mimetype}</pre></div>
19 <div class="buttons">
19 <div class="buttons">
20 %if c.annotate:
20 %if c.annotate:
21 ${h.link_to(_('show source'), h.url('files_home', repo_name=c.repo_name,revision=c.file_changeset.raw_id,f_path=c.f_path),class_="ui-btn")}
21 ${h.link_to(_('show source'), h.url('files_home', repo_name=c.repo_name,revision=c.file_changeset.raw_id,f_path=c.f_path),class_="ui-btn")}
22 %else:
22 %else:
23 ${h.link_to(_('show annotation'),h.url('files_annotate_home',repo_name=c.repo_name,revision=c.file_changeset.raw_id,f_path=c.f_path),class_="ui-btn")}
23 ${h.link_to(_('show annotation'),h.url('files_annotate_home',repo_name=c.repo_name,revision=c.file_changeset.raw_id,f_path=c.f_path),class_="ui-btn")}
24 %endif
24 %endif
25 ${h.link_to(_('show as raw'),h.url('files_raw_home',repo_name=c.repo_name,revision=c.file_changeset.raw_id,f_path=c.f_path),class_="ui-btn")}
25 ${h.link_to(_('show as raw'),h.url('files_raw_home',repo_name=c.repo_name,revision=c.file_changeset.raw_id,f_path=c.f_path),class_="ui-btn")}
26 ${h.link_to(_('download as raw'),h.url('files_rawfile_home',repo_name=c.repo_name,revision=c.file_changeset.raw_id,f_path=c.f_path),class_="ui-btn")}
26 ${h.link_to(_('download as raw'),h.url('files_rawfile_home',repo_name=c.repo_name,revision=c.file_changeset.raw_id,f_path=c.f_path),class_="ui-btn")}
27 % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name):
27 % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name):
28 % if c.on_branch_head and c.changeset.branch and c.file.is_binary is False:
28 % if c.on_branch_head and c.changeset.branch and c.file.is_binary is False:
29 ${h.link_to(_('edit on branch:%s') % c.changeset.branch,h.url('files_edit_home',repo_name=c.repo_name,revision=c.changeset.branch,f_path=c.f_path),class_="ui-btn")}
29 ${h.link_to(_('edit on branch:%s') % c.changeset.branch,h.url('files_edit_home',repo_name=c.repo_name,revision=c.changeset.branch,f_path=c.f_path),class_="ui-btn")}
30 %else:
30 %else:
31 ${h.link_to(_('edit on branch:?'), '#', class_="ui-btn disabled tooltip", title=_('Editing files allowed only when on branch head revision'))}
31 ${h.link_to(_('edit on branch:?'), '#', class_="ui-btn disabled tooltip", title=_('Editing files allowed only when on branch head revision'))}
32 % endif
32 % endif
33 % endif
33 % endif
34 </div>
34 </div>
35 </div>
35 </div>
36 <div class="author">
36 <div class="author">
37 <div class="gravatar">
37 <div class="gravatar">
38 <img alt="gravatar" src="${h.gravatar_url(h.email_or_none(c.file_changeset.author),16)}"/>
38 <img alt="gravatar" src="${h.gravatar_url(h.email_or_none(c.file_changeset.author),16)}"/>
39 </div>
39 </div>
40 <div title="${c.file_changeset.author}" class="user">${h.person(c.file_changeset.author)}</div>
40 <div title="${c.file_changeset.author}" class="user">${h.person(c.file_changeset.author)}</div>
41 </div>
41 </div>
42 <div class="commit">${h.urlify_commit(c.file_changeset.message,c.repo_name)}</div>
42 <div class="commit">${h.urlify_commit(c.file_changeset.message,c.repo_name)}</div>
43 </div>
43 </div>
44 <div class="code-body">
44 <div class="code-body">
45 %if c.file.is_binary:
45 %if c.file.is_binary:
46 ${_('Binary file (%s)') % c.file.mimetype}
46 ${_('Binary file (%s)') % c.file.mimetype}
47 %else:
47 %else:
48 % if c.file.size < c.cut_off_limit:
48 % if c.file.size < c.cut_off_limit:
49 %if c.annotate:
49 %if c.annotate:
50 ${h.pygmentize_annotation(c.repo_name,c.file,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")}
50 ${h.pygmentize_annotation(c.repo_name,c.file,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")}
51 %else:
51 %else:
52 ${h.pygmentize(c.file,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")}
52 ${h.pygmentize(c.file,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")}
53 %endif
53 %endif
54 %else:
54 %else:
55 ${_('File is too big to display')} ${h.link_to(_('show as raw'),
55 ${_('File is too big to display')} ${h.link_to(_('show as raw'),
56 h.url('files_raw_home',repo_name=c.repo_name,revision=c.file_changeset.raw_id,f_path=c.f_path))}
56 h.url('files_raw_home',repo_name=c.repo_name,revision=c.file_changeset.raw_id,f_path=c.f_path))}
57 %endif
57 %endif
58 %endif
58 %endif
59 </div>
59 </div>
60 </div>
60 </div>
61
61
62 <script type="text/javascript">
62 <script type="text/javascript">
63 YUE.onDOMReady(function(){
63 YUE.onDOMReady(function(){
64 function highlight_lines(lines){
64 function highlight_lines(lines){
65 for(pos in lines){
65 for(pos in lines){
66 YUD.setStyle('L'+lines[pos],'background-color','#FFFFBE');
66 YUD.setStyle('L'+lines[pos],'background-color','#FFFFBE');
67 }
67 }
68 }
68 }
69 page_highlights = location.href.substring(location.href.indexOf('#')+1).split('L');
69 page_highlights = location.href.substring(location.href.indexOf('#')+1).split('L');
70 if (page_highlights.length == 2){
70 if (page_highlights.length == 2){
71 highlight_ranges = page_highlights[1].split(",");
71 highlight_ranges = page_highlights[1].split(",");
72
72
73 var h_lines = [];
73 var h_lines = [];
74 for (pos in highlight_ranges){
74 for (pos in highlight_ranges){
75 var _range = highlight_ranges[pos].split('-');
75 var _range = highlight_ranges[pos].split('-');
76 if(_range.length == 2){
76 if(_range.length == 2){
77 var start = parseInt(_range[0]);
77 var start = parseInt(_range[0]);
78 var end = parseInt(_range[1]);
78 var end = parseInt(_range[1]);
79 if (start < end){
79 if (start < end){
80 for(var i=start;i<=end;i++){
80 for(var i=start;i<=end;i++){
81 h_lines.push(i);
81 h_lines.push(i);
82 }
82 }
83 }
83 }
84 }
84 }
85 else{
85 else{
86 h_lines.push(parseInt(highlight_ranges[pos]));
86 h_lines.push(parseInt(highlight_ranges[pos]));
87 }
87 }
88 }
88 }
89 highlight_lines(h_lines);
89 highlight_lines(h_lines);
90
90 var _first_line= YUD.get('L'+h_lines[0]);
91 if(_first_line){
92 _first_line.scrollIntoView()
93 }
91 }
94 }
92
95
93 // select code link event
96 // select code link event
94 YUE.on('hlcode', 'mouseup', getSelectionLink);
97 YUE.on('hlcode', 'mouseup', getSelectionLink);
95
98
96 //load history of file
99 //load history of file
97 YUE.on('load_node_history', 'click', function(e){
100 YUE.on('load_node_history', 'click', function(e){
98 var _url = node_history_url.replace('__REV__','${c.file_changeset.raw_id}').replace('__FPATH__', '${c.f_path}');
101 var _url = node_history_url.replace('__REV__','${c.file_changeset.raw_id}').replace('__FPATH__', '${c.f_path}');
99 ypjax(_url, 'node_history', function(o){
102 ypjax(_url, 'node_history', function(o){
100 tooltip_activate();
103 tooltip_activate();
101 })
104 })
102 });
105 });
103
106
104 });
107 });
105
108
106 </script>
109 </script>
General Comments 0
You need to be logged in to leave comments. Login now