Show More
@@ -2091,3 +2091,20 b' def notification_description(notificatio' | |||
|
2091 | 2091 | from rhodecode.model.notification import NotificationModel |
|
2092 | 2092 | return NotificationModel().make_description( |
|
2093 | 2093 | notification, translate=request.translate) |
|
2094 | ||
|
2095 | ||
|
2096 | def go_import_header(request, db_repo=None): | |
|
2097 | """ | |
|
2098 | Creates a header for go-import functionality in Go Lang | |
|
2099 | """ | |
|
2100 | ||
|
2101 | if not db_repo: | |
|
2102 | return | |
|
2103 | if 'go-get' not in request.GET: | |
|
2104 | return | |
|
2105 | ||
|
2106 | clone_url = db_repo.clone_url() | |
|
2107 | prefix = re.split(r'^https?:\/\/', clone_url)[-1] | |
|
2108 | # we have a repo and go-get flag, | |
|
2109 | return literal('<meta name="go-import" content="{} {} {}">'.format( | |
|
2110 | prefix, db_repo.repo_type, clone_url)) |
@@ -3,7 +3,7 b'' | |||
|
3 | 3 | |
|
4 | 4 | <% |
|
5 | 5 | c.template_context['repo_name'] = getattr(c, 'repo_name', '') |
|
6 | ||
|
6 | go_import_header = '' | |
|
7 | 7 | if hasattr(c, 'rhodecode_db_repo'): |
|
8 | 8 | c.template_context['repo_type'] = c.rhodecode_db_repo.repo_type |
|
9 | 9 | c.template_context['repo_landing_commit'] = c.rhodecode_db_repo.landing_rev[1] |
@@ -29,6 +29,8 b" c.template_context['default_user'] = {" | |||
|
29 | 29 | <title>${self.title()}</title> |
|
30 | 30 | <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> |
|
31 | 31 |
|
|
32 | ${h.go_import_header(request, getattr(c, 'rhodecode_db_repo', None))} | |
|
33 | ||
|
32 | 34 | % if 'safari' in (request.user_agent or '').lower(): |
|
33 | 35 | <meta name="referrer" content="origin"> |
|
34 | 36 | % else: |
General Comments 0
You need to be logged in to leave comments.
Login now