##// END OF EJS Templates
feat(archives): archive download links uses rel="nofollow" attribute to stop bots from indexing it.
super-admin -
r5248:e139aad4 default
parent child Browse files
Show More
@@ -1,123 +1,123 b''
1 1
2 2 <div id="codeblock" class="browserblock">
3 3 <div class="browser-header">
4 4 <div class="browser-nav">
5 5
6 6 <div class="info_box">
7 7
8 8 <div class="info_box_elem previous">
9 9 <a id="prev_commit_link" data-commit-id="${c.prev_commit.raw_id}" class=" ${('disabled' if c.url_prev == '#' else '')}" href="${c.url_prev}" title="${_('Previous commit')}"><i class="icon-left"></i></a>
10 10 </div>
11 11
12 12 ${h.hidden('refs_filter')}
13 13
14 14 <div class="info_box_elem next">
15 15 <a id="next_commit_link" data-commit-id="${c.next_commit.raw_id}" class=" ${('disabled' if c.url_next == '#' else '')}" href="${c.url_next}" title="${_('Next commit')}"><i class="icon-right"></i></a>
16 16 </div>
17 17 </div>
18 18
19 19 % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name):
20 20
21 21 <div class="new-file">
22 22 <div class="btn-group btn-group-actions">
23 23 <a class="btn btn-primary no-margin" href="${h.route_path('repo_files_add_file',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path)}">
24 24 ${_('Add File')}
25 25 </a>
26 26
27 27 <a class="tooltip btn btn-primary btn-more-option" data-toggle="dropdown" aria-pressed="false" role="button" title="${_('more options')}">
28 28 <i class="icon-down"></i>
29 29 </a>
30 30
31 31 <div class="btn-action-switcher-container right-align">
32 32 <ul class="btn-action-switcher" role="menu" style="min-width: 200px; width: max-content">
33 33 <li>
34 34 <a class="action_button" href="${h.route_path('repo_files_upload_file',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path)}">
35 35 <i class="icon-upload"></i>
36 36 ${_('Upload File')}
37 37 </a>
38 38 </li>
39 39 </ul>
40 40 </div>
41 41 </div>
42 42 </div>
43 43
44 44 % endif
45 45
46 46 % if c.enable_downloads:
47 47 <%
48 48 at_path = '{}'.format(request.GET.get('at') or c.commit.raw_id[:6])
49 49 if c.f_path == '/':
50 50 label = _('Full tree as {}')
51 51 _query = {'with_hash': '1'}
52 52 else:
53 53 label = _('This tree as {}')
54 54 _query = {'at_path':c.f_path, 'with_hash': '1'}
55 55 %>
56 56
57 57 <div class="btn-group btn-group-actions new-file">
58 <a class="archive_link btn btn-default" data-ext=".zip" href="${h.route_path('repo_archivefile',repo_name=c.rhodecode_db_repo.repo_name, fname='{}{}'.format(c.commit.raw_id, '.zip'), _query=_query)}">
58 <a class="archive_link btn btn-default" data-ext=".zip" href="${h.route_path('repo_archivefile',repo_name=c.rhodecode_db_repo.repo_name, fname='{}{}'.format(c.commit.raw_id, '.zip'), _query=_query)}" rel="nofollow">
59 59 <i class="icon-download"></i>
60 60 ${label.format('.zip')}
61 61 </a>
62 62
63 63 <a class="tooltip btn btn-default btn-more-option" data-toggle="dropdown" aria-pressed="false" role="button" title="${_('more download options')}">
64 64 <i class="icon-down"></i>
65 65 </a>
66 66
67 67 <div class="btn-action-switcher-container left-align">
68 68 <ul class="btn-action-switcher" role="menu" style="min-width: 200px; width: max-content">
69 69 % for a_type, content_type, extension in h.ARCHIVE_SPECS:
70 70 % if extension not in ['.zip']:
71 71 <li>
72 <a class="archive_link" data-ext="${extension}" href="${h.route_path('repo_archivefile',repo_name=c.rhodecode_db_repo.repo_name, fname='{}{}'.format(c.commit.raw_id, extension), _query=_query)}">
72 <a class="archive_link" data-ext="${extension}" href="${h.route_path('repo_archivefile',repo_name=c.rhodecode_db_repo.repo_name, fname='{}{}'.format(c.commit.raw_id, extension), _query=_query)}" rel="nofollow">
73 73 <i class="icon-download"></i>
74 74 ${label.format(extension)}
75 75 </a>
76 76 </li>
77 77 % endif
78 78 % endfor
79 79 </ul>
80 80 </div>
81 81 </div>
82 82 % endif
83 83
84 84 <div class="files-quick-filter">
85 85 <ul class="files-filter-box">
86 86 <li class="files-filter-box-path">
87 87 <i class="icon-search"></i>
88 88 </li>
89 89 <li class="files-filter-box-input">
90 90 <input onkeydown="NodeFilter.initFilter(event)" class="init" type="text" placeholder="Quick filter" name="filter" size="25" id="node_filter" autocomplete="off">
91 91 </li>
92 92 </ul>
93 93 </div>
94 94 </div>
95 95
96 96 </div>
97 97
98 98 ## file tree is computed from caches, and filled in
99 99 <div id="file-tree">
100 100 ${c.file_tree |n}
101 101 </div>
102 102
103 103 %if c.readme_data:
104 104 <div id="readme" class="anchor">
105 105 <div class="box">
106 106 <div class="readme-title" title="${h.tooltip(_('Readme file from commit %s:%s') % (c.rhodecode_db_repo.landing_ref_type, c.rhodecode_db_repo.landing_ref_name))}">
107 107 <div>
108 108 <i class="icon-file-text"></i>
109 109 <a href="${h.route_path('repo_files',repo_name=c.repo_name,commit_id=c.rhodecode_db_repo.landing_ref_name,f_path=c.readme_file)}">
110 110 ${c.readme_file}
111 111 </a>
112 112 </div>
113 113 </div>
114 114 <div class="readme codeblock">
115 115 <div class="readme_box">
116 116 ${c.readme_data|n}
117 117 </div>
118 118 </div>
119 119 </div>
120 120 </div>
121 121 %endif
122 122
123 123 </div>
@@ -1,282 +1,282 b''
1 1 <%namespace name="base" file="/base/base.mako"/>
2 2
3 3 <%def name="refs_counters(branches, closed_branches, tags, bookmarks)">
4 4 <span class="summary-branchtag summary-tag">
5 5 <a href="${h.route_path('branches_home',repo_name=c.repo_name)}" class="childs">
6 6 <i class="icon-branch"></i>
7 7 % if len(branches) == 1:
8 8 <span>${len(branches)}</span> ${_('Branch')}
9 9 % else:
10 10 <span>${len(branches)}</span> ${_('Branches')}
11 11 % endif
12 12 </a>
13 13 </span>
14 14
15 15 %if closed_branches:
16 16 <span class="summary-branchtag summary-tag">
17 17 <a href="${h.route_path('branches_home',repo_name=c.repo_name)}" class="childs">
18 18 <i class="icon-branch"></i>
19 19 % if len(closed_branches) == 1:
20 20 <span>${len(closed_branches)}</span> ${_('Closed Branch')}
21 21 % else:
22 22 <span>${len(closed_branches)}</span> ${_('Closed Branches')}
23 23 % endif
24 24 </a>
25 25 </span>
26 26 %endif
27 27
28 28 <span class="summary-tagtag summary-tag">
29 29 <a href="${h.route_path('tags_home',repo_name=c.repo_name)}" class="childs">
30 30 <i class="icon-tag"></i>
31 31 % if len(tags) == 1:
32 32 <span>${len(tags)}</span> ${_('Tag')}
33 33 % else:
34 34 <span>${len(tags)}</span> ${_('Tags')}
35 35 % endif
36 36 </a>
37 37 </span>
38 38
39 39 %if bookmarks:
40 40 <span class="summary-booktag summary-tag">
41 41 <a href="${h.route_path('bookmarks_home',repo_name=c.repo_name)}" class="childs">
42 42 <i class="icon-bookmark"></i>
43 43 % if len(bookmarks) == 1:
44 44 <span>${len(bookmarks)}</span> ${_('Bookmark')}
45 45 % else:
46 46 <span>${len(bookmarks)}</span> ${_('Bookmarks')}
47 47 % endif
48 48 </a>
49 49 </span>
50 50 %endif
51 51 </%def>
52 52
53 53 <%def name="summary_detail(breadcrumbs_links, show_downloads=True, simplified=False)">
54 54 <% summary = lambda n:{False:'summary-short'}.get(n) %>
55 55
56 56 <div id="summary-menu-stats" class="summary-detail">
57 57 <div class="fieldset">
58 58 <div class="left-content">
59 59 <div class="left-clone">
60 60 <select id="clone_option" name="clone_option">
61 61 <option value="http" selected="selected">HTTP</option>
62 62 <option value="http_id">HTTP UID</option>
63 63 % if c.ssh_enabled:
64 64 <option value="ssh">SSH</option>
65 65 % endif
66 66 </select>
67 67 </div>
68 68
69 69 <div class="right-clone">
70 70 <%
71 71 maybe_disabled = ''
72 72 if h.is_svn_without_proxy(c.rhodecode_db_repo):
73 73 maybe_disabled = 'disabled'
74 74 %>
75 75
76 76 <span id="clone_option_http">
77 77 <input type="text" class="input-monospace clone_url_input" ${maybe_disabled} readonly="readonly" value="${c.clone_repo_url}"/>
78 78 <i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${c.clone_repo_url}" title="${_('Copy the clone url')}"></i>
79 79 </span>
80 80
81 81 <span style="display: none;" id="clone_option_http_id">
82 82 <input type="text" class="input-monospace clone_url_input" ${maybe_disabled} readonly="readonly" value="${c.clone_repo_url_id}"/>
83 83 <i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${c.clone_repo_url_id}" title="${_('Copy the clone by id url')}"></i>
84 84 </span>
85 85
86 86 <span style="display: none;" id="clone_option_ssh">
87 87 <input type="text" class="input-monospace clone_url_input" ${maybe_disabled} readonly="readonly" value="${c.clone_repo_url_ssh}"/>
88 88 <i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${c.clone_repo_url_ssh}" title="${_('Copy the clone by ssh url')}"></i>
89 89 </span>
90 90
91 91 % if maybe_disabled:
92 92 <p class="help-block">${_('SVN Protocol is disabled. To enable it, see the')} <a href="${h.route_url('enterprise_svn_setup')}" target="_blank">${_('documentation here')}</a>.</p>
93 93 % endif
94 94 </div>
95 95 </div>
96 96
97 97 <div class="right-content">
98 98 <div class="commit-info">
99 99 <div class="tags">
100 100 <% commit_rev = h.safe_int(c.rhodecode_db_repo.changeset_cache.get('revision'), 0) + 1 %>
101 101 % if c.rhodecode_repo:
102 102 ${refs_counters(
103 103 c.rhodecode_repo.branches,
104 104 c.rhodecode_repo.branches_closed,
105 105 c.rhodecode_repo.tags,
106 106 c.rhodecode_repo.bookmarks)}
107 107 % else:
108 108 ## missing requirements can make c.rhodecode_repo None
109 109 ${refs_counters([], [], [], [])}
110 110 % endif
111 111
112 112 ## commits
113 113 <span class="summary-tag">
114 114 % if commit_rev == -1:
115 115 <i class="icon-history"></i>
116 116 % if commit_rev == -1:
117 117 <span>0</span> ${_('Commit')}
118 118 % else:
119 119 <span>0</span> ${_('Commits')}
120 120 % endif
121 121 % else:
122 122 <a href="${h.route_path('repo_commits', repo_name=c.repo_name)}">
123 123 <i class="icon-history"></i>
124 124 % if commit_rev == 1:
125 125 <span>${commit_rev}</span> ${_('Commit')}
126 126 % else:
127 127 <span>${commit_rev}</span> ${_('Commits')}
128 128 % endif
129 129 </a>
130 130 % endif
131 131 </span>
132 132
133 133 ## forks
134 134 <span class="summary-tag">
135 135 <a title="${_('Number of Repository Forks')}" href="${h.route_path('repo_forks_show_all', repo_name=c.repo_name)}">
136 136 <i class="icon-code-fork"></i>
137 137 <span>${c.repository_forks}</span> ${_ungettext('Fork', 'Forks', c.repository_forks)}</a>
138 138 </span>
139 139 </div>
140 140 </div>
141 141 </div>
142 142 </div>
143 143
144 144 % if not simplified:
145 145 ## owner, description, downloads, statistics
146 146
147 147 ## Owner
148 148 <div class="fieldset collapsable-content" data-toggle="summary-details" style="display: none;">
149 149 <div class="left-label-summary">
150 150 <p>${_('Owner')}</p>
151 151 <div class="right-label-summary">
152 152 ${base.gravatar_with_user(c.rhodecode_db_repo.user.email, 16, tooltip=True)}
153 153 </div>
154 154
155 155 </div>
156 156 </div>
157 157
158 158 ## Description
159 159 <div class="fieldset collapsable-content" data-toggle="summary-details" style="display: none;">
160 160 <div class="left-label-summary">
161 161 <p>${_('Description')}</p>
162 162
163 163 <div class="right-label-summary input ${summary(c.show_stats)}">
164 164 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
165 165 ${dt.repo_desc(c.rhodecode_db_repo.description_safe, c.visual.stylify_metatags)}
166 166 </div>
167 167 </div>
168 168 </div>
169 169
170 170 ## Downloads
171 171 % if show_downloads:
172 172 <div class="fieldset collapsable-content" data-toggle="summary-details" style="display: none;">
173 173 <div class="left-label-summary">
174 174 <p>${_('Downloads')}</p>
175 175
176 176 <div class="right-label-summary input ${summary(c.show_stats)} downloads">
177 177 % if c.rhodecode_repo and len(c.rhodecode_repo.commit_ids) == 0:
178 178 <span class="disabled">
179 179 ${_('There are no downloads yet')}
180 180 </span>
181 181 % elif not c.enable_downloads:
182 182 <span class="disabled">
183 183 ${_('Downloads are disabled for this repository')}.
184 184 </span>
185 185 % if c.is_super_admin:
186 186 ${h.link_to(_('Enable downloads'),h.route_path('edit_repo',repo_name=c.repo_name, _anchor='repo_enable_downloads'))}
187 187 % endif
188 188 % else:
189 189 <div class="enabled pull-left" style="margin-right: 10px">
190 190
191 191 <div class="btn-group btn-group-actions">
192 <a class="archive_link btn btn-small" data-ext=".zip" href="${h.route_path('repo_archivefile',repo_name=c.rhodecode_db_repo.repo_name, fname=c.rhodecode_db_repo.landing_ref_name+'.zip', _query={'with_hash': '1'})}">
192 <a class="archive_link btn btn-small" data-ext=".zip" href="${h.route_path('repo_archivefile',repo_name=c.rhodecode_db_repo.repo_name, fname=c.rhodecode_db_repo.landing_ref_name+'.zip', _query={'with_hash': '1'})}" rel="nofollow">
193 193 <i class="icon-download"></i>
194 194 ${c.rhodecode_db_repo.landing_ref_name}.zip
195 195 ## replaced by some JS on select
196 196 </a>
197 197
198 198 <a class="tooltip btn btn-primary btn-more-option" data-toggle="dropdown" aria-pressed="false" role="button" title="${_('more download options')}">
199 199 <i class="icon-down"></i>
200 200 </a>
201 201
202 202 <div class="btn-action-switcher-container left-align">
203 203 <ul class="btn-action-switcher" role="menu" style="min-width: 200px; width: max-content">
204 204 % for a_type, content_type, extension in h.ARCHIVE_SPECS:
205 205 % if extension not in ['.zip']:
206 206 <li>
207 <a class="archive_link" data-ext="${extension}" href="${h.route_path('repo_archivefile',repo_name=c.rhodecode_db_repo.repo_name, fname=c.rhodecode_db_repo.landing_ref_name+extension, _query={'with_hash': '1'})}">
207 <a class="archive_link" data-ext="${extension}" href="${h.route_path('repo_archivefile',repo_name=c.rhodecode_db_repo.repo_name, fname=c.rhodecode_db_repo.landing_ref_name+extension, _query={'with_hash': '1'})}" rel="nofollow">
208 208 <i class="icon-download"></i>
209 209 ${c.rhodecode_db_repo.landing_ref_name+extension}
210 210 </a>
211 211 </li>
212 212 % endif
213 213 % endfor
214 214 </ul>
215 215 </div>
216 216 </div>
217 217
218 218 </div>
219 219 ${h.hidden('download_options')}
220 220 % endif
221 221 </div>
222 222 </div>
223 223 </div>
224 224 % endif
225 225
226 226 ## Repo size
227 227 <div class="fieldset collapsable-content" data-toggle="summary-details" style="display: none;">
228 228 <div class="left-label-summary">
229 229 <p>${_('Repository size')}</p>
230 230
231 231 <div class="right-label-summary">
232 232 <div class="tags">
233 233 ## repo size
234 234 % if commit_rev == -1:
235 235 <span class="stats-bullet">0 B</span>
236 236 % else:
237 237 <span>
238 238 <a href="#showSize" onclick="calculateSize(); $(this).hide(); return false" id="show-repo-size">Show repository size</a>
239 239 </span>
240 240 <span class="stats-bullet" id="repo_size_container" style="display:none">
241 241 ${_('Calculating Repository Size...')}
242 242 </span>
243 243 % endif
244 244 </div>
245 245 </div>
246 246 </div>
247 247 </div>
248 248
249 249 ## Statistics
250 250 <div class="fieldset collapsable-content" data-toggle="summary-details" style="display: none;">
251 251 <div class="left-label-summary">
252 252 <p>${_('Code Statistics')}</p>
253 253
254 254 <div class="right-label-summary input ${summary(c.show_stats)} statistics">
255 255 % if c.show_stats:
256 256 <div id="lang_stats" class="enabled">
257 257 <a href="#showSize" onclick="calculateSize(); $('#show-repo-size').hide(); $(this).hide(); return false" id="show-repo-size">Show code statistics</a>
258 258 </div>
259 259 % else:
260 260 <span class="disabled">
261 261 ${_('Statistics are disabled for this repository')}.
262 262 </span>
263 263 % if c.is_super_admin:
264 264 ${h.link_to(_('Enable statistics'),h.route_path('edit_repo',repo_name=c.repo_name, _anchor='repo_enable_statistics'))}
265 265 % endif
266 266 % endif
267 267 </div>
268 268
269 269 </div>
270 270 </div>
271 271 % endif
272 272
273 273 </div><!--end summary-detail-->
274 274
275 275 % if simplified:
276 276 <div style="height: 25px"></div>
277 277 %else:
278 278 <div id="summary_details_expand" class="btn-collapse" data-toggle="summary-details">
279 279 ${_('Show More')}
280 280 </div>
281 281 % endif
282 282 </%def>
General Comments 0
You need to be logged in to leave comments. Login now