Show More
@@ -454,8 +454,8 b' def make_map(config):' | |||||
454 |
|
454 | |||
455 | rmap.connect('files_annotate_home', |
|
455 | rmap.connect('files_annotate_home', | |
456 | '/{repo_name:.*}/annotate/{revision}/{f_path:.*}', |
|
456 | '/{repo_name:.*}/annotate/{revision}/{f_path:.*}', | |
457 |
controller='files', action=' |
|
457 | controller='files', action='index', revision='tip', | |
458 | f_path='', conditions=dict(function=check_repo)) |
|
458 | f_path='', annotate=True, conditions=dict(function=check_repo)) | |
459 |
|
459 | |||
460 | rmap.connect('files_edit_home', |
|
460 | rmap.connect('files_edit_home', | |
461 | '/{repo_name:.*}/edit/{revision}/{f_path:.*}', |
|
461 | '/{repo_name:.*}/edit/{revision}/{f_path:.*}', |
@@ -112,7 +112,7 b' class FilesController(BaseRepoController' | |||||
112 |
|
112 | |||
113 | @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', |
|
113 | @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', | |
114 | 'repository.admin') |
|
114 | 'repository.admin') | |
115 | def index(self, repo_name, revision, f_path): |
|
115 | def index(self, repo_name, revision, f_path, annotate=False): | |
116 | # redirect to given revision from form if given |
|
116 | # redirect to given revision from form if given | |
117 | post_revision = request.POST.get('at_rev', None) |
|
117 | post_revision = request.POST.get('at_rev', None) | |
118 | if post_revision: |
|
118 | if post_revision: | |
@@ -123,7 +123,7 b' class FilesController(BaseRepoController' | |||||
123 | c.changeset = self.__get_cs_or_redirect(revision, repo_name) |
|
123 | c.changeset = self.__get_cs_or_redirect(revision, repo_name) | |
124 | c.branch = request.GET.get('branch', None) |
|
124 | c.branch = request.GET.get('branch', None) | |
125 | c.f_path = f_path |
|
125 | c.f_path = f_path | |
126 |
|
126 | c.annotate = annotate | ||
127 | cur_rev = c.changeset.revision |
|
127 | cur_rev = c.changeset.revision | |
128 |
|
128 | |||
129 | # prev link |
|
129 | # prev link | |
@@ -219,16 +219,6 b' class FilesController(BaseRepoController' | |||||
219 | response.content_type = mimetype |
|
219 | response.content_type = mimetype | |
220 | return file_node.content |
|
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 | @HasRepoPermissionAnyDecorator('repository.write', 'repository.admin') |
|
222 | @HasRepoPermissionAnyDecorator('repository.write', 'repository.admin') | |
233 | def edit(self, repo_name, revision, f_path): |
|
223 | def edit(self, repo_name, revision, f_path): | |
234 | r_post = request.POST |
|
224 | r_post = request.POST |
@@ -20,7 +20,11 b'' | |||||
20 | <div class="left item"><pre>${h.format_byte_size(c.file.size,binary=True)}</pre></div> |
|
20 | <div class="left item"><pre>${h.format_byte_size(c.file.size,binary=True)}</pre></div> | |
21 | <div class="left item last"><pre>${c.file.mimetype}</pre></div> |
|
21 | <div class="left item last"><pre>${c.file.mimetype}</pre></div> | |
22 | <div class="buttons"> |
|
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 | ${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")} |
|
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 | ${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")} |
|
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 | ${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")} |
|
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 | % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name): |
|
30 | % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name): | |
@@ -43,12 +47,21 b'' | |||||
43 | ${_('Binary file (%s)') % c.file.mimetype} |
|
47 | ${_('Binary file (%s)') % c.file.mimetype} | |
44 | %else: |
|
48 | %else: | |
45 | % if c.file.size < c.cut_off_limit: |
|
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 | ${h.pygmentize(c.file,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")} |
|
53 | ${h.pygmentize(c.file,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")} | |
|
54 | %endif | |||
47 | %else: |
|
55 | %else: | |
48 | ${_('File is too big to display')} ${h.link_to(_('show as raw'), |
|
56 | ${_('File is too big to display')} ${h.link_to(_('show as raw'), | |
49 | h.url('files_raw_home',repo_name=c.repo_name,revision=c.file.changeset.raw_id,f_path=c.f_path))} |
|
57 | h.url('files_raw_home',repo_name=c.repo_name,revision=c.file.changeset.raw_id,f_path=c.f_path))} | |
50 | %endif |
|
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 | YUE.on('show_rev','click',function(e){ |
|
102 | YUE.on('show_rev','click',function(e){ | |
97 | YUE.preventDefault(e); |
|
103 | YUE.preventDefault(e); | |
98 | var cs = YUD.get('diff1').value; |
|
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 | var url = "${h.url('files_home',repo_name=c.repo_name,revision='__CS__',f_path=c.f_path)}".replace('__CS__',cs); |
|
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 | window.location = url; |
|
110 | window.location = url; | |
101 | }); |
|
111 | }); | |
102 | YUE.on('hlcode','mouseup',getSelectionLink("${_('Selection link')}")) |
|
112 | YUE.on('hlcode','mouseup',getSelectionLink("${_('Selection link')}")) |
@@ -1,6 +1,9 b'' | |||||
1 | %if c.file: |
|
1 | %if c.file: | |
2 | <h3 class="files_location"> |
|
2 | <h3 class="files_location"> | |
3 | ${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.changeset.raw_id,c.file.path)} |
|
3 | ${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.changeset.raw_id,c.file.path)} | |
|
4 | %if c.annotate: | |||
|
5 | - ${_('annotation')} | |||
|
6 | %endif | |||
4 | </h3> |
|
7 | </h3> | |
5 | %if c.file.is_dir(): |
|
8 | %if c.file.is_dir(): | |
6 | <%include file='files_browser.html'/> |
|
9 | <%include file='files_browser.html'/> |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now