add commits

This commit is contained in:
Reena-cell 2023-01-11 13:44:08 +01:00
parent 501883f2c0
commit 1ee42d2c5b
4 changed files with 5 additions and 0 deletions

View File

@ -26,6 +26,7 @@
<div class="row">
<div class="col-xs-12 col-sm-2">
<div class="form-group" cols="1" rows="1">
<!--Add Try It button using API-Collection ID after success response for redirecting API-Explorer-->
{% if api_collection.api_collection_id %}
<a class="api_collection_id btn btn-primary" onclick="redirect_api_explorer_url('{{api_collection.collection_on_api_explorer_url}}')" value="{{api_collection.api_collection_id}}">Try It</a>
{% endif %}

View File

@ -1,4 +1,5 @@
$(document).ready(function($) {
// Select a language from navbar which want to change.
var currentURL = window.location.href;
const element = document.getElementById('gb')
element.addEventListener("click", () => {
@ -20,6 +21,7 @@ $(document).ready(function($) {
});
});
// Redirect to API-Explorer, just click on Try Ii button in API-Collection and Dynamic Endpoint after success response.
function redirect_api_explorer_url(api_explorer_url) {
var currentURL = window.location.href.split("/");
if (currentURL[3] == "en") {

View File

@ -20,6 +20,7 @@
<div class="row">
<div class="col-xs-12 col-sm-2">
<div class="form-group" cols="1" rows="1">
<!--Add Try It button using Dynamic Endpoint ID after success response for redirecting API-Explorer-->
{% if dynamic_endpoint.dynamicendpoint_on_api_explorer_url %}
<a class="dynamic_endpoint_id btn btn-primary" onclick="redirect_api_explorer_url('{{dynamic_endpoint.dynamicendpoint_on_api_explorer_url}}')" value="{{dynamic_endpoint.dynamic_endpoint_id}}">Try It</a>
{% else %}

View File

@ -36,6 +36,7 @@ class IndexView(LoginRequiredMixin, FormView):
error_once_only(self.request, response['message'])
else:
dynamic_endpoints=response['dynamic_endpoints']
#Accessing API-Explorer URL, parameters API-Collection Id and selected Language
for locale in dynamic_endpoints:
locale["dynamicendpoint_on_api_explorer_url"] = f"{settings.API_EXPLORER}/?api-dynamic_endpoint-id={locale['dynamic_endpoint_id']}"
except APIError as err: