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=' |
|
|
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 | ${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 | %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: | |
|
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,60 +47,66 b'' | |||
|
43 | 47 | ${_('Binary file (%s)') % c.file.mimetype} |
|
44 | 48 | %else: |
|
45 | 49 | % if c.file.size < c.cut_off_limit: |
|
46 | ${h.pygmentize(c.file,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")} | |
|
50 | %if c.annotate: | |
|
51 | ${h.pygmentize_annotation(c.repo_name,c.file,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")} | |
|
52 | %else: | |
|
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 |
|
51 | <script type="text/javascript"> | |
|
52 | function highlight_lines(lines){ | |
|
53 | for(pos in lines){ | |
|
54 | YUD.setStyle('L'+lines[pos],'background-color','#FFFFBE'); | |
|
55 | } | |
|
56 | } | |
|
57 | page_highlights = location.href.substring(location.href.indexOf('#')+1).split('L'); | |
|
58 | if (page_highlights.length == 2){ | |
|
59 | highlight_ranges = page_highlights[1].split(","); | |
|
60 | ||
|
61 | var h_lines = []; | |
|
62 | for (pos in highlight_ranges){ | |
|
63 | var _range = highlight_ranges[pos].split('-'); | |
|
64 | if(_range.length == 2){ | |
|
65 | var start = parseInt(_range[0]); | |
|
66 | var end = parseInt(_range[1]); | |
|
67 | if (start < end){ | |
|
68 | for(var i=start;i<=end;i++){ | |
|
69 | h_lines.push(i); | |
|
70 | } | |
|
71 | } | |
|
72 | } | |
|
73 | else{ | |
|
74 | h_lines.push(parseInt(highlight_ranges[pos])); | |
|
75 | } | |
|
76 | } | |
|
77 | highlight_lines(h_lines); | |
|
78 | ||
|
79 | //remember original location | |
|
80 | var old_hash = location.href.substring(location.href.indexOf('#')); | |
|
81 | ||
|
82 | // this makes a jump to anchor moved by 3 posstions for padding | |
|
83 | window.location.hash = '#L'+Math.max(parseInt(h_lines[0])-3,1); | |
|
84 | ||
|
85 | //sets old anchor | |
|
86 | window.location.hash = old_hash; | |
|
87 | ||
|
88 | } | |
|
89 | </script> | |
|
90 | 59 | %endif |
|
91 | 60 | </div> |
|
92 | 61 | </div> |
|
93 | 62 | |
|
94 | 63 | <script type="text/javascript"> |
|
95 | 64 | YUE.onDOMReady(function(){ |
|
65 | function highlight_lines(lines){ | |
|
66 | for(pos in lines){ | |
|
67 | YUD.setStyle('L'+lines[pos],'background-color','#FFFFBE'); | |
|
68 | } | |
|
69 | } | |
|
70 | page_highlights = location.href.substring(location.href.indexOf('#')+1).split('L'); | |
|
71 | if (page_highlights.length == 2){ | |
|
72 | highlight_ranges = page_highlights[1].split(","); | |
|
73 | ||
|
74 | var h_lines = []; | |
|
75 | for (pos in highlight_ranges){ | |
|
76 | var _range = highlight_ranges[pos].split('-'); | |
|
77 | if(_range.length == 2){ | |
|
78 | var start = parseInt(_range[0]); | |
|
79 | var end = parseInt(_range[1]); | |
|
80 | if (start < end){ | |
|
81 | for(var i=start;i<=end;i++){ | |
|
82 | h_lines.push(i); | |
|
83 | } | |
|
84 | } | |
|
85 | } | |
|
86 | else{ | |
|
87 | h_lines.push(parseInt(highlight_ranges[pos])); | |
|
88 | } | |
|
89 | } | |
|
90 | highlight_lines(h_lines); | |
|
91 | ||
|
92 | //remember original location | |
|
93 | var old_hash = location.href.substring(location.href.indexOf('#')); | |
|
94 | ||
|
95 | // this makes a jump to anchor moved by 3 posstions for padding | |
|
96 | window.location.hash = '#L'+Math.max(parseInt(h_lines[0])-3,1); | |
|
97 | ||
|
98 | //sets old anchor | |
|
99 | window.location.hash = old_hash; | |
|
100 | ||
|
101 | } | |
|
96 | 102 | YUE.on('show_rev','click',function(e){ |
|
97 | 103 | YUE.preventDefault(e); |
|
98 | 104 | var cs = YUD.get('diff1').value; |
|
99 | var url = "${h.url('files_home',repo_name=c.repo_name,revision='__CS__',f_path=c.f_path)}".replace('__CS__',cs); | |
|
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: | |
|
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