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-897: Update Menu Widget display name, description and readme #182

Merged
merged 5 commits into from
Oct 1, 2024
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
2 changes: 1 addition & 1 deletion Lombiq.HelpfulExtensions.Tests.UI/Constants/WidgetTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ public static class WidgetTypes
public const string Container = nameof(Container);
public const string Html = nameof(Html);
public const string Liquid = nameof(Liquid);
public const string Menu = nameof(Menu);
public const string Menu = "Menu Navigation Provider";
Piedone marked this conversation as resolved.
Show resolved Hide resolved
public const string Markdown = nameof(Markdown);
}
21 changes: 20 additions & 1 deletion Lombiq.HelpfulExtensions/Extensions/Widgets/Migrations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using OrchardCore.ContentManagement.Metadata;
using OrchardCore.ContentManagement.Metadata.Settings;
using OrchardCore.Data.Migration;
using OrchardCore.Navigation;
using System.Threading.Tasks;
using static Lombiq.HelpfulExtensions.Extensions.Widgets.WidgetTypes;

Expand Down Expand Up @@ -48,6 +49,11 @@ await _contentDefinitionManager.AlterTypeDefinitionAsync(LiquidWidget, builder =
await _contentDefinitionManager.AlterTypeDefinitionAsync(MenuWidget, builder => builder
.Securable()
.Stereotype(CommonStereotypes.Widget)
.DisplayedAs("Menu Navigation Provider Widget")
.WithDescription(
$"Renders a menu whose contents are populated from {nameof(INavigationProvider)} implementations " +
$"that look for the \"menu\" name (as opposed to admin menu navigation providers that use the " +
$"\"admin\" name).")
);

await _contentDefinitionManager.AlterTypeDefinitionAsync(MarkdownWidget, builder => builder
Expand Down Expand Up @@ -76,7 +82,7 @@ await _contentDefinitionManager.AlterTypeDefinitionAsync(WidgetTypes.ContentItem
.WithPart(contentItemWidgetPartName)
);

return 5;
return 6;
}

public async Task<int> UpdateFrom1Async()
Expand Down Expand Up @@ -128,4 +134,17 @@ await _contentDefinitionManager.AlterTypeDefinitionAsync(WidgetTypes.ContentItem

return 5;
}

public async Task<int> UpdateFrom5Async()
{
await _contentDefinitionManager.AlterTypeDefinitionAsync(MenuWidget, builder => builder
.DisplayedAs("Menu Navigation Provider Widget")
.WithDescription(
$"Renders a menu whose contents are populated from {nameof(INavigationProvider)} implementations " +
$"that look for the \"menu\" name (as opposed to admin menu navigation providers that use the " +
$"\"admin\" name).")
);

return 6;
}
}
21 changes: 16 additions & 5 deletions Lombiq.HelpfulExtensions/Extensions/Widgets/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,20 @@

Adds multiple helpful widget content types. These are basic widgets that are added by built-in Orchard Core recipes though in case of using a custom setup recipe these can be added by this feature too.

Includes:
## ContainerWidget

- ContainerWidget: Works as a container for further widgets. It has a FlowPart attached to it so it can contain additional widgets as well.
- HtmlWidget: Adds HTML editing and displaying capabilities using a WYSIWYG editor.
- LiquidWidget: Adds Liquid code editing and rendering capabilities.
- MenuWidget: Renders a Bootstrap navigation menu as a widget using the provided `MenuItem`s.
Works as a container for further widgets. It has a FlowPart attached to it so it can contain additional widgets as well.

## HtmlWidget

Adds HTML editing and displaying capabilities using a WYSIWYG editor.

## LiquidWidget

Adds Liquid code editing and rendering capabilities.

## MenuWidget ("Menu Navigation Provider Widget")

Renders a Bootstrap navigation menu as a widget using the provided `MenuItem`s.

> ℹ️ The menu is populated from `INavigationProvider` implementations that create the menu items programmatically. If you use [Lombiq Base Theme for Orchard Core](https://github.com/Lombiq/Orchard-Base-Theme), it has [`MainMenuNavigationProvider`](https://github.com/Lombiq/Orchard-Base-Theme/blob/dev/Lombiq.BaseTheme/Services/MainMenuNavigationProvider.cs). This automatically translates an existing content item with a `MenuItemsListPart` and the `main-menu` alias into compatible navigation, so you can edit menu items from the content editor.