Skip to content

Commit 1f9b513

Browse files
committed
Requested Changes
1 parent 100e2df commit 1f9b513

File tree

2 files changed

+30
-12
lines changed

2 files changed

+30
-12
lines changed

readthedocs/builds/views.py

+24
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
from django.contrib.auth.decorators import login_required
1212
from django.core.urlresolvers import reverse
1313
from django.utils.decorators import method_decorator
14+
from requests.utils import quote
15+
from future.backports.urllib.parse import urlparse
1416

1517
from readthedocs.builds.models import Build, Version
1618
from readthedocs.core.utils import trigger_build
@@ -82,6 +84,28 @@ class BuildDetail(BuildBase, DetailView):
8284
def get_context_data(self, **kwargs):
8385
context = super(BuildDetail, self).get_context_data(**kwargs)
8486
context['project'] = self.project
87+
scheme = ("https://github.com/rtfd/readthedocs.org/issues/new"
88+
"?title={title}{build_id}"
89+
"&body={body}")
90+
91+
body = ("# Details:\n\n"
92+
"*Project URL: https://readthedocs.org/projects/{projname}/\n"
93+
"*Build URL(if applicable): https://readthedocs.org{build_path}\n"
94+
"*Read the Docs username(if applicable): {uname}\n\n"
95+
"## Expected Result\n\n"
96+
"*A description of what you wanted to happen*\n\n"
97+
"## Actual Result\n\n"
98+
"*A description of what actually happened*").format(
99+
projname=self.project, build_path=self.request.path,
100+
uname=self.request.user)
101+
102+
scheme_dict = {'title': quote("Build error with build id #"),
103+
'build_id': context['build'].id,
104+
'body': quote(body)}
105+
106+
issue_url = scheme.format(**scheme_dict)
107+
issue_url = urlparse(issue_url).geturl()
108+
context['issue_url'] = issue_url
85109
return context
86110

87111

readthedocs/templates/builds/build_detail.html

+6-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
{% extends "projects/base_project.html" %}
32

43
{% load i18n %}
@@ -163,16 +162,11 @@ <h3>{% trans "Error" %}</h3>
163162
{{ build.error }}
164163
</p>
165164
<p>
166-
{% blocktrans with build_id=build.pk proj_name=build.project.name build_path=request.get_full_path user_name=request.user %}
167-
Report any build issues <a href="https://github.com/rtfd/readthedocs.org/issues/new?
168-
title=Build%20error%20with%20build%20id%20%23{{ build_id }}
169-
&body=%23%23%20Details%0A%0A
170-
*%20Project%20Url%3A%20https://readthedocs.org/projects/{{ proj_name }}/%0A
171-
*%20Build%20URL%20(if%20applicable)%3A%20https://readthedocs.org{{ build_path }}%0A
172-
*%20Read%20the%20Docs%20username%20(if%20applicable)%3A%20{{ user_name }}%0A%0A
173-
%23%23%20Expected%20Result%0A%0A*%20A%20description%20of%20what%20you%20wanted%20to%20happen*%0A%0A
174-
%23%23%20Actual%20Result%0A%0A*A%20description%20of%20what%20actually%20happened*%0A">here</a>.
175-
{% endblocktrans %}
165+
{% block github_issue_link %}
166+
{% blocktrans with url=issue_url %}
167+
Report any build issues <a href="{{ url }}">here</a>.
168+
{% endblocktrans %}
169+
{% endblock %}
176170
</p>
177171
</div>
178172

@@ -209,4 +203,4 @@ <h3>{% trans "Error" %}</h3>
209203
{% endif %}
210204

211205
</div>
212-
{% endblock %}
206+
{% endblock %}

0 commit comments

Comments
 (0)