${deliverableJson.linkedFolderLink ? '
Final Asset ': "Not Available"}
@@ -591,7 +677,7 @@ function sortRows(rows) {
nodes.sort((a, b) => {
var classA = a.classList ? a.classList.contains('datarow') : false;
var classB = b.classList ? b.classList.contains('datarow') : false;
-
+
if (classA && !classB) {
return 1;
} else if (!classA && classB) {
@@ -642,4 +728,4 @@ function extractQueryVars() {
programID: 'Program ID Not Available'
}
}
-}
\ No newline at end of file
+}
diff --git a/blocks/gmo-program-header/gmo-program-header.js b/blocks/gmo-program-header/gmo-program-header.js
index ab99e4f3..00f8cc61 100644
--- a/blocks/gmo-program-header/gmo-program-header.js
+++ b/blocks/gmo-program-header/gmo-program-header.js
@@ -126,6 +126,8 @@ export default async function decorate(block) {
});
initializeDropdowns();
+ // Attach event listeners for the dropdowns and reset filters
+ attachEventListeners();
decorateIcons(block);
document.addEventListener('click', handleClickOutside);
}
@@ -171,6 +173,17 @@ function attachEventListeners() {
function populateDropdown(response, dropdownId, type) {
const options = response.data?.jsonByPath ? response.data.jsonByPath.item.json.options : response;
+ //Sort the options alphabetically
+ options.sort((a, b) => {
+ if (a.text < b.text) {
+ return -1;
+ }
+ if (a.text > b.text) {
+ return 1;
+ }
+ return 0;
+ });
+
let dropdownContent = document.getElementById(dropdownId);
dropdownContent.innerHTML = '';
options.forEach((option, index) => {
diff --git a/blocks/gmo-program-list/gmo-program-list.css b/blocks/gmo-program-list/gmo-program-list.css
index a417c0c9..5e71b736 100644
--- a/blocks/gmo-program-list/gmo-program-list.css
+++ b/blocks/gmo-program-list/gmo-program-list.css
@@ -204,28 +204,33 @@ select {
border-radius: 4px;
}
.column-1 {
- width: 28%;
+ width: 18%;
margin-right: 1%;
}
.column-2 {
- width: 40%;
+ width: 25%;
margin-right: 1%;
}
.column-3 {
- width: 12%;
+ width: 15%;
margin-right: 1%;
}
.column-4 {
- width: 16%;
+ width: 14%;
margin-right: 1%;
}
.column-5 {
- width: 13%;
+ width: 10%;
margin-right: 1%;
}
.column-6 {
- width: 14%;
+ width: 10%;
+ margin-right: 1%;
}
+.column-7 {
+ width: 5%;
+}
+
.status {
width: 80px;
text-align: center;
@@ -257,6 +262,7 @@ select {
.campaign-name-label, .campaign-name {
position: relative;
display: inline-block;
+ cursor: pointer;
}
.campaign-name-label:hover .tooltip {
diff --git a/blocks/gmo-program-list/gmo-program-list.js b/blocks/gmo-program-list/gmo-program-list.js
index 04a15a3a..9b331872 100644
--- a/blocks/gmo-program-list/gmo-program-list.js
+++ b/blocks/gmo-program-list/gmo-program-list.js
@@ -30,6 +30,11 @@ const headerConfig = [
'name': 'Status',
'attribute': 'status',
'sortable': false
+ },
+ {
+ 'name': 'Geo',
+ 'attribute': 'geo',
+ 'sortable': false
}
]
@@ -45,7 +50,6 @@ let totalPages = 0;
let campaignCount = await graphqlCampaignCount();
let blockConfig;
-//Custom event gmoCampaignListBlock to allow the gmo-campaign-header to trigger the gmo-program-list to update
document.addEventListener('gmoCampaignListBlock', async function() {
//Build graphq filter that is passed to the graphql persisted queries
const graphQLFilterArray = getFilterValues();
@@ -59,18 +63,16 @@ document.addEventListener('gmoCampaignListBlock', async function() {
const block = document.querySelector('.gmo-program-list.block');
//Get Campaign Count for pagination
campaignCount = await graphqlCampaignCount(currentGraphqlFilter);
- //Trigger loading the gmo-campaign-block
+
//Reset page variables
currentPageInfo = {};
cursorArray = [];
currentPage = 1;
currentNumberPerPage = DEFAULT_ITEMS_PER_PAGE;
-
+ //Trigger loading the gmo-campaign-block
decorate( block, currentNumberPerPage, '', false, false, currentGraphqlFilter);
-
});
-
export default async function decorate(block, numPerPage = currentNumberPerPage, cursor = '', previousPage = false, nextPage = false, graphQLFilter = {}) {
if (blockConfig == undefined) blockConfig = readBlockConfig(block);
const campaignPaginatedResponse = await graphqlAllCampaignsFilter(numPerPage, cursor,graphQLFilter);
@@ -112,8 +114,32 @@ export default async function decorate(block, numPerPage = currentNumberPerPage,
listContainer.appendChild(listItems);
listContainer.appendChild(listFooter);
// Show Hide Previous and Next Page buttons
- const footerNext = document.querySelector('.footer-pagination-button.next');
+ togglePaginationButtons();
+
+ decorateIcons(block);
+
+ // Lazy loading for images
+ document.addEventListener('DOMContentLoaded', function() {
+ if ('IntersectionObserver' in window) {
+ const lazyImages = document.querySelectorAll('.lazy');
+ const observer = new IntersectionObserver((entries, observer) => {
+ entries.forEach(entry => {
+ if (entry.isIntersecting) {
+ const img = entry.target;
+ img.src = img.dataset.src;
+ img.classList.remove('lazy');
+ observer.unobserve(img);
+ }
+ });
+ });
+ lazyImages.forEach(img => observer.observe(img));
+ }
+ });
+}
+
+function togglePaginationButtons() {
const footerPrev = document.querySelector('.footer-pagination-button.prev');
+ const footerNext = document.querySelector('.footer-pagination-button.next');
if (currentPage > 1) {
footerPrev.classList.add('active');
} else {
@@ -125,9 +151,6 @@ export default async function decorate(block, numPerPage = currentNumberPerPage,
} else {
footerNext.classList.remove('active');
}
-
- decorateIcons(block);
-
}
function getFilterValues(){
@@ -180,6 +203,7 @@ async function buildCampaignList(campaigns, numPerPage) {
const campaignNameWrapper = document.createElement('div');
campaignNameWrapper.classList.add('campaign-name-wrapper', 'vertical-center');
+
campaignNameWrapper.innerHTML = `
${checkBlankString(programName)}
@@ -190,7 +214,17 @@ async function buildCampaignList(campaigns, numPerPage) {
Marketing Moment
`;
-
+
+ // Add click event to the campaign name label and text
+ const campaignNameLabel = campaignNameWrapper.querySelector('.campaign-name-label');
+ const campaignNameText = campaignNameWrapper.querySelector('.campaign-name');
+ campaignNameLabel.addEventListener('click', () => {
+ window.location.href = campaignDetailsLink;
+ });
+ campaignNameText.addEventListener('click', () => {
+ window.location.href = campaignDetailsLink;
+ });
+
campaignInfoWrapper.appendChild(campaignIconLink);
campaignInfoWrapper.appendChild(campaignNameWrapper);
@@ -214,17 +248,28 @@ async function buildCampaignList(campaigns, numPerPage) {
var campaignStatusWrapper = document.createElement('div');
campaignStatusWrapper.classList.add('status-wrapper', 'column-6', 'vertical-center');
campaignStatusWrapper = buildStatus(campaignStatusWrapper, campaign);
+
+ const campaignGeo = document.createElement('div');
+ campaignGeo.textContent = formatGeos(campaign.node.p0TargetGeo);
+ campaignGeo.classList.add('column-7', 'vertical-center');
+ campaignGeo.dataset.property = 'geo';
+
campaignRow.appendChild(campaignInfoWrapper);
campaignRow.appendChild(campaignOverviewWrapper);
campaignRow.appendChild(campaignLaunch);
campaignRow.appendChild(campaignProducts);
campaignRow.appendChild(campaignStatusWrapper);
+ campaignRow.appendChild(campaignGeo);
listWrapper.appendChild(campaignRow);
}
return listWrapper;
}
+function formatGeos(geoArray) {
+ return geoArray.map(geo => geo.toUpperCase()).join(', ');
+}
+
function buildStatus(statusWrapper, campaign) {
const campaignStatus = document.createElement('div');
const statusStr = checkBlankString(campaign.node.status);
@@ -248,14 +293,13 @@ function buildStatus(statusWrapper, campaign) {
}
async function addThumbnail(parentElement, programName, campaignName) {
- searchAsset(programName, campaignName).then((response) => {
- if (response && (Object.hasOwn(response, 'imageUrl') && Object.hasOwn(response, 'imageAltText'))) {
- const iconImage = document.createElement('img');
- iconImage.src = response?.imageUrl;
- iconImage.alt = response?.imageAltText;
- parentElement.appendChild(iconImage);
- }
- })
+ const response = await searchAsset(programName, campaignName);
+ if (response?.imageUrl && response?.imageAltText) {
+ const iconImage = document.createElement('img');
+ iconImage.src = response.imageUrl;
+ iconImage.alt = response.imageAltText;
+ parentElement.appendChild(iconImage);
+ }
}
async function buildProduct(product) {
@@ -502,4 +546,3 @@ function sortColumn(dir, property) {
container.appendChild(row);
});
}
-
diff --git a/icons/folderOpenOutline.svg b/icons/folderOpenOutline.svg
new file mode 100644
index 00000000..ff67e983
--- /dev/null
+++ b/icons/folderOpenOutline.svg
@@ -0,0 +1,11 @@
+
\ No newline at end of file
diff --git a/icons/launch.svg b/icons/launch.svg
new file mode 100644
index 00000000..e6209ba5
--- /dev/null
+++ b/icons/launch.svg
@@ -0,0 +1,13 @@
+
\ No newline at end of file
diff --git a/scripts/assets.js b/scripts/assets.js
index 37ec6233..189af6a4 100644
--- a/scripts/assets.js
+++ b/scripts/assets.js
@@ -9,7 +9,7 @@ import {
getOptimizedDeliveryUrl
} from './polaris.js';
-import { getAdminConfig } from './site-config.js';
+import { getAdminConfig, getBaseConfigPath, getBrandingConfig } from './site-config.js';
import { createSearchEndpoint, logError } from './scripts.js';
@@ -33,22 +33,36 @@ const getFilters = () => {
return `is_pur-expirationDate = 0 OR pur-expirationDate > ${currentEpoch}`;
};
+async function getUnderdevelopmentIcon() {
+ const configPath = getBaseConfigPath();
+ const brandingConfig = await getBrandingConfig();
+ const underdevelopmentIconPath = `${configPath}/${brandingConfig.underdevelopmentIcon}`.replace(/\/\//g, '/');
+ return { imageUrl: underdevelopmentIconPath, imageAltText: 'Under Development', assetCount: 0 };
+}
/**
- * Search Asset for programName and campaignName parameters.
+ * Search Asset for programName, campaignName, deliverableType parameters.
*
* @param {string} - Program Name.
* @param {string} - Campaign Name.
+ * @param {string} - Deliverable Type
+ * @param {integer} - Image Width
* @returns {Image