Show More
@@ -1,174 +1,176 b'' | |||
|
1 | 1 | <%namespace name="sourceblock" file="/codeblocks/source.mako"/> |
|
2 | 2 | |
|
3 | 3 | <div id="codeblock" class="browserblock"> |
|
4 | 4 | <div class="browser-header"> |
|
5 | 5 | <div class="browser-nav"> |
|
6 | 6 | <div class="pull-left"> |
|
7 | 7 | ## loads the history for a file |
|
8 | 8 | ${h.hidden('file_refs_filter')} |
|
9 | 9 | </div> |
|
10 | 10 | |
|
11 | 11 | <div class="pull-right"> |
|
12 | 12 | |
|
13 | 13 | ## Download |
|
14 | 14 | % if c.lf_node: |
|
15 | 15 | <a class="btn btn-default" href="${h.route_path('repo_file_download',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path, _query=dict(lf=1))}"> |
|
16 | 16 | ${_('Download largefile')} |
|
17 | 17 | </a> |
|
18 | 18 | % else: |
|
19 | 19 | <a class="btn btn-default" href="${h.route_path('repo_file_download',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path)}"> |
|
20 | 20 | ${_('Download file')} |
|
21 | 21 | </a> |
|
22 | 22 | % endif |
|
23 | 23 | |
|
24 | 24 | %if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name): |
|
25 | 25 | ## on branch head, can edit files |
|
26 | 26 | %if c.on_branch_head and c.branch_or_raw_id: |
|
27 | 27 | ## binary files are delete only |
|
28 | 28 | % if c.file.is_binary: |
|
29 | 29 | ${h.link_to(_('Edit'), '#Edit', class_="btn btn-default disabled tooltip", title=_('Editing binary files not allowed'))} |
|
30 | 30 | ${h.link_to(_('Delete'), h.route_path('repo_files_remove_file',repo_name=c.repo_name,commit_id=c.branch_or_raw_id,f_path=c.f_path),class_="btn btn-danger")} |
|
31 | 31 | % else: |
|
32 | 32 | <a class="btn btn-default" href="${h.route_path('repo_files_edit_file',repo_name=c.repo_name,commit_id=c.branch_or_raw_id,f_path=c.f_path)}"> |
|
33 | 33 | ${_('Edit on branch: ')}<code>${c.branch_name}</code> |
|
34 | 34 | </a> |
|
35 | 35 | |
|
36 | 36 | <a class="btn btn-danger" href="${h.route_path('repo_files_remove_file',repo_name=c.repo_name,commit_id=c.branch_or_raw_id,f_path=c.f_path)}"> |
|
37 | 37 | ${_('Delete')} |
|
38 | 38 | </a> |
|
39 | 39 | % endif |
|
40 | 40 | ## not on head, forbid all |
|
41 | 41 | % else: |
|
42 | 42 | ${h.link_to(_('Edit'), '#Edit', class_="btn btn-default disabled tooltip", title=_('Editing files allowed only when on branch head commit'))} |
|
43 | 43 | ${h.link_to(_('Delete'), '#Delete', class_="btn btn-default btn-danger disabled tooltip", title=_('Deleting files allowed only when on branch head commit'))} |
|
44 | 44 | % endif |
|
45 | 45 | %endif |
|
46 | 46 | |
|
47 | 47 | </div> |
|
48 | 48 | </div> |
|
49 | 49 | <div id="file_history_container"></div> |
|
50 | 50 | |
|
51 | 51 | </div> |
|
52 | 52 | </div> |
|
53 | 53 | |
|
54 | 54 | <div class="codeblock"> |
|
55 | 55 | <div class=" codeblock-header"> |
|
56 | 56 | <div class="file-filename"> |
|
57 | 57 | <i class="icon-file"></i> ${c.file} |
|
58 | 58 | </div> |
|
59 | 59 | |
|
60 | 60 | <div class="file-stats"> |
|
61 | 61 | |
|
62 | 62 | <div class="stats-info"> |
|
63 | 63 | <span class="stats-first-item"> |
|
64 | 64 | % if c.file_size_too_big: |
|
65 | 65 | 0 ${(_('lines'))} |
|
66 | 66 | % else: |
|
67 | 67 | ${c.file.lines()[0]} ${_ungettext('line', 'lines', c.file.lines()[0])} |
|
68 | 68 | % endif |
|
69 | 69 | </span> |
|
70 | 70 | |
|
71 | 71 | <span> | ${h.format_byte_size_binary(c.file.size)}</span> |
|
72 | 72 | % if c.lf_node: |
|
73 | 73 | <span title="${_('This file is a pointer to large binary file')}"> | ${_('LargeFile')} ${h.format_byte_size_binary(c.lf_node.size)} </span> |
|
74 | 74 | % endif |
|
75 | 75 | <span> |
|
76 | 76 | | ${c.file.mimetype} |
|
77 | 77 | </span> |
|
78 | 78 | |
|
79 | 79 | % if not c.file_size_too_big: |
|
80 | 80 | <span> | |
|
81 | 81 | ${h.get_lexer_for_filenode(c.file).__class__.__name__} |
|
82 | 82 | </span> |
|
83 | 83 | % endif |
|
84 | 84 | |
|
85 | 85 | </div> |
|
86 | 86 | </div> |
|
87 | 87 | </div> |
|
88 | 88 | |
|
89 | 89 | <div class="path clear-fix"> |
|
90 | 90 | <div class="pull-left"> |
|
91 | 91 | ${h.files_breadcrumbs(c.repo_name,c.commit.raw_id,c.file.path, request.GET.get('at'))} |
|
92 | 92 | </div> |
|
93 | 93 | |
|
94 | 94 | <div class="pull-right stats"> |
|
95 | 95 | <a id="file_history_overview" href="#loadHistory"> |
|
96 | 96 | ${_('History')} |
|
97 | 97 | </a> |
|
98 | 98 | | |
|
99 | 99 | %if c.annotate: |
|
100 | 100 | ${h.link_to(_('Source'), h.route_path('repo_files', repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))} |
|
101 | 101 | %else: |
|
102 | 102 | ${h.link_to(_('Annotation'), h.route_path('repo_files:annotated',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))} |
|
103 | 103 | %endif |
|
104 | 104 | | ${h.link_to(_('Raw'), h.route_path('repo_file_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))} |
|
105 | % if not c.file.is_binary: | |
|
105 | 106 | |<a href="#copySource" onclick="return false;" class="clipboard-action" data-clipboard-text="${c.file.content}">${_('Copy content')}</a> |
|
107 | % endif | |
|
106 | 108 | |
|
107 | 109 | </div> |
|
108 | 110 | <div class="clear-fix"></div> |
|
109 | 111 | </div> |
|
110 | 112 | |
|
111 | 113 | <div class="code-body clear-fix "> |
|
112 | 114 | %if c.file.is_binary: |
|
113 | 115 | <% rendered_binary = h.render_binary(c.repo_name, c.file)%> |
|
114 | 116 | % if rendered_binary: |
|
115 | 117 | ${rendered_binary} |
|
116 | 118 | % else: |
|
117 | 119 | <div> |
|
118 | 120 | ${_('Binary file ({})').format(c.file.mimetype)} |
|
119 | 121 | </div> |
|
120 | 122 | % endif |
|
121 | 123 | %else: |
|
122 | 124 | % if c.file_size_too_big: |
|
123 | 125 | ${_('File size {} is bigger then allowed limit {}. ').format(h.format_byte_size_binary(c.file.size), h.format_byte_size_binary(c.visual.cut_off_limit_file))} ${h.link_to(_('Show as raw'), |
|
124 | 126 | h.route_path('repo_file_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))} |
|
125 | 127 | % else: |
|
126 | 128 | %if c.renderer and not c.annotate: |
|
127 | 129 | ## pick relative url based on renderer |
|
128 | 130 | <% |
|
129 | 131 | relative_urls = { |
|
130 | 132 | 'raw': h.route_path('repo_file_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path), |
|
131 | 133 | 'standard': h.route_path('repo_files',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path), |
|
132 | 134 | } |
|
133 | 135 | %> |
|
134 | 136 | ${h.render(c.file.content, renderer=c.renderer, relative_urls=relative_urls)} |
|
135 | 137 | %else: |
|
136 | 138 | <table class="cb codehilite"> |
|
137 | 139 | %if c.annotate: |
|
138 | 140 | <% color_hasher = h.color_hasher() %> |
|
139 | 141 | %for annotation, lines in c.annotated_lines: |
|
140 | 142 | ${sourceblock.render_annotation_lines(annotation, lines, color_hasher)} |
|
141 | 143 | %endfor |
|
142 | 144 | %else: |
|
143 | 145 | %for line_num, tokens in enumerate(c.lines, 1): |
|
144 | 146 | ${sourceblock.render_line(line_num, tokens)} |
|
145 | 147 | %endfor |
|
146 | 148 | %endif |
|
147 | 149 | </table> |
|
148 | 150 | %endif |
|
149 | 151 | % endif |
|
150 | 152 | %endif |
|
151 | 153 | </div> |
|
152 | 154 | |
|
153 | 155 | </div> |
|
154 | 156 | |
|
155 | 157 | <script type="text/javascript"> |
|
156 | 158 | % if request.GET.get('mark'): |
|
157 | 159 | |
|
158 | 160 | $(function(){ |
|
159 | 161 | $(".codehilite").mark( |
|
160 | 162 | "${request.GET.get('mark')}", |
|
161 | 163 | { |
|
162 | 164 | "className": 'match', |
|
163 | 165 | "accuracy": "complementary", |
|
164 | 166 | "ignorePunctuation": ":._(){}[]!'+=".split(""), |
|
165 | 167 | "each": function(el) { |
|
166 | 168 | // and also highlight lines ! |
|
167 | 169 | $($(el).closest('tr')).find('td.cb-lineno').addClass('cb-line-selected'); |
|
168 | 170 | } |
|
169 | 171 | } |
|
170 | 172 | ); |
|
171 | 173 | |
|
172 | 174 | }); |
|
173 | 175 | % endif |
|
174 | 176 | </script> |
General Comments 0
You need to be logged in to leave comments.
Login now