Lumiante templates. Anthology and Datasnipper too. Quick scripts.

This commit is contained in:
Norm Rasmussen
2024-10-01 17:11:02 -04:00
parent 14a3266b89
commit c3c374bda1
10 changed files with 138 additions and 337 deletions

View File

@ -186,7 +186,21 @@
{% assign flag = '' %}
{% endunless %}
<div class="np-card course-card">
{% capture course_path %}{% route course, id: course.id %}{% endcapture %}
{% assign act_count = 0 %}
{% for section in course.sections %}
{% for activity in section.activities %}
{% assign act_count = act_count | plus : 1 %}
{% endfor %}
{% endfor %}
{% assign allCats = '' %}
{% for category in course.categories %}
{% assign allCats = allCats | append: category.name | append: ' || '%}
{% endfor %}
<div class="np-card course-card" data-product="{{course.properties.product_names_for_course_cards}}" data-categories="{{ allCats }}">
{%- comment -%} {% unless flag == 'catalog' %}
{% endunless %} {%- endcomment -%}
<div class="np-progress-bar-container" style="background: {{ color_light }}">

View File

@ -186,6 +186,20 @@
{% assign flag = '' %}
{% endunless %}
{% capture course_path %}{% route course, id: course.id %}{% endcapture %}
{% assign act_count = 0 %}
{% for section in course.sections %}
{% for activity in section.activities %}
{% assign act_count = act_count | plus : 1 %}
{% endfor %}
{% endfor %}
{% assign allCats = '' %}
{% for category in course.categories %}
{% assign allCats = allCats | append: category.name | append: ' || '%}
{% endfor %}
<div class="np-card course-card">
<div class="np-progress-bar-container" style="background: {{ color_light }}">
<div

View File

@ -117,24 +117,24 @@
eventItems.forEach((item) => { item.style.display = "none" })
if (selectedFilter == "datasnipper") {
eventItems.forEach((item) => {
eventItems.forEach((item) => {
const eventTitle = item.querySelector(".np-card-content-title").innerText.toLowerCase().trim()
if (eventTitle == "automation with datasnipper" || eventTitle == "datasnipper q&a" || eventTitle == "datasnipper tips & tricks") {
item.style.display = "flex"
item.style.display = "flex"
}
})
} else if (selectedFilter == "financial statement suite") {
eventItems.forEach((item) => {
eventItems.forEach((item) => {
const eventTitle = item.querySelector(".np-card-content-title").innerText.toLowerCase().trim()
if (eventTitle == "welcome to the financial statement suite" || eventTitle == "financial statement suite tips & tricks") {
item.style.display = "flex"
item.style.display = "flex"
}
})
} else if (selectedFilter == "interactive learning") {
eventItems.forEach((item) => {
eventItems.forEach((item) => {
const eventTitle = item.querySelector(".np-card-content-title").innerText.toLowerCase().trim()
if (eventTitle == "datasnipper q&a" || eventTitle == "datasnipper tips & tricks" || eventTitle == "financial statement suite tips & tricks") {
item.style.display = "flex"
item.style.display = "flex"
}
})
}
@ -160,4 +160,4 @@
indexesArray.forEach(e => document.querySelector(".training-sessions").appendChild(e));
}
</script>
</script>

View File

@ -40,9 +40,9 @@
.Dashboard.np-sub-navigation-content-item-link,
.Events.np-sub-navigation-content-item-link,
.Learning.Paths.np-sub-navigation-content-item-link,
.Home.np-footer-navigation-link.np-button-color,
.Learning.Paths.np-footer-navigation-link.np-button-color,
.Events.np-footer-navigation-link.np-button-color,
.np-footer-navigation-link.np-button-color,
.np-footer-navigation-link.np-button-color,
.np-footer-navigation-link.np-button-color,
.course-completion,
.np-header-avatar-tooltip-navigation-link,
.np-header-avatar-tooltip-navigation-link.np-danger,
@ -355,7 +355,7 @@ body > main > div.np-catalog-header-wrapper > div.np-catalog-header > div.np-res
text-indent: 0;
line-height: .5;
display: block;
content: « Bienvenue dans l'apprentissage Walmart Luminate »;
content: "Bienvenue dans Walmart Luminate Learning";
}
.Home.np-homepage-subheadline::after {
@ -655,7 +655,7 @@ body > main > div.np-catalog-header-wrapper > div.np-catalog-header > div.np-res
margin-top: 8px;
}
.Home.np-footer-navigation-link.np-button-color::after {
.np-footer-navigation-link.np-button-color::after {
/* Home */
text-indent: 0;
line-height: 0;
@ -664,7 +664,7 @@ body > main > div.np-catalog-header-wrapper > div.np-catalog-header > div.np-res
margin-top: -9px;
}
.Events.np-footer-navigation-link.np-button-color::after {
.np-footer-navigation-link.np-button-color::after {
/* Events */
text-indent: 0;
line-height: 0;
@ -673,7 +673,7 @@ body > main > div.np-catalog-header-wrapper > div.np-catalog-header > div.np-res
margin-top: -9px;
}
.Learning.Paths.np-footer-navigation-link.np-button-color::after {
.np-footer-navigation-link.np-button-color::after {
/* Learning Paths */
text-indent: 0;
line-height: 0;

View File

@ -87,7 +87,7 @@
</div>
<ul class="languages-dropdown">
<li data-lang="en" class="current-lang" onclick="setLang(this.getAttribute('data-lang'))">English</li>
<li data-lang="es" onclick="setLang(this.getAttribute('data-lang'))">Español</li>
<li data-lang="fr" onclick="setLang(this.getAttribute('data-lang'))">French</li>
</ul>
</div>

View File

@ -26,6 +26,7 @@
</div>
</nav>
{% comment %}
<script>
if (window.location.pathname == "/app/articles") {
document.querySelector(".articles-link").classList.add("np-sub-navigation-content-item-active")
@ -39,6 +40,7 @@
document.querySelector(".certifications-link").classList.add("np-sub-navigation-content-item-inactive")
}
</script>
{% endcomment %}
<style>
/*

View File

@ -1,71 +1,7 @@
<script>
function showPopup() {
setTimeout(function() {
document.querySelector(".popup-trigger").click()
}, 500)
}
function showSurveyPopup() {
setTimeout(function() {
document.querySelector(".survey-popup-trigger").click()
}, 500)
}
function formatDate(date) {
const month = (date.getMonth() + 1).toString().padStart(2, '0');
const day = date.getDate().toString().padStart(2, '0');
const year = date.getFullYear();
return `${month}/${day}/${year}`;
}
function RerunWorkato() {
const today = new Date();
const formattedDate = formatDate(today);
const data = {
person_uuid: '{{current_person.id}}',
date: formattedDate
}
let webhookUrl
if (schoolID == "804edb32-c300-42f3-82b7-e5d55fcbc2a6") {
webhookUrl = "https://webhooks.workato.com/webhooks/rest/bd1a1eb7-7e79-4208-a1db-8e9c7440bcc9/user-interacted-with-popup"
} else if (schoolID == "10183441-2254-4b1e-a9f7-9549ca773257") { // live school
webhookUrl = "https://webhooks.workato.com/webhooks/rest/bd1a1eb7-7e79-4208-a1db-8e9c7440bcc9/user-interacted-with-popup-live"
}
if (webhookUrl) {
fetch(webhookUrl, {
method: 'post',
body: JSON.stringify(data)
}).then(function(response) {
return response.json();
}).then(function(data) {
console.log(res)
}).catch(error => {
console.log(error)
});
}
}
</script>
{% assign catalog_courses = courses.in_catalog %}
{% assign survey_courses = "" %}
{% assign survey_course_completed = false %}
{% comment %} {% if current_school.id == "10183441-2254-4b1e-a9f7-9549ca773257" %} {% endif %}{% endcomment %}
{% comment %} LIVE SCHOOL {% endcomment %}
{% comment %} {% assign survey_course = catalog_courses | where: "id", "b3225a47-448d-4988-962a-18d37d6616d0" %} {% endcomment %}
{% comment %} {% if current_school.id == "804edb32-c300-42f3-82b7-e5d55fcbc2a6" %} {% endif %} {% endcomment %}
{% comment %} SANDBOX SCHOOL {% endcomment %}
{% comment %} {% assign survey_course = catalog_courses | where: "id", "fdc8acdc-0b7c-4064-a52b-1955379d411b" %} {% endcomment %}
{% comment %} {% endif %} {% endcomment %}
{% comment %} {% for course in survey_course %} {% endfor %} {% endcomment %}
{% comment %} {% if course.progress == 100 %} {% endif %}{% endcomment %}
{% comment %} {% assign survey_course_completed = true %} {% endcomment %}
{% comment %} {% endif %} {% endcomment %}
{% comment %} {% endfor %} {% endcomment %}
{% include "header" %}
<main class="np-main np-homepage">
@ -84,13 +20,13 @@
data-test="mobile-search"
method="get"
action="{% route search %}">
{% if current_person.properties.language == "es" %}
{% if current_person.properties.language == "fr" %}
<input
aria-label="¿Qué estás buscando?"
aria-label="?"
class="hero-search-input"
type="text"
name="q"
placeholder="¿Qué estás buscando?" />
placeholder="?" />
{% else %}
<input
aria-label="What are you looking for?"
@ -113,179 +49,15 @@
{% include "homepage_featured", items: catalog_courses %}
{% comment %}
<div class="np-max-width np-homepage-row-wrapper">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12" style="display:flex; flex-direction:column;">
<div class="Progress np-section-header">Progress Tracker</div>
<div class="learning-path-progress-container">
<div class="row">
{% assign lps_in_progress = 0 %}
{% assign enrolled_learning_paths = learning_paths.enrolled | sort: "progress" | reverse %}
{% for learning_path in enrolled_learning_paths %}
{% if learning_path.progress > 0 %}
{% assign lps_in_progress = lps_in_progress | plus: 1 %}
{% if lps_in_progress < 4 %}
<div class="col-xs-12 col-md-4">
{% include "cards_learning_path_progress" %}
</div>
{% endif %}
{% endif %}
{% endfor %}
{% if lps_in_progress > 0 %}
<div class="see-more-wrapper">
<a href="/app/dashboard" style="margin-top:24px;">See more</a>
</div>
{% endif %}
{% if lps_in_progress == 0 %}
<div class="col-xs-12">
<div class="np-learning-paths-resources-container">
<div class="np-zero-state-text">
Yikes! You don't have any learning Paths in progress.
</div>
<img class="np-zero-state-learning-paths" alt="" />
</div>
</div>
{% endif %}
</div>
{% endcomment %}
</div>
</div>
{% comment %} {% if features.training_events? %}
<div class="col-xs-12 col-sm-5 col-md-4">
<div class="homepage-events">
<div class="np-section-header">Upcoming Courses</div>
<div class="upcoming events">
{% if training_events.available.any? %}
{% for training_event in training_events.available limit:1 %}
{% include "cards_training_event" with training_event %}
{% endfor %}
<div class="see-more-wrapper">
<a href="/app/training_events" style="margin-top:24px;">See more</a>
</div>
{% else %}
{% include "training_events_zero_state" %}
{% endif %}
</div>
</div>
</div>
{% endif %} {% endcomment %}
</div>
</div>
{% include "homepage_ongoing_training", items: catalog_courses %}
{% comment %} {% include "homepage_topics" %} {% endcomment %}
<button
type="button"
class="popup-trigger"
data-toggle-class-on-target
data-toggle-target="#firstTimeUsers"
data-toggle-escape
data-toggle-modal>
Click
</button>
<button
type="button"
class="survey-popup-trigger"
data-toggle-class-on-target
data-toggle-target="#surveyPopup"
data-toggle-escape
data-toggle-modal>
Click
</button>
</main>
{% include "footer" %}
<div
class="first-time-user-popup"
id="firstTimeUsers"
role="dialog"
aria-labelledby="dialogTitle"
aria-describedby="dialogContent"
aria-hidden="true">
<section class="first-time-user-popup-container">
<div id="dialogContent" class="first-time-user-popup-content">
<div class="modal-headline">
{% if current_person.first_name %}&#128075; Hi, {{ current_person.first_name }}!{% endif %}
Welcome to Walmart Luminate Learning! Can we help you get familiar with the site?</div>
<div class="modal-links">
<a
href="javascript:setPopupSeenProperty('/app/dashboard')"
class="secondary"
data-toggle-trigger-off>No thanks! I can figure it out.</a>
{% if current_school.id == "10183441-2254-4b1e-a9f7-9549ca773257" %}
{% comment %} LIVE SCHOOL {% endcomment %}
<a href="javascript:setPopupSeenProperty('https://walmartluminate.northpass.com/c/fabe6410eee0c1fa338f11d854edccada8780b6f')">Sure! Show me around.</a>
{% elsif current_school.id == "804edb32-c300-42f3-82b7-e5d55fcbc2a6" %}
{% comment %} SANDBOX SCHOOL {% endcomment %}
<a href="javascript:setPopupSeenProperty('/app/courses/52f20328-9868-40e5-9ceb-699f6ab2c6ec')" ">Sure! Show me around.</a>
{% endif %}
</div>
</div>
</section>
</div>
<div
class="survey-popup"
id="surveyPopup"
role="dialog"
aria-labelledby="dialogTitle"
aria-describedby="dialogContent"
aria-hidden="true">
<section class="survey-popup-container">
<div id="dialogContent" class="survey-popup-content">
<div class="modal-headline">Help us improve your experience!</div>
<div class="modal-links">
{% if current_school.id == "10183441-2254-4b1e-a9f7-9549ca773257" %}
{% comment %} LIVE SCHOOL {% endcomment %}
<a href="javascript:setSurveyPopupSeen('/app/courses/b3225a47-448d-4988-962a-18d37d6616d0')">Go!</a>
{% elsif current_school.id == "804edb32-c300-42f3-82b7-e5d55fcbc2a6" %}
{% comment %} SANDBOX SCHOOL {% endcomment %}
<a href="javascript:setSurveyPopupSeen('/app/courses/fdc8acdc-0b7c-4064-a52b-1955379d411b')">Go!</a>
{% endif %}
</div>
</div>
</section>
</div>
{% if current_person.signed_in? %}
{% unless current_person.email contains "+preview" %}
{% if current_person.properties.first_time_user_popup_seen == false %}
<script>
console.log('property is false, check local storage')
if (localStorage.getItem('modal_clicked') != null) {
console.log("rerun workflow to set property")
RerunWorkato()
} else {
showPopup()
}
</script>
{% elsif current_person.properties.first_time_user_popup_seen == true %}
<script>
console.log("property is set, deleting local storage, don't initialize first modal")
localStorage.removeItem("modal_clicked")
</script>
{% else %}
<script>
console.log('custom prop doesnt yet exist')
if (localStorage.getItem('modal_clicked') != null) {
console.log("rerun workflow to set property")
RerunWorkato()
} else {
showPopup()
}
</script>
{% endif %}
{% endunless %}
{% endif %}
{% include "footer" %}
<script>
if (window.location.pathname == "/app") {
@ -298,7 +70,6 @@
.classList
.add("homepage-nav")
}
document.querySelector(".np-hidden-desktop .dropdown-arrow").addEventListener("click", function(e) {
if (e
.target
@ -331,40 +102,7 @@
stickySubNav.classList.remove('fixed');
}
};
const firstPopupSeen = {{current_person.properties.first_time_user_popup_seen}}
if (firstPopupSeen == true) {
var popupSeenDate = new Date("{{current_person.properties.first_popup_date}}");
var popupSeenSeconds = popupSeenDate.getTime() / 1000;
var currentDate = new Date();
var currentDateSeconds = currentDate.getTime() / 1000;
if (currentDateSeconds > (popupSeenSeconds + 1209600) && currentDateSeconds) {
console.log("more than 2 weeks after first popup")
const surveyCourseCompleted = {{survey_course_completed}}
if (surveyCourseCompleted == false) {
if (localStorage.getItem("survey_modal_clicked") == null) {
showSurveyPopup()
} else {
const lastClickedDateSeconds = new Date(localStorage.getItem("survey_modal_clicked")).getTime() / 1000
if (currentDateSeconds > (lastClickedDateSeconds + 1209600) && currentDateSeconds) {
showSurveyPopup()
} else {
console.log(`dont show survey popup again until 2 weeks after ${
localStorage.getItem("survey_modal_clicked")
} or course completed`)
}
}
} else {
localStorage.removeItem("survey_modal_clicked");
}
}
}
};
function findOffset(element) {
var top = 0,
@ -403,59 +141,7 @@
const offset = circumference - percent * circumference;
circle.style.strokeDashoffset = offset;
}
})
function setPopupSeenProperty(redirectUrl) {
localStorage.setItem("modal_clicked", true);
const today = new Date();
const formattedDate = formatDate(today);
const data = {
person_uuid: '{{current_person.id}}',
date: formattedDate
}
const schoolID = '{{current_school.id}}'
let webhookUrl
if (schoolID == "804edb32-c300-42f3-82b7-e5d55fcbc2a6") {
webhookUrl = "https://webhooks.workato.com/webhooks/rest/bd1a1eb7-7e79-4208-a1db-8e9c7440bcc9/user-interacted-with-popup"
} else if (schoolID == "10183441-2254-4b1e-a9f7-9549ca773257") { // live school
webhookUrl = "https://webhooks.workato.com/webhooks/rest/bd1a1eb7-7e79-4208-a1db-8e9c7440bcc9/user-interacted-with-popup-live"
}
if (webhookUrl) {
fetch(webhookUrl, {
method: 'post',
body: JSON.stringify(data)
}).then(function(response) {
return response.json();
}).then(function(data) {
console.log(res)
setTimeout(function() {
window.location.href = redirectUrl;
}, 250)
}).catch(error => {
console.log(error)
setTimeout(function() {
window.location.href = redirectUrl;
}, 250)
});
}
}
function setSurveyPopupSeen(redirectUrl) {
const today = new Date();
const formattedDate = formatDate(today);
localStorage.setItem("survey_modal_clicked", formattedDate);
setTimeout(function() {
window.location.href = redirectUrl;
}, 250)
}
</script>
<style>

View File

@ -0,0 +1,84 @@
if (window.location.pathname == "/app") {
document
.querySelector(".np-sub-navigation")
.classList
.add("homepage-nav")
document
.querySelector(".np-header")
.classList
.add("homepage-nav")
}
document.querySelector(".np-hidden-desktop .dropdown-arrow").addEventListener("click", function(e) {
if (e
.target
.parentElement
.classList
.contains("open")) {
e
.target
.parentElement
.classList
.remove("open")
} else {
e
.target
.parentElement
.classList
.add("open")
}
})
window.onload = function() {
var stickySubNav = document.querySelector('.np-sub-navigation');
var headerOffset = findOffset(stickySubNav);
window.onscroll = function() {
var bodyScrollTop = document.documentElement.scrollTop || document.body.scrollTop;
if (bodyScrollTop > (headerOffset.top - 24)) {
stickySubNav.classList.add('fixed');
} else {
stickySubNav.classList.remove('fixed');
}
};
const firstPopupSeen = {{current_person.properties.first_time_user_popup_seen}}
function findOffset(element) {
var top = 0,
left = 0;
do {
top += element.offsetTop || 0;
left += element.offsetLeft || 0;
element = element.offsetParent;
} while (element);
return {top: top, left: left};
}
window.addEventListener("load", function() {
var progressCards = document.querySelectorAll(".np-card-learning-path-progress");
for (var i = 0; i < progressCards.length; i++) {
var lpProgressCard = progressCards[i]
var progressRing = lpProgressCard.querySelector(".progress-ring")
let circle = progressRing.querySelector(".circle-progress")
let total = progressRing.getAttribute("data-total")
let numCompleted = lpProgressCard.querySelector(".lp-completed-items span > div").getAttribute("data-completed")
var radius = circle.r.baseVal.value;
var circumference = radius * 2 * Math.PI;
circle.style.strokeDasharray = `${circumference} ${circumference}`;
circle.style.strokeDashoffset = `${circumference}`;
const percent = numCompleted / total
setProgress(percent, circle)
}
function setProgress(percent, circle) {
const offset = circumference - percent * circumference;
circle.style.strokeDashoffset = offset;
}
}

View File

@ -4,7 +4,7 @@ from pathlib import Path
import Apikeys
import os
basefile = "/Users/normrasmussen/Downloads/mizuno-aug2024-completions.csv"
basefile = "/Users/normrasmussen/Downloads/mizuno-sept-completions.csv"
api_key = Apikeys.MIZUNO
uuid_url = "https://api.northpass.com/v2/people?filter[email][eq]="
prop_url = "https://api.northpass.com/v2/properties/people/"
@ -51,7 +51,7 @@ def load_file(basefile):
completions = completions[completions["userid"] != "0"]
# completions = completions.iloc[:, 0:]
completions.to_csv(
"/Users/normrasmussen/Downloads/Mizuno-August2024-with-PGAID.csv",
"/Users/normrasmussen/Downloads/Mizuno-Sept2024-with-PGAID.csv",
index=False,
)

View File

@ -13,7 +13,7 @@ HEADERS = {
"X-Api-Key": APIKEY,
}
BASEURL = "https://api.northpass.com/v2/"
IMPORTFILE = "/Users/normrasmussen/Downloads/cisa-092624.csv"
IMPORTFILE = "/Users/normrasmussen/Downloads/cisa-100124.csv"
def bulk_invite_and_group():
@ -33,6 +33,7 @@ def bulk_invite_and_group():
print(groups)
for group in groups:
payload = ""
print(group)
tmp_group = data[data.Group == group]
people = list(tmp_group["Email"])
group = str(tmp_group["Group"].unique())[2:-2]