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