Pass API_HOST into our JS.
This allows us to make sure our dev server is hitting the proper API, like our builds.refactor-builder
parent
3be7e6fdc6
commit
a09f7a7e92
|
@ -12,14 +12,19 @@ $(document).ready(function () {
|
|||
get_data['docroot'] = READTHEDOCS_DATA['docroot']
|
||||
}
|
||||
|
||||
if ("api_host" in READTHEDOCS_DATA) {
|
||||
API_HOST = READTHEDOCS_DATA['api_host']
|
||||
} else {
|
||||
API_HOST = 'https://readthedocs.org'
|
||||
}
|
||||
|
||||
if (window.location.pathname.indexOf('/projects/') == 0) {
|
||||
get_data['subproject'] = true
|
||||
}
|
||||
|
||||
// Theme popout code
|
||||
$.ajax({
|
||||
url: "https://readthedocs.org/api/v2/footer_html/",
|
||||
//url: "http://localhost:8000/api/v2/footer_html/",
|
||||
url: API_HOST + "/api/v2/footer_html/",
|
||||
crossDomain: true,
|
||||
xhrFields: {
|
||||
withCredentials: true,
|
||||
|
@ -126,8 +131,7 @@ $(document).ready(function () {
|
|||
|
||||
// Search results
|
||||
$.ajax({
|
||||
url: "https://readthedocs.org/api/v2/search/section/",
|
||||
//url: "http://localhost:8000/api/v2/search/section/",
|
||||
url: API_HOST + "/api/v2/search/section/",
|
||||
crossDomain: true,
|
||||
xhrFields: {
|
||||
withCredentials: true,
|
||||
|
|
|
@ -86,6 +86,7 @@ context = {
|
|||
'analytics_code': '{{ project.analytics_code }}',
|
||||
'single_version': {{ project.single_version }},
|
||||
'conf_py_path': '{{ conf_py_path }}',
|
||||
'api_host': '{{ api_host }}',
|
||||
'github_user': '{{ github_user }}',
|
||||
'github_repo': '{{ github_repo }}',
|
||||
'github_version': '{{ github_version }}',
|
||||
|
@ -149,6 +150,7 @@ class Builder(BaseBuilder):
|
|||
'template_path': TEMPLATE_DIR,
|
||||
'conf_py_path': conf_py_path,
|
||||
'downloads': apiv2.version(self.version.pk).downloads.get()['downloads'],
|
||||
'api_host': getattr(settings, 'SLUMBER_API_HOST', 'https://readthedocs.org'),
|
||||
# GitHub
|
||||
'github_user': github_info[0],
|
||||
'github_repo': github_info[1],
|
||||
|
|
|
@ -32,7 +32,8 @@
|
|||
language: "{{ rtd_language }}",
|
||||
page: "{{ pagename }}",
|
||||
theme: "{{ html_theme }}",
|
||||
docroot: "{{ conf_py_path }}"
|
||||
docroot: "{{ conf_py_path }}",
|
||||
api_host: "{{ api_host }}"
|
||||
}
|
||||
// Old variables
|
||||
var doc_version = "{{ current_version }}";
|
||||
|
|
Loading…
Reference in New Issue