Skip to content

Feature/maxlengthsetting#8719

Merged
MatteoPiovanelli merged 10 commits intoOrchardCMS:1.10.xfrom
LaserSrl:feature/maxlengthsetting
Feb 21, 2024
Merged

Feature/maxlengthsetting#8719
MatteoPiovanelli merged 10 commits intoOrchardCMS:1.10.xfrom
LaserSrl:feature/maxlengthsetting

Conversation

@AgostiniAlessandro
Copy link
Copy Markdown
Contributor

Implemented what was described in the #8718 issue

# Conflicts:
#	src/Orchard.Web/Modules/Orchard.Taxonomies/Settings/TaxonomyFieldEditorEvents.cs
@using Orchard.Utility.Extensions;
@{
string editorFlavor = Model.EditorFlavor;
var htmlAttributes = (Dictionary<string, object>)Model.HtmlAttributes;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There should be a "behavior" attached to this HtmlAttributes property that will initialize the dictionary automatically to prevent such tests. Can you try?

Comment thread src/Orchard.Web/Core/Title/Settings/TitlePartSettings.cs Outdated
};
var htmlAttributes = (Dictionary<string, object>)Model.HtmlAttributes;

if (htmlAttributes == null) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you try to set the attributes even if Model.HtmlAttributes is null, meaning don't check for it, just assign it and see if that works (some magic we made in Orchard1).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I tried, it doesn't work.
Anyway I found a bug introduced in the last commit and I fixed it and tested everything from scratch.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it's because the existing property on the shapes is named Attributes. Can you try to use this one and even doing something like Model.Attributes["required"] = "required" for instance?
And it also already has a IList<string> Classes property which isn't null.


public class TitlePartSettings {
// Whenever this constant is changed a new migration step must be created to update the length of the field on the DB
public const int MAX_TITLE_LENGTH = 1024;
Copy link
Copy Markdown
Member

@sebastienros sebastienros Sep 14, 2023

Choose a reason for hiding this comment

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

Pascal case

Suggested change
public const int MAX_TITLE_LENGTH = 1024;
public const int MaxTitleLength = 1024;

@sebastienros
Copy link
Copy Markdown
Member

@AndreaPiovanelliLaser let me know if you think we should review it again?

@MatteoPiovanelli
Copy link
Copy Markdown
Contributor

He only changed the the casing to PascalCase per your September recommendation.
We've been testing this for a while on our test and staging environments, so if it's still fine for you, we are ok with it.

@AndreaPiovanelli
Copy link
Copy Markdown
Contributor

@AndreaPiovanelliLaser let me know if you think we should review it again?

As Matteo said, I only changed the casing of the MaxTitleLength const, so I think this pr is safe to be merged.

@MatteoPiovanelli MatteoPiovanelli merged commit 44bfa39 into OrchardCMS:1.10.x Feb 21, 2024
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.

4 participants