Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VACMS-15641: Adds 'add to National Outreach Calendar' checkbox #1752

Merged
merged 4 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/site/stages/build/drupal/graphql/nodeEvent.graphql.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,32 @@ const nodeEventWithoutBreadcrumbs = `
}
}
}
fieldAdditionalListings {
entity {
entityBundle
entityId
entityType
... on NodeEventListing {
fieldDescription
fieldIntroText
fieldOffice {
entity {
entityType
entityBundle
entityId
... on NodeOffice {
fieldBody {
value
format
processed
}
fieldDescription
}
}
}
}
}
}
fieldLocationHumanreadable
fieldLocationType
fieldMedia {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ const nodeEventListing = `
... nodeEventWithoutBreadcrumbs
}
}
reverseFieldAdditionalListingsNode(limit: 5000, filter: { conditions: [{ field: "status", value: "1", operator: EQUAL, enabled: $onlyPublishedContent }, { field: "moderation_state", value: "archived", operator: NOT_EQUAL }, { field: "type", value: "event" }]}, sort: {field: "changed", direction: DESC}) {
entities {
... nodeEventWithoutBreadcrumbs
}
}
fieldOffice {
entity {
...on NodeHealthCareRegionPage {
Expand Down
24 changes: 24 additions & 0 deletions src/site/stages/build/drupal/health-care-region.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,29 @@ function createPastEventListPages(page, drupalPagePath, files) {
);
}

/**
* Compiles fields for event listing pages.
*
* @param {page} page The page object.
* @return nothing
*/
function compileEventListingPage(page) {
const { cmsFeatureFlags } = global;
// Combine events from reverse entity reference queries, if additional
// listings data exists and feature flag is on.
if (
cmsFeatureFlags.FEATURE_EVENT_OUTREACH_CHECKBOX &&
page?.reverseFieldAdditionalListingsNode?.entities
) {
page.reverseFieldListingNode.entities.push(
...page.reverseFieldAdditionalListingsNode.entities,
);
}
// Compile final template variables.
page.pastEventTeasers = page.pastEvents;
page.allEventTeasers = page.reverseFieldListingNode;
}

// Creates the facility pages
function createHealthCareRegionListPages(page, drupalPagePath, files) {
const sidebar = page.facilitySidebar;
Expand Down Expand Up @@ -283,4 +306,5 @@ module.exports = {
createPastEventListPages,
addGetUpdatesFields,
addPager,
compileEventListingPage,
};
4 changes: 2 additions & 2 deletions src/site/stages/build/drupal/metalsmith-drupal.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const {
createPastEventListPages,
addGetUpdatesFields,
addPager,
compileEventListingPage,
} = require('./health-care-region');
const createReactPages = require('../plugins/create-react-pages');

Expand Down Expand Up @@ -83,8 +84,7 @@ function pipeDrupalPagesIntoMetalsmith(contentData, files) {
addGetUpdatesFields(pageCompiled, pages);
break;
case 'event_listing':
pageCompiled.pastEventTeasers = pageCompiled.pastEvents;
pageCompiled.allEventTeasers = pageCompiled.reverseFieldListingNode;
compileEventListingPage(pageCompiled);
addPager(
pageCompiled,
files,
Expand Down
Loading