mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-19 21:11:04 +03:00
Javascript fixes for API docs
This commit is contained in:
parent
63a4021472
commit
e8ff5e268b
|
@ -23,7 +23,7 @@ function formEntries (form) {
|
||||||
// Polyfill for new FormData(form).entries()
|
// Polyfill for new FormData(form).entries()
|
||||||
var formData = new FormData(form)
|
var formData = new FormData(form)
|
||||||
if (formData.entries !== undefined) {
|
if (formData.entries !== undefined) {
|
||||||
return formData.entries()
|
return Array.from(formData.entries())
|
||||||
}
|
}
|
||||||
|
|
||||||
var entries = []
|
var entries = []
|
||||||
|
@ -59,6 +59,8 @@ $(function () {
|
||||||
var $selectedAuthentication = $('#selected-authentication')
|
var $selectedAuthentication = $('#selected-authentication')
|
||||||
var $authControl = $('#auth-control')
|
var $authControl = $('#auth-control')
|
||||||
var $authTokenModal = $('#auth_token_modal')
|
var $authTokenModal = $('#auth_token_modal')
|
||||||
|
var $authBasicModal = $('#auth_basic_modal')
|
||||||
|
var $authSessionModal = $('#auth_session_modal')
|
||||||
|
|
||||||
// Language Control
|
// Language Control
|
||||||
$('#language-control li').click(function (event) {
|
$('#language-control li').click(function (event) {
|
||||||
|
@ -260,8 +262,8 @@ $(function () {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
window.auth = null
|
window.auth = null
|
||||||
$selectedAuthentication.text('none')
|
$selectedAuthentication.text('none')
|
||||||
$authControl.children().removeClass('active')
|
$authControl.find("[data-auth]").closest('li').removeClass('active')
|
||||||
$authControl.find("[data-auth='none']").addClass('active')
|
$authControl.find("[data-auth='none']").closest('li').addClass('active')
|
||||||
})
|
})
|
||||||
|
|
||||||
// Authentication: token
|
// Authentication: token
|
||||||
|
@ -276,8 +278,8 @@ $(function () {
|
||||||
'token': token
|
'token': token
|
||||||
}
|
}
|
||||||
$selectedAuthentication.text('token')
|
$selectedAuthentication.text('token')
|
||||||
$authControl.children().removeClass('active')
|
$authControl.find("[data-auth]").closest('li').removeClass('active')
|
||||||
$authControl.find("[data-auth='token']").addClass('active')
|
$authControl.find("[data-auth='token']").closest('li').addClass('active')
|
||||||
$authTokenModal.modal('hide')
|
$authTokenModal.modal('hide')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -293,9 +295,9 @@ $(function () {
|
||||||
'password': password
|
'password': password
|
||||||
}
|
}
|
||||||
$selectedAuthentication.text('basic')
|
$selectedAuthentication.text('basic')
|
||||||
$authControl.children().removeClass('active')
|
$authControl.find("[data-auth]").closest('li').removeClass('active')
|
||||||
$authControl.find("[data-auth='basic']").addClass('active')
|
$authControl.find("[data-auth='basic']").closest('li').addClass('active')
|
||||||
$authTokenModal.modal('hide')
|
$authBasicModal.modal('hide')
|
||||||
})
|
})
|
||||||
|
|
||||||
// Authentication: session
|
// Authentication: session
|
||||||
|
@ -305,8 +307,8 @@ $(function () {
|
||||||
'type': 'session'
|
'type': 'session'
|
||||||
}
|
}
|
||||||
$selectedAuthentication.text('session')
|
$selectedAuthentication.text('session')
|
||||||
$authControl.children().removeClass('active')
|
$authControl.find("[data-auth]").closest('li').removeClass('active')
|
||||||
$authControl.find("[data-auth='session']").addClass('active')
|
$authControl.find("[data-auth='session']").closest('li').addClass('active')
|
||||||
$authTokenModal.modal('hide')
|
$authSessionModal.modal('hide')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
};
|
};
|
||||||
$('#selected-authentication').text('session');
|
$('#selected-authentication').text('session');
|
||||||
$('#auth-control').children().removeClass('active');
|
$('#auth-control').children().removeClass('active');
|
||||||
$('#auth-control').find("[data-auth='session']").addClass('active');
|
$('#auth-control').find("[data-auth='session']").closest('li').addClass('active');
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user