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

OSOE-920: Create a reusable widget for the carousel in Lombiq.UIKit #69

Merged
merged 35 commits into from
Jan 18, 2025

Conversation

milosh-96
Copy link
Member

@milosh-96 milosh-96 commented Dec 20, 2024

OSOE-920
Fixes #67

…pdating the part settings edit template and adding hints and default values for each option.
…ault value for CarouselWidgetPartSettings Options.
… widget; Updating UI Kit widgets tests so they work with the example page.
public static class ContentTypes
{
public const string SlidePart = nameof(SlidePart);
public const string Slide = "Slide";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use nameof here and below.

@@ -6,5 +6,5 @@ namespace Lombiq.UIKit.Widgets.Handlers;
public class SlidePartHandler : ContentPartHandler<SlidePart>
{
public override Task UpdatedAsync(UpdateContentContext context, SlidePart part) =>
Task.Run(() => context.ContentItem.DisplayText = part.Title.Text);
Task.Run(() => context.ContentItem.DisplayText = part.ContentItem.Content.TitlePart.Text);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not necessary. The TitlePart's functionality already do this.


public static class ContentTypes
{
public const string SlidePart = nameof(SlidePart);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Part names are not content types. You can keep reference them as nameof(PartName) so you don't need consts for these.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SlidePart is still here.

@@ -22,14 +22,12 @@
var bagItems = ((ContentItem)Model.ContentItem).As<BagPart>().ContentItems.Select(contentItem => contentItem.As<SlidePart>());
var items = new List<IShape>();

bagItems.ForEach(async (slide) => items.Add(await New.Slide(Title: slide.Title.Text, Image: slide.Image.Paths[0])));
bagItems.ForEach(async (slide) => items.Add(await New.Slide(Title: slide.ContentItem.Content.TitlePart.Text, Image: slide.Image.Paths[0])));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can rely on the slide.ContentItem.DisplayText.

Copy link
Member

@barthamark barthamark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure the carousel is usable if you do this:

  1. Setup the website using the SaaS recipe.
  2. Run the Sample Carousel recipe.

Check if the page is imported, features are enabled, images are displayed, etc.


public static class ContentTypes
{
public const string SlidePart = nameof(SlidePart);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SlidePart is still here.

Version = "0.0.1",
Description = "Module for reusable widgets based on Lombiq UI Kit.",
Website = "https://github.com/Lombiq/Orchard-UIKit"
)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the following dependencies: Lombiq.UIKit (use an appropriate const from the module), OrchardCore.ContentFields, OrchardCore.Media.

Version = "0.0.1",
Description = "Module for reusable widgets based on Lombiq UI Kit.",
Website = "https://github.com/Lombiq/Orchard-UIKit"
)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add an appropriate category.

],
"tags": [
"developer",
"training",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can leave out the training.

"SlidePart": {
"Image": {
"Paths": [
"about-bg.jpg"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These images won't be loaded because these are not part of the recipe so won't be imported. Add a media step where you also upload these images and make them part of the repo as well.

{
"name": "feature",
"enable": [
"Lombiq.UIKit.Widgets"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also enable the Helpful Content Types feature because the Page content type won't be loaded otherwise.

…de and information and dependencies for the project.
@barthamark barthamark merged commit dc54346 into dev Jan 18, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a reusable widget for the carousel (OSOE-920)
2 participants