comparison rhodecode/templates/files/files_annotate.html @ 2031:82a88013a3fd

merge 1.3 into stable
author Marcin Kuzminski <marcin@python-works.com>
date Sun, 26 Feb 2012 17:25:09 +0200
parents bf263968da47 f91d3f9b7230
children ecd59c28f432
comparison
equal deleted inserted replaced
2005:ab0e122b38a7 2031:82a88013a3fd
11 &raquo; 11 &raquo;
12 ${_('annotate')} @ R${c.cs.revision}:${h.short_id(c.cs.raw_id)} 12 ${_('annotate')} @ R${c.cs.revision}:${h.short_id(c.cs.raw_id)}
13 </%def> 13 </%def>
14 14
15 <%def name="page_nav()"> 15 <%def name="page_nav()">
16 ${self.menu('files')} 16 ${self.menu('files')}
17 </%def> 17 </%def>
18 <%def name="main()"> 18 <%def name="main()">
19 <div class="box"> 19 <div class="box">
20 <!-- box / title --> 20 <!-- box / title -->
21 <div class="title"> 21 <div class="title">
22 ${self.breadcrumbs()} 22 ${self.breadcrumbs()}
23 <ul class="links"> 23 <ul class="links">
24 <li> 24 <li>
25 <span style="text-transform: uppercase;"><a href="#">${_('branch')}: ${c.cs.branch}</a></span> 25 <span style="text-transform: uppercase;"><a href="#">${_('branch')}: ${c.cs.branch}</a></span>
26 </li> 26 </li>
27 </ul> 27 </ul>
28 </div> 28 </div>
29 <div class="table"> 29 <div class="table">
30 <div id="files_data"> 30 <div id="files_data">
31 <h3 class="files_location">${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.cs.revision,c.file.path)}</h3> 31 <h3 class="files_location">${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.cs.revision,c.file.path)}</h3>
32 <dl class="overview"> 32 <dl>
33 <dt>${_('Revision')}</dt> 33 <dt style="padding-top:10px;font-size:16px">${_('History')}</dt>
34 <dd>${h.link_to("r%s:%s" % (c.file.last_changeset.revision,h.short_id(c.file.last_changeset.raw_id)),
35 h.url('changeset_home',repo_name=c.repo_name,revision=c.file.last_changeset.raw_id))} </dd>
36 <dt>${_('Size')}</dt>
37 <dd>${h.format_byte_size(c.file.size,binary=True)}</dd>
38 <dt>${_('Mimetype')}</dt>
39 <dd>${c.file.mimetype}</dd>
40 <dt>${_('Options')}</dt>
41 <dd>${h.link_to(_('show source'),
42 h.url('files_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path))}
43 / ${h.link_to(_('show as raw'),
44 h.url('files_raw_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path))}
45 / ${h.link_to(_('download as raw'),
46 h.url('files_rawfile_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path))}
47 % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name):
48 % if not c.file.is_binary:
49 / ${h.link_to(_('edit'),
50 h.url('files_edit_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path))}
51 % endif
52 % endif
53 </dd>
54 <dt>${_('History')}</dt>
55 <dd> 34 <dd>
56 <div> 35 <div>
57 ${h.form(h.url('files_diff_home',repo_name=c.repo_name,f_path=c.f_path),method='get')} 36 ${h.form(h.url('files_diff_home',repo_name=c.repo_name,f_path=c.f_path),method='get')}
58 ${h.hidden('diff2',c.file.last_changeset.raw_id)} 37 ${h.hidden('diff2',c.file.last_changeset.raw_id)}
59 ${h.select('diff1',c.file.last_changeset.raw_id,c.file_history)} 38 ${h.select('diff1',c.file.last_changeset.raw_id,c.file_history)}
60 ${h.submit('diff','diff to revision',class_="ui-button-small")} 39 ${h.submit('diff','diff to revision',class_="ui-btn")}
61 ${h.submit('show_rev','show at revision',class_="ui-button-small")} 40 ${h.submit('show_rev','show at revision',class_="ui-btn")}
62 ${h.end_form()} 41 ${h.end_form()}
63 </div> 42 </div>
64 </dd> 43 </dd>
65 </dl> 44 </dl>
66 <div id="body" class="codeblock"> 45 <div id="body" class="codeblock">
67 <div class="code-header"> 46 <div class="code-header">
68 <div class="revision">${c.file.name}@r${c.file.last_changeset.revision}:${h.short_id(c.file.last_changeset.raw_id)}</div> 47 <div class="stats">
69 <div class="commit">"${c.file.message}"</div> 48 <div class="left"><img src="${h.url('/images/icons/file.png')}"/></div>
70 </div> 49 <div class="left item">${h.link_to("r%s:%s" % (c.file.last_changeset.revision,h.short_id(c.file.last_changeset.raw_id)),h.url('changeset_home',repo_name=c.repo_name,revision=c.file.last_changeset.raw_id))}</div>
50 <div class="left item">${h.format_byte_size(c.file.size,binary=True)}</div>
51 <div class="left item last">${c.file.mimetype}</div>
52 <div class="buttons">
53 ${h.link_to(_('show source'),h.url('files_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path),class_="ui-btn")}
54 ${h.link_to(_('show as raw'),h.url('files_raw_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path),class_="ui-btn")}
55 ${h.link_to(_('download as raw'),h.url('files_rawfile_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path),class_="ui-btn")}
56 % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name):
57 % if not c.file.is_binary:
58 ${h.link_to(_('edit'),h.url('files_edit_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path),class_="ui-btn")}
59 % endif
60 % endif
61 </div>
62 </div>
63 <div class="author">
64 <div class="gravatar">
65 <img alt="gravatar" src="${h.gravatar_url(h.email(c.cs.author),16)}"/>
66 </div>
67 <div title="${c.cs.author}" class="user">${h.person(c.cs.author)}</div>
68 </div>
69 <div class="commit">${c.file.last_changeset.message}</div>
70 </div>
71 <div class="code-body"> 71 <div class="code-body">
72 %if c.file.is_binary: 72 %if c.file.is_binary:
73 ${_('Binary file (%s)') % c.file.mimetype} 73 ${_('Binary file (%s)') % c.file.mimetype}
74 %else: 74 %else:
75 % if c.file.size < c.cut_off_limit: 75 % if c.file.size < c.cut_off_limit:
76 ${h.pygmentize_annotation(c.repo_name,c.file,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")} 76 ${h.pygmentize_annotation(c.repo_name,c.file,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")}
77 %else: 77 %else:
78 ${_('File is too big to display')} ${h.link_to(_('show as raw'), 78 ${_('File is too big to display')} ${h.link_to(_('show as raw'),
79 h.url('files_raw_home',repo_name=c.repo_name,revision=c.cs.revision,f_path=c.f_path))} 79 h.url('files_raw_home',repo_name=c.repo_name,revision=c.cs.revision,f_path=c.f_path))}
80 %endif 80 %endif
81 <script type="text/javascript"> 81 <script type="text/javascript">
82 function highlight_lines(lines){ 82 function highlight_lines(lines){
83 for(pos in lines){ 83 for(pos in lines){
84 YUD.setStyle('L'+lines[pos],'background-color','#FFFFBE'); 84 YUD.setStyle('L'+lines[pos],'background-color','#FFFFBE');
85 } 85 }
86 } 86 }
87 page_highlights = location.href.substring(location.href.indexOf('#')+1).split('L'); 87 page_highlights = location.href.substring(location.href.indexOf('#')+1).split('L');
88 if (page_highlights.length == 2){ 88 if (page_highlights.length == 2){
89 highlight_ranges = page_highlights[1].split(","); 89 highlight_ranges = page_highlights[1].split(",");
90 90
91 var h_lines = []; 91 var h_lines = [];
92 for (pos in highlight_ranges){ 92 for (pos in highlight_ranges){
93 var _range = highlight_ranges[pos].split('-'); 93 var _range = highlight_ranges[pos].split('-');
94 if(_range.length == 2){ 94 if(_range.length == 2){
95 var start = parseInt(_range[0]); 95 var start = parseInt(_range[0]);
96 var end = parseInt(_range[1]); 96 var end = parseInt(_range[1]);
97 if (start < end){ 97 if (start < end){
98 for(var i=start;i<=end;i++){ 98 for(var i=start;i<=end;i++){
99 h_lines.push(i); 99 h_lines.push(i);
100 } 100 }
101 } 101 }
102 } 102 }
103 else{ 103 else{
104 h_lines.push(parseInt(highlight_ranges[pos])); 104 h_lines.push(parseInt(highlight_ranges[pos]));
105 } 105 }
106 } 106 }
107 highlight_lines(h_lines); 107 highlight_lines(h_lines);
108 108
109 //remember original location 109 //remember original location
110 var old_hash = location.href.substring(location.href.indexOf('#')); 110 var old_hash = location.href.substring(location.href.indexOf('#'));
111 111
112 // this makes a jump to anchor moved by 3 posstions for padding 112 // this makes a jump to anchor moved by 3 posstions for padding
113 window.location.hash = '#L'+Math.max(parseInt(h_lines[0])-3,1); 113 window.location.hash = '#L'+Math.max(parseInt(h_lines[0])-3,1);
114 114
115 //sets old anchor 115 //sets old anchor
116 window.location.hash = old_hash; 116 window.location.hash = old_hash;
117 117
118 } 118 }
119 </script> 119 </script>
120 %endif 120 %endif
121 </div> 121 </div>
122 </div> 122 </div>
123 <script type="text/javascript"> 123 <script type="text/javascript">
124 YAHOO.util.Event.onDOMReady(function(){ 124 YAHOO.util.Event.onDOMReady(function(){
125 YUE.on('show_rev','click',function(e){ 125 YUE.on('show_rev','click',function(e){
127 var cs = YAHOO.util.Dom.get('diff1').value; 127 var cs = YAHOO.util.Dom.get('diff1').value;
128 var url = "${h.url('files_annotate_home',repo_name=c.repo_name,revision='__CS__',f_path=c.f_path)}".replace('__CS__',cs); 128 var url = "${h.url('files_annotate_home',repo_name=c.repo_name,revision='__CS__',f_path=c.f_path)}".replace('__CS__',cs);
129 window.location = url; 129 window.location = url;
130 }); 130 });
131 }); 131 });
132 </script> 132 </script>
133 </div> 133 </div>
134 </div> 134 </div>
135 </div> 135 </div>
136 </%def> 136 </%def>