/** * Gainsight Knowledge Article Last Edited Date Inserter * * This script finds the last edited date from a Gainsight Knowledge article * and inserts it into the front-end display. */ (function() { // Configuration const config = { // Selector for where to find the last edited date in the article metadata dateSourceSelector: '.topic__header .tooltip__content--publish-date', // Selector for where to insert the last edited date in the front-end targetSelector: '.topic__header', // Format for the displayed date dateFormat: { year: 'numeric', month: 'long', day: 'numeric' }, // Text to display before the date labelText: 'Last Updated: ' }; /** * Format a date string according to the configured format * @param {string} dateStr - The date string to format * @returns {string} - The formatted date string */ function formatDate(dateStr) { try { const date = new Date(dateStr); // Check if date is valid if (isNaN(date.getTime())) { console.error('Invalid date format:', dateStr); return dateStr; } return date.toLocaleDateString(undefined, config.dateFormat); } catch (err) { console.error('Error formatting date:', err); return dateStr; } } /** * Create the last edited element to be inserted into the page * @param {string} dateStr - The formatted date string * @returns {HTMLElement} - The element to insert */ function createLastEditedElement(dateStr) { const container = document.createElement('div'); container.className = 'last-edited-container'; container.style.fontSize = '0.9em'; container.style.color = '#666'; container.style.marginTop = '0.5em'; const label = document.createElement('span'); label.className = 'last-edited-label'; label.textContent = config.labelText; const date = document.createElement('span'); date.className = 'last-edited-date'; date.textContent = dateStr; container.appendChild(label); container.appendChild(date); return container; } /** * Main function to insert the last edited date into the article */ function insertLastEditedDate() { try { // Find the source element that contains the last edited date const dateSourceEl = document.querySelector(config.dateSourceSelector); // If the date source element doesn't exist, log an error and exit if (!dateSourceEl) { console.error('Date source element not found:', config.dateSourceSelector); return; } // Get the date string from the source element const rawDateStr = dateSourceEl.textContent.trim(); // Format the date according to the configured format const formattedDate = formatDate(rawDateStr); // Create the last edited element const lastEditedEl = createLastEditedElement(formattedDate); // Find the target element where we'll insert the last edited date const targetEl = document.querySelector(config.targetSelector); // If the target element doesn't exist, log an error and exit if (!targetEl) { console.error('Target element not found:', config.targetSelector); return; } // Check if the last edited date is already inserted if (targetEl.querySelector('.last-edited-container')) { console.log('Last edited date already exists, not inserting again'); return; } // Insert the last edited element at the end of the target element targetEl.appendChild(lastEditedEl); console.log('Successfully inserted last edited date:', formattedDate); } catch (err) { console.error('Error inserting last edited date:', err); } } /** * Initialize the script */ function init() { // If the document is already loaded, insert the last edited date if (document.readyState === 'complete' || document.readyState === 'interactive') { insertLastEditedDate(); } else { // Otherwise, wait for the document to load document.addEventListener('DOMContentLoaded', insertLastEditedDate); } // For single-page applications, we might need to listen for route changes // This is a simplified approach that might need adjusting based on Gainsight's implementation document.addEventListener('gainsight:article-loaded', insertLastEditedDate); // Fallback method: check periodically if the article has changed let lastCheckedUrl = window.location.href; setInterval(() => { if (window.location.href !== lastCheckedUrl) { lastCheckedUrl = window.location.href; setTimeout(insertLastEditedDate, 500); // Small delay to ensure DOM is updated } }, 1000); } // Start the script init(); })(); Updating Calendar View with New Project Events in Bid Center | Community
Skip to main content

To update your filters and add new project events to your calendar, click on the Filters button (next to the Calendar View in the top menu tabs). The Filter menu will appear (as below). You can then select a new set of events.


 


update filters

Once finished, click on the Sync Settings button at the right, and then click on the Update button.


A message will appear (as above), confirming that you wish to replace your existing filters with the new ones you just selected. After you click Update, the current synced filters will be replaced by the newly applied filters and new events matching those criteria will be automatically added to your calendar during the next sync.

Related Articles

Be the first to reply!

Reply