feature/ redirect API-Explorer url in dynamic endpoint

This commit is contained in:
Reena-cell 2023-01-10 13:35:15 +01:00
parent a361cd4225
commit 0062385156
4 changed files with 5 additions and 5 deletions

View File

@ -27,7 +27,7 @@
<div class="col-xs-12 col-sm-2">
<div class="form-group" cols="1" rows="1">
{% if api_collection.api_collection_id %}
<a class="api_collection_id btn btn-primary" onclick="api_explorer_url_locale('{{api_collection.collection_on_api_explorer_url}}')" value="{{api_collection.api_collection_id}}">Try It</a>
<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 %}
</div>
</div>

View File

@ -1,6 +1,6 @@
$(document).ready(function($) {
var currentURL = window.location.href;
const element = document.getElementById('uk')
const element = document.getElementById('gb')
element.addEventListener("click", () => {
if (currentURL.includes("/es/")) {
location.href = currentURL.split("/es/")[0] + "/en/" + currentURL.split("/es/")[1]
@ -20,7 +20,7 @@ $(document).ready(function($) {
});
});
function api_explorer_url_locale(api_explorer_url) {
function redirect_api_explorer_url(api_explorer_url) {
var currentURL = window.location.href.split("/");
if (currentURL[3] == "en") {
location.href = api_explorer_url + "&locale=en_GB";

View File

@ -106,7 +106,7 @@
{% endif %}
</li>
<li class="language-select language_underline_format"><a style="color:#fff; text-decoration: none !important;">Language
<span id="uk">EN</span>
<span id="gb">EN</span>
|
<span id="es">ES</span></a></li>
</ul>

View File

@ -21,7 +21,7 @@
<div class="col-xs-12 col-sm-2">
<div class="form-group" cols="1" rows="1">
{% if dynamic_endpoint.dynamicendpoint_on_api_explorer_url %}
<a class="dynamic_endpoint_id btn btn-primary" onclick="api_explorer_url_locale('{{dynamic_endpoint.dynamicendpoint_on_api_explorer_url}}')" value="{{dynamic_endpoint.dynamic_endpoint_id}}">Try It</a>
<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 %}
<span>{{dynamic_endpoint.dynamic_endpoint_id}}</span>
{% endif %}