Show More
@@ -1,113 +1,104 b'' | |||||
1 | <div id="node_history"> |
|
1 | <div id="node_history"> | |
2 | %if c.load_full_history: |
|
2 | %if c.load_full_history: | |
3 | <%include file='files_history_box.html'/> |
|
3 | <%include file='files_history_box.html'/> | |
4 | %else: |
|
4 | %else: | |
5 | <div style="padding-bottom:10px"> |
|
5 | <div style="padding-bottom:10px"> | |
6 | <span id="load_node_history" class="ui-btn">${_('Load file history')}</span> |
|
6 | <span id="load_node_history" class="ui-btn">${_('Load file history')}</span> | |
7 | </div> |
|
7 | </div> | |
8 | %endif |
|
8 | %endif | |
9 | </div> |
|
9 | </div> | |
10 |
|
10 | |||
11 |
|
11 | |||
12 | <div id="body" class="codeblock"> |
|
12 | <div id="body" class="codeblock"> | |
13 | <div class="code-header"> |
|
13 | <div class="code-header"> | |
14 | <div class="stats"> |
|
14 | <div class="stats"> | |
15 | <div class="left img"><img src="${h.url('/images/icons/file.png')}"/></div> |
|
15 | <div class="left img"><img src="${h.url('/images/icons/file.png')}"/></div> | |
16 | <div class="left item"><pre class="tooltip" title="${h.tooltip(h.fmt_date(c.file_changeset.date))}">${h.link_to("r%s:%s" % (c.file_changeset.revision,h.short_id(c.file_changeset.raw_id)),h.url('changeset_home',repo_name=c.repo_name,revision=c.file_changeset.raw_id))}</pre></div> |
|
16 | <div class="left item"><pre class="tooltip" title="${h.tooltip(h.fmt_date(c.file_changeset.date))}">${h.link_to("r%s:%s" % (c.file_changeset.revision,h.short_id(c.file_changeset.raw_id)),h.url('changeset_home',repo_name=c.repo_name,revision=c.file_changeset.raw_id))}</pre></div> | |
17 | <div class="left item"><pre>${h.format_byte_size(c.file.size,binary=True)}</pre></div> |
|
17 | <div class="left item"><pre>${h.format_byte_size(c.file.size,binary=True)}</pre></div> | |
18 | <div class="left item last"><pre>${c.file.mimetype}</pre></div> |
|
18 | <div class="left item last"><pre>${c.file.mimetype}</pre></div> | |
19 | <div class="buttons"> |
|
19 | <div class="buttons"> | |
20 | %if c.annotate: |
|
20 | %if c.annotate: | |
21 | ${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")} |
|
21 | ${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")} | |
22 | %else: |
|
22 | %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")} |
|
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")} | |
24 | %endif |
|
24 | %endif | |
25 | ${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(_('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")} | |
26 | ${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 | ${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")} | |
27 | % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name): |
|
27 | % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name): | |
28 | % if not c.file.is_binary: |
|
28 | % if not c.file.is_binary: | |
29 | ${h.link_to(_('edit'),h.url('files_edit_home',repo_name=c.repo_name,revision=c.file_changeset.raw_id,f_path=c.f_path),class_="ui-btn")} |
|
29 | ${h.link_to(_('edit'),h.url('files_edit_home',repo_name=c.repo_name,revision=c.file_changeset.raw_id,f_path=c.f_path),class_="ui-btn")} | |
30 | % endif |
|
30 | % endif | |
31 | % endif |
|
31 | % endif | |
32 | </div> |
|
32 | </div> | |
33 | </div> |
|
33 | </div> | |
34 | <div class="author"> |
|
34 | <div class="author"> | |
35 | <div class="gravatar"> |
|
35 | <div class="gravatar"> | |
36 | <img alt="gravatar" src="${h.gravatar_url(h.email_or_none(c.file_changeset.author),16)}"/> |
|
36 | <img alt="gravatar" src="${h.gravatar_url(h.email_or_none(c.file_changeset.author),16)}"/> | |
37 | </div> |
|
37 | </div> | |
38 | <div title="${c.file_changeset.author}" class="user">${h.person(c.file_changeset.author)}</div> |
|
38 | <div title="${c.file_changeset.author}" class="user">${h.person(c.file_changeset.author)}</div> | |
39 | </div> |
|
39 | </div> | |
40 | <div class="commit">${h.urlify_commit(c.file_changeset.message,c.repo_name)}</div> |
|
40 | <div class="commit">${h.urlify_commit(c.file_changeset.message,c.repo_name)}</div> | |
41 | </div> |
|
41 | </div> | |
42 | <div class="code-body"> |
|
42 | <div class="code-body"> | |
43 | %if c.file.is_binary: |
|
43 | %if c.file.is_binary: | |
44 | ${_('Binary file (%s)') % c.file.mimetype} |
|
44 | ${_('Binary file (%s)') % c.file.mimetype} | |
45 | %else: |
|
45 | %else: | |
46 | % if c.file.size < c.cut_off_limit: |
|
46 | % if c.file.size < c.cut_off_limit: | |
47 | %if c.annotate: |
|
47 | %if c.annotate: | |
48 | ${h.pygmentize_annotation(c.repo_name,c.file,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")} |
|
48 | ${h.pygmentize_annotation(c.repo_name,c.file,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")} | |
49 | %else: |
|
49 | %else: | |
50 | ${h.pygmentize(c.file,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")} |
|
50 | ${h.pygmentize(c.file,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")} | |
51 | %endif |
|
51 | %endif | |
52 | %else: |
|
52 | %else: | |
53 | ${_('File is too big to display')} ${h.link_to(_('show as raw'), |
|
53 | ${_('File is too big to display')} ${h.link_to(_('show as raw'), | |
54 | h.url('files_raw_home',repo_name=c.repo_name,revision=c.file_changeset.raw_id,f_path=c.f_path))} |
|
54 | h.url('files_raw_home',repo_name=c.repo_name,revision=c.file_changeset.raw_id,f_path=c.f_path))} | |
55 | %endif |
|
55 | %endif | |
56 | %endif |
|
56 | %endif | |
57 | </div> |
|
57 | </div> | |
58 | </div> |
|
58 | </div> | |
59 |
|
59 | |||
60 | <script type="text/javascript"> |
|
60 | <script type="text/javascript"> | |
61 | YUE.onDOMReady(function(){ |
|
61 | YUE.onDOMReady(function(){ | |
62 | function highlight_lines(lines){ |
|
62 | function highlight_lines(lines){ | |
63 | for(pos in lines){ |
|
63 | for(pos in lines){ | |
64 | YUD.setStyle('L'+lines[pos],'background-color','#FFFFBE'); |
|
64 | YUD.setStyle('L'+lines[pos],'background-color','#FFFFBE'); | |
65 | } |
|
65 | } | |
66 | } |
|
66 | } | |
67 | page_highlights = location.href.substring(location.href.indexOf('#')+1).split('L'); |
|
67 | page_highlights = location.href.substring(location.href.indexOf('#')+1).split('L'); | |
68 | if (page_highlights.length == 2){ |
|
68 | if (page_highlights.length == 2){ | |
69 | highlight_ranges = page_highlights[1].split(","); |
|
69 | highlight_ranges = page_highlights[1].split(","); | |
70 |
|
70 | |||
71 | var h_lines = []; |
|
71 | var h_lines = []; | |
72 | for (pos in highlight_ranges){ |
|
72 | for (pos in highlight_ranges){ | |
73 | var _range = highlight_ranges[pos].split('-'); |
|
73 | var _range = highlight_ranges[pos].split('-'); | |
74 | if(_range.length == 2){ |
|
74 | if(_range.length == 2){ | |
75 | var start = parseInt(_range[0]); |
|
75 | var start = parseInt(_range[0]); | |
76 | var end = parseInt(_range[1]); |
|
76 | var end = parseInt(_range[1]); | |
77 | if (start < end){ |
|
77 | if (start < end){ | |
78 | for(var i=start;i<=end;i++){ |
|
78 | for(var i=start;i<=end;i++){ | |
79 | h_lines.push(i); |
|
79 | h_lines.push(i); | |
80 | } |
|
80 | } | |
81 | } |
|
81 | } | |
82 | } |
|
82 | } | |
83 | else{ |
|
83 | else{ | |
84 | h_lines.push(parseInt(highlight_ranges[pos])); |
|
84 | h_lines.push(parseInt(highlight_ranges[pos])); | |
85 | } |
|
85 | } | |
86 | } |
|
86 | } | |
87 | highlight_lines(h_lines); |
|
87 | highlight_lines(h_lines); | |
88 |
|
88 | |||
89 | //remember original location |
|
|||
90 | var old_hash = location.href.substring(location.href.indexOf('#')); |
|
|||
91 |
|
||||
92 | // this makes a jump to anchor moved by 3 posstions for padding |
|
|||
93 | window.location.hash = '#L'+Math.max(parseInt(h_lines[0])-3,1); |
|
|||
94 |
|
||||
95 | //sets old anchor |
|
|||
96 | window.location.hash = old_hash; |
|
|||
97 |
|
||||
98 | } |
|
89 | } | |
99 |
|
90 | |||
100 | // select code link event |
|
91 | // select code link event | |
101 | YUE.on('hlcode', 'mouseup', getSelectionLink); |
|
92 | YUE.on('hlcode', 'mouseup', getSelectionLink); | |
102 |
|
93 | |||
103 | //load history of file |
|
94 | //load history of file | |
104 | YUE.on('load_node_history', 'click', function(e){ |
|
95 | YUE.on('load_node_history', 'click', function(e){ | |
105 | var _url = node_history_url.replace('__REV__','${c.file_changeset.raw_id}').replace('__FPATH__', '${c.f_path}'); |
|
96 | var _url = node_history_url.replace('__REV__','${c.file_changeset.raw_id}').replace('__FPATH__', '${c.f_path}'); | |
106 | ypjax(_url, 'node_history', function(o){ |
|
97 | ypjax(_url, 'node_history', function(o){ | |
107 | tooltip_activate(); |
|
98 | tooltip_activate(); | |
108 | }) |
|
99 | }) | |
109 | }); |
|
100 | }); | |
110 |
|
101 | |||
111 | }); |
|
102 | }); | |
112 |
|
103 | |||
113 | </script> |
|
104 | </script> |
General Comments 0
You need to be logged in to leave comments.
Login now