mirror of
https://github.com/django/django.git
synced 2024-11-30 15:10:46 +01:00
Fixed #25115 -- Made admindocs view bookmarklet reverse the URL rather than hardcode it.
This commit is contained in:
parent
23529fb195
commit
915ef79b08
@ -19,7 +19,7 @@ select the bookmarklet from any page in the site.</p>
|
||||
{% endblocktrans %}
|
||||
|
||||
<div id="content-main">
|
||||
<h3><a href="javascript:(function(){if(typeof ActiveXObject!='undefined'){x=new ActiveXObject('Microsoft.XMLHTTP')}else if(typeof XMLHttpRequest!='undefined'){x=new XMLHttpRequest()}else{return;}x.open('HEAD',location.href,false);x.send(null);try{view=x.getResponseHeader('x-view');}catch(e){alert('No view found for this page');return;}if(view=='undefined'){alert('No view found for this page');}document.location='{{ admin_url|escapejs }}doc/views/'+view+'/';})()">{% trans "Documentation for this page" %}</a></h3>
|
||||
<h3><a href="javascript:(function(){if(typeof ActiveXObject!='undefined'){x=new ActiveXObject('Microsoft.XMLHTTP')}else if(typeof XMLHttpRequest!='undefined'){x=new XMLHttpRequest()}else{return;}x.open('HEAD',location.href,false);x.send(null);try{view=x.getResponseHeader('x-view');}catch(e){alert('No view found for this page');return;}if(view=='undefined'){alert('No view found for this page');}document.location='{% url 'django-admindocs-views-index' %}'+view+'/';})()">{% trans "Documentation for this page" %}</a></h3>
|
||||
<p>{% trans "Jumps you from any page to the documentation for the view that generates that page." %}</p>
|
||||
</div>
|
||||
|
||||
|
@ -74,7 +74,7 @@ class AdminDocViewTests(TestDataMixin, AdminDocsTestCase):
|
||||
|
||||
def test_bookmarklets(self):
|
||||
response = self.client.get(reverse('django-admindocs-bookmarklets'))
|
||||
self.assertContains(response, 'http://testserver/admin/doc/views/')
|
||||
self.assertContains(response, '/admindocs/views/')
|
||||
|
||||
def test_templatetag_index(self):
|
||||
response = self.client.get(reverse('django-admindocs-tags'))
|
||||
|
Loading…
Reference in New Issue
Block a user