Giter VIP home page Giter VIP logo

helpful-extensions's Introduction

Lombiq Helpful Extensions for Orchard Core

Lombiq.HelpfulExtensions NuGet Lombiq.HelpfulExtensions UI Test Extensions NuGet

About

Orchard Core module containing some handy extensions (e.g. useful content types and widgets).

We at Lombiq also used this module for the following projects:

This module is also available on all sites of DotNest, the Orchard Core SaaS.

Do you want to quickly try out this project and see it in action? Check it out in our Open-Source Orchard Core Extensions full Orchard Core solution and also see our other useful Orchard Core-related open-source projects!

Note that this module has an Orchard 1 version in the dev-orchard-1 branch.

Extensions

The module consists of the following independent extensions (all in their own features):

Code Generation Helpful Extensions

Content definition code generation

Generates migration code from content definitions. You can use this to create (or edit) a content type on the admin and then move its creation to a migration class. Generated migration code is displayed under the content types' editors, just enable the feature. Check out this demo video to see this in action.

Content definition code generation textbox on the admin, showing generated migration code for the Page content type.

Orchard 1 Recipe Migration

Contains extendable services which convert an export.xml file from Orchard 1 into an Orchard Core recipe JSON file with a content step. Content Type exports are not supported, because the service relies on the existence of the target content types to initialize the content items that go into the recipe.

The converter can be accessed from the Admin dashboard in the Configuration > Import/Export > Orchard 1 Recipe Migration menu item.

To extend the built-in functionality implement these services:

  • IOrchardContentConverter: Used to set up a single new ContentItem using the data in the matching <Content> entry.
  • IOrchardExportConverter: Used to update or filter the final list of content items. It has access to the entire export XML file.
  • IOrchardUserConverter: Used to create a new User using the data in the matching <Content> entry.

The built-in converters handle the following O1 content parts:

Additionally, if a custom converter fills in the OrchardIds content part's Parent property on the generated content item, then it also adds it to the parent content item's ListPart.

User Migration

Migrating users from Orchard 1 is also possible with this feature: Import the same way as other Orchard 1 contents, and users will be generated automatically, meaning you don't have to do anything else.

Each generated user will have the corresponding email, user-name, roles, and a new random password. Keep in mind that in Orchard 1, user-names could contain any characters, but in Orchard Core, it is limited by default. Check out the default configuration and adjust it in your application if needed.

If your use-case would be different than what's done in the default user converter, implement the IOrchardUserConverter service, and the default one won't be executed.

Content Sets

Adds an attachable (named) content part that ties together a content item and a set of variants for it. This is similar to Content Localization part, but generic and not tied to the culture options. The IContentSetEventHandler.GetSupportedOptionsAsync() extension point is used to generate the valid options for a content item with an attached ContentSetPart.

The content items are indexed into the ContentSetIndex. The IContentSetManager has methods to retrieve the existing content items (or just the index rows) for a specific content set.

When the content part is attached, a new dropdown is added to the content item in the admin dashboard's content items list. This is similar in design to the dropdown added by the Content Localization part. The label is the named part's display text and you can use the dropdown (or the listing in the editor view) to select an option. When an option is selected the content item is cloned and that option's key assigned to it.

Generating content set options

You can generate your custom content set options two ways:

  • Create a service which implements the IContentSetEventHandler interface.
  • Create a workflow with the Creating Content Set startup event. The workflow should return an output MemberLinks which should contain an array of { "Key": string, "DisplayText": string } objects. Further details can be seen on the event's editor screen.

The latter can be used even if you don't have access to the code, e.g. on DotNest. With either approach you only have to provide the Key and DisplayText properties, anything else is automatically filled in by the module. In both cases you have access to the context such as the current content item's key, the related part's part definition, etc. You can use this information to only create options selectively.

Content Set Content Picker Field

You can add this content field to any content item that also has a Content Set part. The field's technical name should be the same as the attached part's technical name. Besides that, no further configuration is needed. If there are available variants for a content item with this field, it will display a comma separated list of links where the option names are the link text.

Flows Helpful Extensions

Adds additional styling capabilities to the OrchardCore.Flows feature by making it possible to add classes to widgets in the Flow Part editor. Just add AdditionalStylingPart to the content type using FlowPart.

Custom classes editor on a widget contained in Flow Part.

Helpful Widgets

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: 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 MenuItems.

Helpful Content Types

Includes basic content types 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:

  • Page: Highly customizable page content type with FlowPart and AutoroutePart.

Shape Tracing Helpful Extensions

Adds a dump of metadata to the output about every shape. This will help you understand how a shape is displayed and how you can override it. Just check out the HTML output. You can see a video demo of this feature in action on YouTube.

Security Extensions

Strict Security

When applied to a content type definition, StrictSecuritySetting requires the user to have the exact Securable permission for that content type. For example if you apply it to Page, then just having the common ViewContent permission won't be enough and you must explicitly have the View_Page permission too. Don't worry, the normal implications such as ViewOwn being fulfilled by View still apply within the content type, they just no longer imply their common counterparts.

Make content type use strict security in migration:

_contentDefinitionManager.AlterTypeDefinition("Page", type => type
    .Securable()
    .WithSettings(new StrictSecuritySettings { Enabled = true }));

You can also enable it by going to the content type editor on the admin side and checking the Strict Securable checkbox.

Emails and Email Templates

Email Templates

Provides a shape-based email template rendering service. The email templates are represented by email template IDs that are also used to identify the corresponding shape using the following pattern: EmailTemplate__{EmailTemplateID}. E.g., for the ContactUs email template you need to create a shape with the EmailTemplate__ContactUs shape type.

In the email template shapes use the Layout__EmailTemplate as the ViewLayout to wrap it with a simple HTML layout.

To extend the layout you can override the EmailTemplate_LayoutInjections shape and inject content to the specific zones provided by the layout to activate it in every email template. E.g.,

<zone name="Footer">
    Best,<br>
    My Awesome Team
</zone>

To add inline styles include:

<zone name="Head">
    <style>
        /* CSS code... */
    </style>
</zone>

Deferred email sending

Use the ShellScope.Current.SendEmailDeferred() for sending emails. It'll send emails after the shell scope has ended without blocking the request.

Target blank

Gives all external links the target="_blank" attribute.

Reset Password activity

Adds a workflow activity that generates a reset password token for the specified user. You can define the source of the User object using a JavaScript expression. It will set the token and the URL to the workflow LastResult property and optionally it can set them to the Properties dictionary to a key that you define as an activity parameter.

Trumbowyg code-snippet

Adds prettified code-snippet inserting functionality to Trumbowyg editor by using a slightly modified version of Trumbowyg highlight plugin. You need to add the highlight button to your Trumbowyg editor options to enable it.

{
    btns: [
        ['highlight']
    ],
}

Prism is used to prettify the code. Currently the following formats are supported:

  • clike
  • cpp
  • cs
  • csharp
  • css
  • dotnet
  • graphql
  • html
  • js
  • json
  • markup-templating
  • mathml
  • md
  • plsql
  • powershell
  • scss
  • sql
  • ssml
  • svg
  • ts
  • xml
  • yaml
  • yml

Then you need to link the Trumbowyg and Prism styles and scripts where you want it to be used. E.g. if you want to add it to BlogPost content type you can do it with the help of Lombiq.HelpfulLibraries.OrchardCore in a IResourceFilterProvider:

builder.WhenContentType("BlogPost").RegisterStylesheet(Lombiq.HelpfulExtensions.Constants.ResourceNames.Prism);
builder.WhenContentType("BlogPost").RegisterFootScript(Lombiq.HelpfulExtensions.Constants.ResourceNames.Prism);

builder.WhenContentTypeEditor("BlogPost").RegisterFootScript(Lombiq.HelpfulExtensions.Constants.ResourceNames.TrumbowygHighlight);
builder.WhenContentTypeEditor("BlogPost").RegisterStylesheet(Lombiq.HelpfulExtensions.Constants.ResourceNames.TrumbowygHighlight);

Contributing and support

Bug reports, feature requests, comments, questions, code contributions and love letters are warmly welcome. You can send them to us via GitHub issues and pull requests. Please adhere to our open-source guidelines while doing so.

This project is developed by Lombiq Technologies. Commercial-grade support is available through Lombiq.

helpful-extensions's People

Contributors

0liver avatar aydine avatar barthamark avatar benedekfarkas avatar deanmarcussen avatar demeszabolcs avatar devlife avatar dministro avatar domonkosgabor avatar i3undy avatar luko6 avatar mzole avatar piedone avatar porgabi avatar psichorex avatar sarahelsaig avatar thehydes avatar vtamas1 avatar wasnk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

helpful-extensions's Issues

Flows Helpful Extensions - AdditionalStylingPart does not add the widget classes

Hello Lombiq team,

I am using the Flows Helpful Extensions feature, and I realized when this feature is enabled and there were content items with widgets already created, thus these content items do not have the AdditionalStylingPart yet, so the classes widget and widget-{ContentType} are not added, and the widgets are rendered incorrectly in the view without those classes.

One solution is to re-publish the content items so they become aware of the AdditionalStylingPart and render correctly, but in an existing site with many content items, this solution does not seem reasonable.

For now, I made a little change in the view Lombiq.HelpfulExtensions.Flows.FlowPart.cshtml trying to follow the original logic to solve this issue. I already tested it in the Open-Source-Orchard-Core-Extensions solution and in my own project, and it is working well. You can check it out here in this fork repo and please let me know if you have any comment or suggestion on it, or if there is another better solution to go for. I would be glad to contribute to the solution and create a pull request if it suits you well and you consider it that way.

Code Generation Helpful Extensions Error

Hi , Could you help me to find this problem reason?
My OC version is 1.2.0-preview-16614 ,and copied Helpful Extensions project into my solution
In my project , if enable the Code Generation Helpful Extensions feature
when I open the /Admin/ContentTypes/Edit/xxx , the page will throw an exception:

2021-12-07 18:43:58.1405|Default|00-546674ac3776d48aaa6a92c66157a443-3d74ef89fac35185-00||Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware|ERROR|An unhandled exception has occurred while executing the request. System.Exception: Shape type 'ContentTypeMigrations_Edit' not found
   at OrchardCore.DisplayManagement.Implementation.DefaultHtmlDisplay.ExecuteAsync(DisplayContext context)
   at OrchardCore.DisplayManagement.Implementation.DefaultHtmlDisplay.ExecuteAsync(DisplayContext context)
   at OrchardCore.DisplayManagement.Zones.ZoneShapes.ContentZone(IDisplayHelper DisplayAsync, Object Shape, IShapeFactory ShapeFactory)
   at OrchardCore.DisplayManagement.Implementation.DefaultHtmlDisplay.<ProcessAsync>g__Awaited|11_0(Task`1 task)
   at OrchardCore.DisplayManagement.Implementation.DefaultHtmlDisplay.ExecuteAsync(DisplayContext context)
   at OrchardCore.DisplayManagement.Implementation.DefaultHtmlDisplay.ExecuteAsync(DisplayContext context)
   at CallSite.Target(Closure , CallSite , Object )
   at AspNetCore._Areas_OrchardCore_ContentTypes_Views_ContentTypeDefinition_Edit.ExecuteAsync() in /Areas/OrchardCore.ContentTypes/Views/ContentTypeDefinition.Edit.cshtml:line 1
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper.RenderPartialCoreAsync(String partialViewName, Object model, ViewDataDictionary viewData, TextWriter writer)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper.PartialAsync(String partialViewName, Object model, ViewDataDictionary viewData)
   at OrchardCore.DisplayManagement.Implementation.DefaultHtmlDisplay.<ProcessAsync>g__Awaited|11_0(Task`1 task)
   at OrchardCore.DisplayManagement.Implementation.DefaultHtmlDisplay.ExecuteAsync(DisplayContext context)
   at OrchardCore.DisplayManagement.Implementation.DefaultHtmlDisplay.ExecuteAsync(DisplayContext context)
   at CallSite.Target(Closure , CallSite , Object )
   at AspNetCore._Areas_OrchardCore_ContentTypes_Views_Admin_Edit.<>c__DisplayClass27_0.<<ExecuteAsync>b__8>d.MoveNext() in /Areas/OrchardCore.ContentTypes/Views/Admin/Edit.cshtml:line 39
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.GetChildContentAsync(Boolean useCachedResult, HtmlEncoder encoder)
   at Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper.ProcessAsync(TagHelperContext context, TagHelperOutput output)
   at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner.<RunAsync>g__Awaited|0_0(Task task, TagHelperExecutionContext executionContext, Int32 i, Int32 count)
   at AspNetCore._Areas_OrchardCore_ContentTypes_Views_Admin_Edit.ExecuteAsync() in /Areas/OrchardCore.ContentTypes/Views/Admin/Edit.cshtml:line 19
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ActionContext actionContext, IView view, ViewDataDictionary viewData, ITempDataDictionary tempData, String contentType, Nullable`1 statusCode)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.ExecuteAsync(ActionContext context, ViewResult result)
   at Microsoft.AspNetCore.Mvc.ViewResult.ExecuteResultAsync(ActionContext context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeResultAsync>g__Logged|21_0(ResourceInvoker invoker, IActionResult result)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|29_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at OrchardCore.Apis.GraphQL.GraphQLMiddleware.Invoke(HttpContext context, IAuthorizationService authorizationService, IAuthenticationService authenticationService, ISchemaFactory schemaService)
   at OrchardCore.Liquid.ScriptsMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
   at OrchardCore.Diagnostics.DiagnosticsStartupFilter.<>c__DisplayClass3_0.<<Configure>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at OrchardCore.ContentPreview.PreviewStartupFilter.<>c.<<Configure>b__1_1>d.MoveNext()
--- End of stack trace from previous location ---
   at OrchardCore.Modules.ModularTenantRouterMiddleware.Invoke(HttpContext httpContext)
   at OrchardCore.Modules.ModularTenantContainerMiddleware.<>c__DisplayClass4_0.<<Invoke>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute, Boolean activateShell)
   at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute, Boolean activateShell)
   at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute, Boolean activateShell)
   at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute, Boolean activateShell)
   at OrchardCore.Modules.ModularTenantContainerMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)    at OrchardCore.DisplayManagement.Implementation.DefaultHtmlDisplay.ExecuteAsync(DisplayContext context)
   at OrchardCore.DisplayManagement.Implementation.DefaultHtmlDisplay.ExecuteAsync(DisplayContext context)
   at OrchardCore.DisplayManagement.Zones.ZoneShapes.ContentZone(IDisplayHelper DisplayAsync, Object Shape, IShapeFactory ShapeFactory)
   at OrchardCore.DisplayManagement.Implementation.DefaultHtmlDisplay.<ProcessAsync>g__Awaited|11_0(Task`1 task)
   at OrchardCore.DisplayManagement.Implementation.DefaultHtmlDisplay.ExecuteAsync(DisplayContext context)
   at OrchardCore.DisplayManagement.Implementation.DefaultHtmlDisplay.ExecuteAsync(DisplayContext context)
   at CallSite.Target(Closure , CallSite , Object )
   at AspNetCore._Areas_OrchardCore_ContentTypes_Views_ContentTypeDefinition_Edit.ExecuteAsync() in /Areas/OrchardCore.ContentTypes/Views/ContentTypeDefinition.Edit.cshtml:line 1
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper.RenderPartialCoreAsync(String partialViewName, Object model, ViewDataDictionary viewData, TextWriter writer)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper.PartialAsync(String partialViewName, Object model, ViewDataDictionary viewData)
   at OrchardCore.DisplayManagement.Implementation.DefaultHtmlDisplay.<ProcessAsync>g__Awaited|11_0(Task`1 task)
   at OrchardCore.DisplayManagement.Implementation.DefaultHtmlDisplay.ExecuteAsync(DisplayContext context)
   at OrchardCore.DisplayManagement.Implementation.DefaultHtmlDisplay.ExecuteAsync(DisplayContext context)
   at CallSite.Target(Closure , CallSite , Object )
   at AspNetCore._Areas_OrchardCore_ContentTypes_Views_Admin_Edit.<>c__DisplayClass27_0.<<ExecuteAsync>b__8>d.MoveNext() in /Areas/OrchardCore.ContentTypes/Views/Admin/Edit.cshtml:line 39
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.GetChildContentAsync(Boolean useCachedResult, HtmlEncoder encoder)
   at Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper.ProcessAsync(TagHelperContext context, TagHelperOutput output)
   at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner.<RunAsync>g__Awaited|0_0(Task task, TagHelperExecutionContext executionContext, Int32 i, Int32 count)
   at AspNetCore._Areas_OrchardCore_ContentTypes_Views_Admin_Edit.ExecuteAsync() in /Areas/OrchardCore.ContentTypes/Views/Admin/Edit.cshtml:line 19
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ActionContext actionContext, IView view, ViewDataDictionary viewData, ITempDataDictionary tempData, String contentType, Nullable`1 statusCode)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.ExecuteAsync(ActionContext context, ViewResult result)
   at Microsoft.AspNetCore.Mvc.ViewResult.ExecuteResultAsync(ActionContext context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeResultAsync>g__Logged|21_0(ResourceInvoker invoker, IActionResult result)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|29_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at OrchardCore.Apis.GraphQL.GraphQLMiddleware.Invoke(HttpContext context, IAuthorizationService authorizationService, IAuthenticationService authenticationService, ISchemaFactory schemaService)
   at OrchardCore.Liquid.ScriptsMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
   at OrchardCore.Diagnostics.DiagnosticsStartupFilter.<>c__DisplayClass3_0.<<Configure>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at OrchardCore.ContentPreview.PreviewStartupFilter.<>c.<<Configure>b__1_1>d.MoveNext()
--- End of stack trace from previous location ---
   at OrchardCore.Modules.ModularTenantRouterMiddleware.Invoke(HttpContext httpContext)
   at OrchardCore.Modules.ModularTenantContainerMiddleware.<>c__DisplayClass4_0.<<Invoke>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute, Boolean activateShell)
   at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute, Boolean activateShell)
   at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute, Boolean activateShell)
   at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute, Boolean activateShell)
   at OrchardCore.Modules.ModularTenantContainerMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

CodeGeneration FullTextTemplate issue

I am using the Content definition code generation module.
When I use the FullTextTemplate with multiple lines, the generated code does not compile out of the box.

Generated as:

            _contentDefinitionManager.AlterTypeDefinition("ShowcaseBlurb", type => type
                .DisplayedAs("Showcase Blurb")
                .Stereotype("Widget")
                .WithSettings(new FullTextAspectSettings
                {
                    IncludeFullTextTemplate = true,
                    FullTextTemplate = "{{Model.Content.ShowcaseBlurb.PrimaryText.Text}}
 {{Model.Content.ShowcaseBlurb.SecondaryText.Text}}"
                })
                .WithPart("ShowcaseBlurb", part => part
                    .WithPosition("1")
                )
                .WithPart("TitlePart", part => part
                    .WithPosition("0")
                )
            );

Should be:

            _contentDefinitionManager.AlterTypeDefinition("ShowcaseBlurb", type => type
                .DisplayedAs("Showcase Blurb")
                .Stereotype("Widget")
                .WithSettings(new FullTextAspectSettings
                {
                    IncludeFullTextTemplate = true,
                    FullTextTemplate = @"{{Model.Content.ShowcaseBlurb.PrimaryText.Text}}
 {{Model.Content.ShowcaseBlurb.SecondaryText.Text}}"
                })
                .WithPart("ShowcaseBlurb", part => part
                    .WithPosition("1")
                )
                .WithPart("TitlePart", part => part
                    .WithPosition("0")
                )
            );

or maybe we should escape the newlines as /n ? not sure.

AdditionalStylingPart on widgets outside of Flows (OSOE-595)

I've noticed that AdditionalStylingPart gets welded to widget content items even when you add them to a zone durectly. Yet there is no visible editor for it and I don't think it actually does anything either. So you only see it when you export a content recipe, but when that happens I think this is a bit confusing.

We could do two different things, I'm not sure which would be more correct:

  • Somehow detect if the content item is inside a flow and welding AdditionalStylingPart if it's not. (Currently AdditionalStylingPartHandler only checks if the content it's definition has the "Widget" stereotype.)
  • Make the AdditionalStylingPart effective on regular zone-bound widgets too and display a simple editor. For example apply the CustomClasses to the widget-container.

Jira issue

tip: way to use Helpful-Extensions ShapeTracing in netcore 3.1

mkdir test && cd test
clone https://github.com/Lombiq/Helpful-Extensions.git
# a version in 2021.9
git checkout 4d50142d

# add netcoreapp3.1 and 9.0
  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <LangVersion>9.0</LangVersion>
  </PropertyGroup>


cd ..
dotnet add Your.Application reference test\Helpful-Extensions
dotnet sln add test\Helpful-Extensions\Lombiq.HelpfulExtensions.csproj

cd test && clone https://github.com/Lombiq/Helpful-Libraries.git
# a version in 2021.9
git checkout 9c18b777
cd ..
## maybe add netcoreapp3.1 and 9.0
dotnet add Your.Application reference test\Helpful-Libraries\Lombiq.HelpfulLibraries
dotnet sln add test\Helpful-Libraries\Lombiq.HelpfulLibraries\Lombiq.HelpfulLibraries.csproj


// comment out the line if error reported
            if (!_hca.HttpContext.IsDevelopment()) return Task.CompletedTask;

at last, visit /admin and enable feature of id Lombiq.HelpfulExtensions.ShapeTracing

中文/Chinese

// 目前工具只支持net6.0 : */
// 1. dotnet add package Lombiq.HelpfulLibraries 然后象下面那样添加工程引用和解决方案引用
// 2. 象下面那样手动下载和添加 Helpful-Extensions
// 3. 运行无误,在后台启用特性 Lombiq.HelpfulExtensions.ShapeTracing

// 支持3.1的方法 (2021.10 支持net 3.1 成功)
cd test
clone https://github.com/Lombiq/Helpful-Extensions.git
// 取出 2021.9 的版本
git checkout 4d50142d
// 修改target版本号为3.1;语言为9.0
cd ..
dotnet add Tk.Application.Admin reference test\Helpful-Extensions
dotnet sln add test\Helpful-Extensions\Lombiq.HelpfulExtensions.csproj

cd test && clone https://github.com/Lombiq/Helpful-Libraries.git
// 把 2021.9 的提交取出来
git checkout 9c18b77
cd ..
dotnet add Tk.Application.Admin reference test\Helpful-Libraries\Lombiq.HelpfulLibraries
dotnet sln add test\Helpful-Libraries\Lombiq.HelpfulLibraries\Lombiq.HelpfulLibraries.csproj

// 两个项目上设置版本 否则提示某些语法“在 c# 8.0 下不可用”

9.0

// 这几行报错的话 注释掉 反正不影响使用
if (!_hca.HttpContext.IsDevelopment()) return Task.CompletedTask;

运行无误,在后台启用特性 Lombiq.HelpfulExtensions.ShapeTracing

Shape tracing doesn't display wrappers (OSOE-340)

Thanks for sharing these helpers! The shape tracing helper really filled a need for us. However, one thing I noticed... it doesn't seem to report wrappers. I think the problem is that OrchardCore processes and then clears the wrappers before firing the Displayed event that the shape tracing module hooks into.

Wrappers are cleared here:
https://github.com/OrchardCMS/OrchardCore/blob/1879619df4418ff175a59ba70dcb36bab89fcbb5/src/OrchardCore/OrchardCore.DisplayManagement/Implementation/DefaultHtmlDisplay.cs#L137

But the displayed event is fired just a bit later, here:
https://github.com/OrchardCMS/OrchardCore/blob/1879619df4418ff175a59ba70dcb36bab89fcbb5/src/OrchardCore/OrchardCore.DisplayManagement/Implementation/DefaultHtmlDisplay.cs#L144

Jira issue

Fix issues in target-blank.js (OSOE-576)

Follow-up to #104.

See comments here and below.

  1. Use DOMContentLoaded event instead of load. There's no third parameter there.
  2. Remove the setTimeout indirection from the event handler. Simply pass targetBlank as the handler.
  3. Remove superfluous configuration from package.json file:
    a. "nodejsExtensions"
    b. "devDependencies"
  4. Use compiled scripts from wwwroot\js folder instead of wwwroot\scripts here after 3.a.
  5. Reorder the conditions here.

Jira issue

Preferred method of including Helpful-Extensions

I'm curious as to the preferred way of including Helpful-Extensions (and Helpful-Libraries) in an OrchardCore solution? I'd prefer not to use git submodules. Do you have any plans of publishing to NuGet?

Accordion updates all arrows on click (OSOE-339)

When clicking a single arrow/header, the correct item is expanded, but the arrows of all of the items are toggled.

image

image

I can take a stab at a fix if you can tell me how to override the cshtml file. I tried /Views/Shared/BootstrapAccordion.cshtml and /Views/Lombiq.HelpfulExtensions/BootstrapAccordion.cshtml but neither of those worked.

Jira issue

The test FeatureCodeGeneration(browser: Chrome) fails randomly (OSOE-185)

Sometimes the Lombiq.OSOCE.Tests.UI.Tests.BehaviorHelpfulExtensionsTests.FeatureCodeGeneration fails on GH and TC too.

[xUnit.net 00:03:25.12]     Lombiq.OSOCE.Tests.UI.Tests.BehaviorHelpfulExtensionsTests.FeatureCodeGeneration(browser: Chrome) [FAIL]
  Failed Lombiq.OSOCE.Tests.UI.Tests.BehaviorHelpfulExtensionsTests.FeatureCodeGeneration(browser: Chrome) [54 s]
  Error Message:
   OpenQA.Selenium.StaleElementReferenceException : stale element reference: element is not attached to the page document
  (Session info: headless chrome=105.0.5195.102)
  Stack Trace:
     at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse)
   at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.WebDriver.InternalExecute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.WebElement.Execute(String commandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.WebElement.get_Displayed()
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
   at Atata.ExtendedSearchContext`1.<>c__DisplayClass18_0.<Find>g__FindElementWithVisibilityFiltering|1(T context)
   at Atata.SafeWait`1.Until[TResult](Func`2 condition)
   at Atata.ExtendedSearchContext`1.Find(By by)
   at Lombiq.Tests.UI.Extensions.ElementRetrievalUITestContextExtensions.<>c__DisplayClass0_0.<Get>b__0() in D:\a\Open-Source-Orchard-Core-Extensions\Open-Source-Orchard-Core-Extensions\test\Lombiq.UITestingToolbox\Lombiq.Tests.UI\Extensions\ElementRetrievalUITestContextExtensions.cs:line 29
...

TC
GH

Shortcut to export everything (OSOE-511)

You can export most of the content and configuration of an Orchard Core site. However, to do so, you have to create a deployment plan and add every available step to it (sometimes choosing between steps, like you should use All Content instead of Content with all content types selected). This suggestion is about creating a feature that would similarly export everything.

This is a frequent use-case with representative sites of DotNest Core.

  • This can be some kind of meta-step, or some automation to add all available steps to a generated deployment plan (named like "Full export"). Note that if the latter, then this needs to be kept up to date after each shell restart, since the available steps can change (with features being turned on and off).
    • Dependencies between steps need to be adhered to, e.g. the first one should be All Features, then Replace Content Definitions.
    • Choosing between known overlapping ones like All Content (without "Export As Setup recipe" checked") in favor of Content, or Replace Content Definitions in favor of Update Content Definitions (Delete Content Definitions not needed).
    • Configure steps with smart defaults if necessary (people would still be able to change that after the Deployment Plan is initially created). E.g.:
      • All Content should be without "Export As Setup recipe" checked
      • All Features with "Ignore disabled features"
      • Replace Content Definitions with "Include all content types and parts definitions."
      • Custom Settings with "Include all custom settings."
      • Deployment Plans with "Include all deployment plans."
      • Media with "Include all media."
      • Site Settings with all settings.
  • In any case, use built-in steps. This is not about reimplementing export for every feature.
  • Import should just work without any special care, but do check.

Jira issue

Shape Tracing should skip the PageTitle shape (OSOE-589)

This is the shape that goes into the <title> HTML element. As far as I've seen the inner HTML of the <title> element is treated as plain text in every current browser, so the <!-- .... --> is rendered into the beginning of the window title.

image

The shape tracing should make an exception by skipping PageTitle shape for a better developer experience and easier UI testing setup.

Jira issue

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.