##// END OF EJS Templates
unified annotation view with file source view
marcink -
r2177:ee07357d beta
parent child Browse files
Show More
@@ -454,8 +454,8 b' def make_map(config):'
454 454
455 455 rmap.connect('files_annotate_home',
456 456 '/{repo_name:.*}/annotate/{revision}/{f_path:.*}',
457 controller='files', action='annotate', revision='tip',
458 f_path='', conditions=dict(function=check_repo))
457 controller='files', action='index', revision='tip',
458 f_path='', annotate=True, conditions=dict(function=check_repo))
459 459
460 460 rmap.connect('files_edit_home',
461 461 '/{repo_name:.*}/edit/{revision}/{f_path:.*}',
@@ -112,7 +112,7 b' class FilesController(BaseRepoController'
112 112
113 113 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
114 114 'repository.admin')
115 def index(self, repo_name, revision, f_path):
115 def index(self, repo_name, revision, f_path, annotate=False):
116 116 # redirect to given revision from form if given
117 117 post_revision = request.POST.get('at_rev', None)
118 118 if post_revision:
@@ -123,7 +123,7 b' class FilesController(BaseRepoController'
123 123 c.changeset = self.__get_cs_or_redirect(revision, repo_name)
124 124 c.branch = request.GET.get('branch', None)
125 125 c.f_path = f_path
126
126 c.annotate = annotate
127 127 cur_rev = c.changeset.revision
128 128
129 129 # prev link
@@ -219,16 +219,6 b' class FilesController(BaseRepoController'
219 219 response.content_type = mimetype
220 220 return file_node.content
221 221
222 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
223 'repository.admin')
224 def annotate(self, repo_name, revision, f_path):
225 c.cs = self.__get_cs_or_redirect(revision, repo_name)
226 c.file = self.__get_filenode_or_redirect(repo_name, c.cs, f_path)
227
228 c.file_history = self._get_node_history(c.cs, f_path)
229 c.f_path = f_path
230 return render('files/files_annotate.html')
231
232 222 @HasRepoPermissionAnyDecorator('repository.write', 'repository.admin')
233 223 def edit(self, repo_name, revision, f_path):
234 224 r_post = request.POST
@@ -20,7 +20,11 b''
20 20 <div class="left item"><pre>${h.format_byte_size(c.file.size,binary=True)}</pre></div>
21 21 <div class="left item last"><pre>${c.file.mimetype}</pre></div>
22 22 <div class="buttons">
23 %if c.annotate:
24 ${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")}
25 %else:
23 26 ${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")}
27 %endif
24 28 ${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 29 ${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 30 % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name):
@@ -43,12 +47,21 b''
43 47 ${_('Binary file (%s)') % c.file.mimetype}
44 48 %else:
45 49 % if c.file.size < c.cut_off_limit:
50 %if c.annotate:
51 ${h.pygmentize_annotation(c.repo_name,c.file,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")}
52 %else:
46 53 ${h.pygmentize(c.file,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")}
54 %endif
47 55 %else:
48 56 ${_('File is too big to display')} ${h.link_to(_('show as raw'),
49 57 h.url('files_raw_home',repo_name=c.repo_name,revision=c.file.changeset.raw_id,f_path=c.f_path))}
50 58 %endif
59 %endif
60 </div>
61 </div>
62
51 63 <script type="text/javascript">
64 YUE.onDOMReady(function(){
52 65 function highlight_lines(lines){
53 66 for(pos in lines){
54 67 YUD.setStyle('L'+lines[pos],'background-color','#FFFFBE');
@@ -86,17 +99,14 b''
86 99 window.location.hash = old_hash;
87 100
88 101 }
89 </script>
90 %endif
91 </div>
92 </div>
93
94 <script type="text/javascript">
95 YUE.onDOMReady(function(){
96 102 YUE.on('show_rev','click',function(e){
97 103 YUE.preventDefault(e);
98 104 var cs = YUD.get('diff1').value;
105 %if c.annotate:
106 var url = "${h.url('files_annotate_home',repo_name=c.repo_name,revision='__CS__',f_path=c.f_path)}".replace('__CS__',cs);
107 %else:
99 108 var url = "${h.url('files_home',repo_name=c.repo_name,revision='__CS__',f_path=c.f_path)}".replace('__CS__',cs);
109 %endif
100 110 window.location = url;
101 111 });
102 112 YUE.on('hlcode','mouseup',getSelectionLink("${_('Selection link')}"))
@@ -1,6 +1,9 b''
1 1 %if c.file:
2 2 <h3 class="files_location">
3 3 ${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.changeset.raw_id,c.file.path)}
4 %if c.annotate:
5 - ${_('annotation')}
6 %endif
4 7 </h3>
5 8 %if c.file.is_dir():
6 9 <%include file='files_browser.html'/>
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now