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