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

Update Promo blocks #260

Merged
merged 3 commits into from
Sep 18, 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
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
"type" : "string",
"required": true
}
},
"<site-promo-card-rotation-block>": {
"template": "./promo-card-rotation.marko"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { defaultValue } from "@parameter1/base-cms-marko-web/utils";
import convertAdToNode from "@parameter1/base-cms-marko-web-native-x/utils/convert-ad-to-node";
import shuffle from "@cox-matthews-associates/package-global/utils/shuffle-array";

$ const { nativeX: nxConfig } = out.global;
$ const placementName = "promotion";
$ const aliases = defaultValue(input.aliases, []);
$ const blockName = "callout-cards";
$ const uri = nxConfig.getUri();
$ const placement = nxConfig.getPlacement({ name: placementName, aliases });

<marko-web-block name=blockName>
<marko-web-element block-name=blockName name="row">
<marko-web-element block-name=blockName name="col">
<theme-latest-podcast-block alias="podcasts" />
</marko-web-element>
<marko-web-native-x-fetch-elements|{ ads }| uri=uri id=placement.id>
$ const hasAd = ads && ads.length && ads[0] && ads[0].hasCampaign;
<if(hasAd)>
<marko-web-element block-name=blockName name="col" modifiers=["last"]>
<if(ads[0] && ads[0].hasCampaign)>
<theme-standard-promo-node ...convertAdToNode(ads[0]) />
</if>
</marko-web-element>
</if>
</marko-web-native-x-fetch-elements>
</marko-web-element>
</marko-web-block>
2 changes: 1 addition & 1 deletion sites/diverseeducation.com/server/templates/index.marko
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ $ const { id, alias, name, pageNode } = input;
</if>

<@section>
<theme-native-x-promo-card-block placement-name="promotion" />
<site-promo-card-rotation-block />
</@section>

<@section>
Expand Down