Changeset View
Changeset View
Standalone View
Standalone View
swh/web/browse/views/utils/snapshot_context.py
Show First 20 Lines • Show All 383 Lines • ▼ Show 20 Lines | def browse_snapshot_directory(request, snapshot_id=None, | ||||
dir_path = '/'.join([bc['name'] for bc in breadcrumbs]) + '/' | dir_path = '/'.join([bc['name'] for bc in breadcrumbs]) + '/' | ||||
context_found = 'snapshot: %s' % snapshot_context['snapshot_id'] | context_found = 'snapshot: %s' % snapshot_context['snapshot_id'] | ||||
if origin_info: | if origin_info: | ||||
context_found = 'origin: %s' % origin_info['url'] | context_found = 'origin: %s' % origin_info['url'] | ||||
heading = ('Directory - %s - %s - %s' % | heading = ('Directory - %s - %s - %s' % | ||||
(dir_path, snapshot_context['branch'], context_found)) | (dir_path, snapshot_context['branch'], context_found)) | ||||
top_right_link = None | |||||
if not snapshot_context['is_empty']: | |||||
top_right_link = { | |||||
'url': history_url, | |||||
'icon': swh_object_icons['revisions history'], | |||||
'text': 'History' | |||||
} | |||||
return render(request, 'browse/directory.html', | return render(request, 'browse/directory.html', | ||||
{'heading': heading, | {'heading': heading, | ||||
'swh_object_name': 'Directory', | 'swh_object_name': 'Directory', | ||||
'swh_object_metadata': dir_metadata, | 'swh_object_metadata': dir_metadata, | ||||
'dirs': dirs, | 'dirs': dirs, | ||||
'files': files, | 'files': files, | ||||
'breadcrumbs': breadcrumbs if root_sha1_git else [], | 'breadcrumbs': breadcrumbs if root_sha1_git else [], | ||||
'top_right_link': { | 'top_right_link': top_right_link, | ||||
'url': history_url, | |||||
'icon': swh_object_icons['revisions history'], | |||||
'text': 'History' | |||||
}, | |||||
'readme_name': readme_name, | 'readme_name': readme_name, | ||||
'readme_url': readme_url, | 'readme_url': readme_url, | ||||
'readme_html': readme_html, | 'readme_html': readme_html, | ||||
'snapshot_context': snapshot_context, | 'snapshot_context': snapshot_context, | ||||
'vault_cooking': vault_cooking, | 'vault_cooking': vault_cooking, | ||||
'show_actions_menu': True, | 'show_actions_menu': True, | ||||
'swh_ids': swh_ids}) | 'swh_ids': swh_ids}) | ||||
▲ Show 20 Lines • Show All 159 Lines • ▼ Show 20 Lines | def browse_snapshot_content(request, snapshot_id=None, | ||||
content_path = '/'.join([bc['name'] for bc in breadcrumbs]) | content_path = '/'.join([bc['name'] for bc in breadcrumbs]) | ||||
context_found = 'snapshot: %s' % snapshot_context['snapshot_id'] | context_found = 'snapshot: %s' % snapshot_context['snapshot_id'] | ||||
if origin_info: | if origin_info: | ||||
context_found = 'origin: %s' % origin_info['url'] | context_found = 'origin: %s' % origin_info['url'] | ||||
heading = ('Content - %s - %s - %s' % | heading = ('Content - %s - %s - %s' % | ||||
(content_path, snapshot_context['branch'], context_found)) | (content_path, snapshot_context['branch'], context_found)) | ||||
top_right_link = None | |||||
if not snapshot_context['is_empty']: | |||||
top_right_link = { | |||||
'url': content_raw_url, | |||||
'icon': swh_object_icons['content'], | |||||
'text': 'Raw File' | |||||
} | |||||
return render(request, 'browse/content.html', | return render(request, 'browse/content.html', | ||||
{'heading': heading, | {'heading': heading, | ||||
'swh_object_name': 'Content', | 'swh_object_name': 'Content', | ||||
'swh_object_metadata': content_metadata, | 'swh_object_metadata': content_metadata, | ||||
'content': content, | 'content': content, | ||||
'content_size': content_size, | 'content_size': content_size, | ||||
'max_content_size': content_display_max_size, | 'max_content_size': content_display_max_size, | ||||
'mimetype': mimetype, | 'mimetype': mimetype, | ||||
'language': language, | 'language': language, | ||||
'available_languages': available_languages, | 'available_languages': available_languages, | ||||
'breadcrumbs': breadcrumbs if root_sha1_git else [], | 'breadcrumbs': breadcrumbs if root_sha1_git else [], | ||||
'top_right_link': { | 'top_right_link': top_right_link, | ||||
'url': content_raw_url, | |||||
'icon': swh_object_icons['content'], | |||||
'text': 'Raw File' | |||||
}, | |||||
'snapshot_context': snapshot_context, | 'snapshot_context': snapshot_context, | ||||
'vault_cooking': None, | 'vault_cooking': None, | ||||
'show_actions_menu': True, | 'show_actions_menu': True, | ||||
'swh_ids': swh_ids, | 'swh_ids': swh_ids, | ||||
'error_code': error_code, | 'error_code': error_code, | ||||
'error_message': error_message, | 'error_message': error_message, | ||||
'error_description': error_description}, | 'error_description': error_description}, | ||||
status=error_code) | status=error_code) | ||||
▲ Show 20 Lines • Show All 323 Lines • Show Last 20 Lines |