Luminate's templates for Mexico school. Todos. Hid the Register button in Sandata.

This commit is contained in:
Norm Rasmussen
2024-05-24 18:35:02 -04:00
parent 02d463cf00
commit a65ad4740c
15 changed files with 203 additions and 178 deletions

View File

@ -2,82 +2,63 @@
{% styles colors %}
{% styles custom %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tiny-slider/2.9.4/tiny-slider.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/tiny-slider/2.9.2/min/tiny-slider.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.19.2/axios.min.js"></script>
<!-- JavaScript Bundle with Popper -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.14.7/dist/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<!-- language scripts -->
{% if current_person.signed_in? %}
{% assign lang = current_person.properties.language %}
{% case lang %}
{% when "es" %}
{% include "spanish_lang" %}
{% endcase %}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
// changing language
function changeLanguage(newLanguage, sendRequest=true) {
document.querySelector(".languages-dropdown").classList.remove('show');
if (!window.current_language || window.current_language !== newLanguage) {
window.current_language = newLanguage
} else {
console.log('language already selected')
return null
function setLang(lang) {
if (localStorage.getItem('language') == null || localStorage.getItem('language') != lang) {
localStorage.setItem('language', lang)
}
var data = {
uuid : '{{current_person.id}}',
language : lang
};
$.ajax({
type : 'POST',
url : 'https://webhooks.workato.com/webhooks/rest/06186897-993c-458b-a8e6-394db4151bd0/langchange',
data: JSON.stringify(data),
success:function (data) {
console.log(data);
setTimeout(location.reload.bind(location), 1200);
},
error: function(xhr, status, error) {
console.log(error)
}
});
}
document.querySelectorAll('.current-lang').forEach(activeElement => {
activeElement.classList.remove('current-lang');
});
document.querySelectorAll(`[data-lang="${newLanguage}"]`).forEach(newLanguageElement => {
newLanguageElement.classList.add('current-lang');
});
{% if current_person.signed_in? and current_school.properties.sandbox == false %}
if (sendRequest) {
let xhr = new XMLHttpRequest();
{% if current_school.sso_active? %}
var url = "https://www.workato.com/webhooks/rest/bd1a1eb7-7e79-4208-a1db-8e9c7440bcc9/pipedrive-sso-change-user-language";
{% else %}
var url = "https://www.workato.com/webhooks/rest/bd1a1eb7-7e79-4208-a1db-8e9c7440bcc9/pipedrive-open-change-user-language";
{% endif %}
xhr.open("POST", url, true);
xhr.send(JSON.stringify({
user_id: '{{ current_person.id }}',
language: newLanguage
}));
}
{% endif %}
/* When the user clicks on the button,
toggle between hiding and showing the dropdown content */
function myFunction() {
document.getElementById("myDropdown").classList.toggle("show");
}
window.localStorage.setItem('academy-language', newLanguage);
document.querySelector('body').className = `lang-${newLanguage}`;
}
</script>
<!--Function to display proper courses based on language value-->
<script>
function filterCoursesByLanguage() {
var selectedLanguage = localStorage.getItem('academy-language');
var courses = document.querySelectorAll('.homepage-card-wrapper, .course-card');
if (!courses.length) {
return; // Nie ma żadnych kursów na stronie
}
for (var i = 0; i < courses.length; i++) {
var course = courses[i];
var courseLanguage = course.getAttribute('language');
if (selectedLanguage && courseLanguage !== selectedLanguage) {
course.style.display = 'none'; // Ukryj kursy o nieodpowiednim języku
} else {
course.style.display = 'block'; // Pokaż kursy o wybranym języku
// Close the dropdown if the user clicks outside of it
window.onclick = function(event) {
if (!event.target.matches('.dropbtn')) {
var dropdowns = document.getElementsByClassName("dropdown-content");
var i;
for (i = 0; i < dropdowns.length; i++) {
var openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
}
// Wywołanie funkcji po załadowaniu strony
window.addEventListener('DOMContentLoaded', filterCoursesByLanguage);
// Wywołanie funkcji po zmianie wartości w local storage
window.addEventListener('storage', filterCoursesByLanguage);
}
</script>
{% endif %}