annotate rhodecode/templates/files/files_source.html @ 969:6e070138d173 beta

implemented #107 variable lines can be now highlighted
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 28 Jan 2011 14:45:30 +0100
parents 5da1286ddd28
children 59b7131c15b1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
362
558eb7c5028f version bump to 0.8
Marcin Kuzminski <marcin@python-works.com>
parents: 278
diff changeset
1 <dl>
802
4a7432d0a1a5 fixed file source and annotation revision links
Marcin Kuzminski <marcin@python-works.com>
parents: 644
diff changeset
2 <dt>${_('Revision')}</dt>
410
9a7ae16ff53e fixes translations, style updates.
Marcin Kuzminski <marcin@python-works.com>
parents: 387
diff changeset
3 <dd>
636
ffd07396d315 Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
4 ${h.link_to("r%s:%s" % (c.files_list.last_changeset.revision,h.short_id(c.files_list.last_changeset.raw_id)),
802
4a7432d0a1a5 fixed file source and annotation revision links
Marcin Kuzminski <marcin@python-works.com>
parents: 644
diff changeset
5 h.url('changeset_home',repo_name=c.repo_name,revision=c.files_list.last_changeset.raw_id))}
410
9a7ae16ff53e fixes translations, style updates.
Marcin Kuzminski <marcin@python-works.com>
parents: 387
diff changeset
6 </dd>
128
9deb6f1d5b90 Implemented file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
7 <dt>${_('Size')}</dt>
167
e5a25c57c97f files source updated to use webhelpers huminizer for file size, and added link to annotation
Marcin Kuzminski <marcin@python-works.com>
parents: 158
diff changeset
8 <dd>${h.format_byte_size(c.files_list.size,binary=True)}</dd>
495
15f837c62fa5 added mimetypes to files
Marcin Kuzminski <marcin@python-works.com>
parents: 485
diff changeset
9 <dt>${_('Mimetype')}</dt>
15f837c62fa5 added mimetypes to files
Marcin Kuzminski <marcin@python-works.com>
parents: 485
diff changeset
10 <dd>${c.files_list.mimetype}</dd>
128
9deb6f1d5b90 Implemented file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
11 <dt>${_('Options')}</dt>
278
ed7abf925696 #4: changes proposed by feedback to annotation
Marcin Kuzminski <marcin@python-works.com>
parents: 267
diff changeset
12 <dd>${h.link_to(_('show annotation'),
644
c8bd0e6cc3da some changes for #45.
Marcin Kuzminski <marcin@python-works.com>
parents: 636
diff changeset
13 h.url('files_annotate_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path))}
485
9836541b0509 added limit for showing pygemntized source codes larger than 250kb.
Marcin Kuzminski <marcin@python-works.com>
parents: 413
diff changeset
14 / ${h.link_to(_('show as raw'),
644
c8bd0e6cc3da some changes for #45.
Marcin Kuzminski <marcin@python-works.com>
parents: 636
diff changeset
15 h.url('files_raw_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path))}
278
ed7abf925696 #4: changes proposed by feedback to annotation
Marcin Kuzminski <marcin@python-works.com>
parents: 267
diff changeset
16 / ${h.link_to(_('download as raw'),
644
c8bd0e6cc3da some changes for #45.
Marcin Kuzminski <marcin@python-works.com>
parents: 636
diff changeset
17 h.url('files_rawfile_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path))}
278
ed7abf925696 #4: changes proposed by feedback to annotation
Marcin Kuzminski <marcin@python-works.com>
parents: 267
diff changeset
18 </dd>
128
9deb6f1d5b90 Implemented file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
19 <dt>${_('History')}</dt>
9deb6f1d5b90 Implemented file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
20 <dd>
410
9a7ae16ff53e fixes translations, style updates.
Marcin Kuzminski <marcin@python-works.com>
parents: 387
diff changeset
21 <div>
9a7ae16ff53e fixes translations, style updates.
Marcin Kuzminski <marcin@python-works.com>
parents: 387
diff changeset
22 ${h.form(h.url('files_diff_home',repo_name=c.repo_name,f_path=c.f_path),method='get')}
636
ffd07396d315 Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
23 ${h.hidden('diff2',c.files_list.last_changeset.raw_id)}
ffd07396d315 Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
24 ${h.select('diff1',c.files_list.last_changeset.raw_id,c.file_history)}
888
6b40654afa1e css optimizations
Marcin Kuzminski <marcin@python-works.com>
parents: 813
diff changeset
25 ${h.submit('diff','diff to revision',class_="ui-button")}
6b40654afa1e css optimizations
Marcin Kuzminski <marcin@python-works.com>
parents: 813
diff changeset
26 ${h.submit('show_rev','show at revision',class_="ui-button")}
128
9deb6f1d5b90 Implemented file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
27 ${h.end_form()}
410
9a7ae16ff53e fixes translations, style updates.
Marcin Kuzminski <marcin@python-works.com>
parents: 387
diff changeset
28 </div>
128
9deb6f1d5b90 Implemented file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
29 </dd>
362
558eb7c5028f version bump to 0.8
Marcin Kuzminski <marcin@python-works.com>
parents: 278
diff changeset
30 </dl>
558eb7c5028f version bump to 0.8
Marcin Kuzminski <marcin@python-works.com>
parents: 278
diff changeset
31
558eb7c5028f version bump to 0.8
Marcin Kuzminski <marcin@python-works.com>
parents: 278
diff changeset
32
128
9deb6f1d5b90 Implemented file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
33 <div id="body" class="codeblock">
144
ea89ac73bef8 Update css +file browsing and diffs
Marcin Kuzminski <marcin@python-works.com>
parents: 129
diff changeset
34 <div class="code-header">
636
ffd07396d315 Fixes for raw_id, needed for git
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
35 <div class="revision">${c.files_list.name}@r${c.files_list.last_changeset.revision}:${h.short_id(c.files_list.last_changeset.raw_id)}</div>
387
2a18192fbd1e templating updates (font sizes)
Marcin Kuzminski <marcin@python-works.com>
parents: 362
diff changeset
36 <div class="commit">"${c.files_list.last_changeset.message}"</div>
144
ea89ac73bef8 Update css +file browsing and diffs
Marcin Kuzminski <marcin@python-works.com>
parents: 129
diff changeset
37 </div>
ea89ac73bef8 Update css +file browsing and diffs
Marcin Kuzminski <marcin@python-works.com>
parents: 129
diff changeset
38 <div class="code-body">
813
e8b5be26fb78 fixed small issue made on latest patches
Marcin Kuzminski <marcin@python-works.com>
parents: 802
diff changeset
39 % if c.files_list.size < c.cut_off_limit:
965
5da1286ddd28 #107 added single line highlight
Marcin Kuzminski <marcin@python-works.com>
parents: 888
diff changeset
40 ${h.pygmentize(c.files_list,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")}
485
9836541b0509 added limit for showing pygemntized source codes larger than 250kb.
Marcin Kuzminski <marcin@python-works.com>
parents: 413
diff changeset
41 %else:
9836541b0509 added limit for showing pygemntized source codes larger than 250kb.
Marcin Kuzminski <marcin@python-works.com>
parents: 413
diff changeset
42 ${_('File is to big to display')} ${h.link_to(_('show as raw'),
644
c8bd0e6cc3da some changes for #45.
Marcin Kuzminski <marcin@python-works.com>
parents: 636
diff changeset
43 h.url('files_raw_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path))}
485
9836541b0509 added limit for showing pygemntized source codes larger than 250kb.
Marcin Kuzminski <marcin@python-works.com>
parents: 413
diff changeset
44 %endif
969
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
45
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
46 <script type="text/javascript">
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
47 function highlight_lines(lines){
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
48 for(pos in lines){
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
49 console.log('L'+lines[pos]);
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
50 YUD.setStyle('L'+lines[pos],'background-color','#FFFFBE');
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
51 }
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
52 }
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
53 page_highlights = location.href.substring(location.href.indexOf('#')+1).split('L');
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
54 if (page_highlights.length == 2){
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
55 highlight_ranges = page_highlights[1].split(",");
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
56
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
57 var h_lines = [];
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
58 for (pos in highlight_ranges){
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
59 var _range = highlight_ranges[pos].split('-');
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
60 if(_range.length == 2){
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
61 var start = parseInt(_range[0]);
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
62 var end = parseInt(_range[1]);
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
63 if (start < end){
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
64 for(var i=start;i<=end;i++){
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
65 h_lines.push(i);
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
66 }
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
67 }
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
68 }
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
69 else{
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
70 h_lines.push(parseInt(highlight_ranges[pos]));
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
71 }
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
72 }
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
73 highlight_lines(h_lines);
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
74 }
6e070138d173 implemented #107 variable lines can be now highlighted
Marcin Kuzminski <marcin@python-works.com>
parents: 965
diff changeset
75 </script>
144
ea89ac73bef8 Update css +file browsing and diffs
Marcin Kuzminski <marcin@python-works.com>
parents: 129
diff changeset
76 </div>
413
0ebec9b88d13 added jump to revision from file history.
Marcin Kuzminski <marcin@python-works.com>
parents: 410
diff changeset
77 </div>
0ebec9b88d13 added jump to revision from file history.
Marcin Kuzminski <marcin@python-works.com>
parents: 410
diff changeset
78
0ebec9b88d13 added jump to revision from file history.
Marcin Kuzminski <marcin@python-works.com>
parents: 410
diff changeset
79 <script type="text/javascript">
0ebec9b88d13 added jump to revision from file history.
Marcin Kuzminski <marcin@python-works.com>
parents: 410
diff changeset
80 YAHOO.util.Event.onDOMReady(function(){
0ebec9b88d13 added jump to revision from file history.
Marcin Kuzminski <marcin@python-works.com>
parents: 410
diff changeset
81 YAHOO.util.Event.addListener('show_rev','click',function(e){
0ebec9b88d13 added jump to revision from file history.
Marcin Kuzminski <marcin@python-works.com>
parents: 410
diff changeset
82 YAHOO.util.Event.preventDefault(e);
0ebec9b88d13 added jump to revision from file history.
Marcin Kuzminski <marcin@python-works.com>
parents: 410
diff changeset
83 var cs = YAHOO.util.Dom.get('diff1').value;
0ebec9b88d13 added jump to revision from file history.
Marcin Kuzminski <marcin@python-works.com>
parents: 410
diff changeset
84 var url = "${h.url('files_home',repo_name=c.repo_name,revision='__CS__',f_path=c.f_path)}".replace('__CS__',cs);
0ebec9b88d13 added jump to revision from file history.
Marcin Kuzminski <marcin@python-works.com>
parents: 410
diff changeset
85 window.location = url;
0ebec9b88d13 added jump to revision from file history.
Marcin Kuzminski <marcin@python-works.com>
parents: 410
diff changeset
86 });
0ebec9b88d13 added jump to revision from file history.
Marcin Kuzminski <marcin@python-works.com>
parents: 410
diff changeset
87 });
0ebec9b88d13 added jump to revision from file history.
Marcin Kuzminski <marcin@python-works.com>
parents: 410
diff changeset
88 </script>