Skip to content

Commit

Permalink
Improve performance for CssClass extensions (#14615)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeAlhayek authored Nov 2, 2023
1 parent c8f1894 commit c9b7333
Show file tree
Hide file tree
Showing 90 changed files with 524 additions and 454 deletions.
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
@using OrchardCore
@model DashboardPartViewModel

<div class="@Orchard.GetWrapperCssClasses()" asp-validation-class-for="Position">
<label asp-for="Position" class="@Orchard.GetLabelCssClasses()">@T["Position"] </label>
<div class="@Orchard.GetEndCssClasses()">
<div class="@Orchard.GetWrapperClasses()" asp-validation-class-for="Position">
<label asp-for="Position" class="@Orchard.GetLabelClasses()">@T["Position"] </label>
<div class="@Orchard.GetEndClasses()">
<input asp-for="Position" class="form-control" />
<span asp-validation-for="Position"></span>
</div>
</div>

<div class="@Orchard.GetWrapperCssClasses()" asp-validation-class-for="Width">
<label asp-for="Width" class="@Orchard.GetLabelCssClasses()">@T["Width"] </label>
<div class="@Orchard.GetEndCssClasses()">
<div class="@Orchard.GetWrapperClasses()" asp-validation-class-for="Width">
<label asp-for="Width" class="@Orchard.GetLabelClasses()">@T["Width"] </label>
<div class="@Orchard.GetEndClasses()">
<input asp-for="Width" class="form-control" />
<span asp-validation-for="Width"></span>
</div>
</div>

<div class="@Orchard.GetWrapperCssClasses()" asp-validation-class-for="Height">
<label asp-for="Height" class="@Orchard.GetLabelCssClasses()">@T["Height"] </label>
<div class="@Orchard.GetEndCssClasses()">
<div class="@Orchard.GetWrapperClasses()" asp-validation-class-for="Height">
<label asp-for="Height" class="@Orchard.GetLabelClasses()">@T["Height"] </label>
<div class="@Orchard.GetEndClasses()">
<input asp-for="Height" class="form-control" />
<span asp-validation-for="Height"></span>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
var culture = await Orchard.GetContentCultureAsync(Model.AliasPart.ContentItem);
}

<div class="@Orchard.GetWrapperCssClasses()" asp-validation-class-for="Alias">
<label asp-for="Alias" class="@Orchard.GetLabelCssClasses()">@T["Alias"] </label>
<div class="@Orchard.GetEndCssClasses()">
<div class="@Orchard.GetWrapperClasses()" asp-validation-class-for="Alias">
<label asp-for="Alias" class="@Orchard.GetLabelClasses()">@T["Alias"] </label>
<div class="@Orchard.GetEndClasses()">
<input asp-for="Alias" class="form-control text-muted" disabled="@(Model.Settings?.Options == AliasPartOptions.GeneratedDisabled)" dir="@culture.GetLanguageDirection()" />
<span asp-validation-for="Alias"></span>
<span class="hint">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

@if (Model.Settings.AllowDisabled)
{
<div class="@Orchard.GetWrapperCssClasses()">
<div class="@Orchard.GetEndCssClasses(true)">
<div class="@Orchard.GetWrapperClasses()">
<div class="@Orchard.GetEndClasses(true)">
<div class="form-check">
<input type="checkbox" class="form-check-input" asp-for="Disabled" checked="@Model.Disabled" />
<label class="form-check-label" asp-for="Disabled">@T["Disabled"]</label>
Expand All @@ -27,9 +27,9 @@
}

<div class="autoroute-disabled" style="@(Model.Disabled ? "display: none" : string.Empty)">
<div class="@Orchard.GetWrapperCssClasses()" asp-validation-class-for="Path">
<label asp-for="Path" class="@Orchard.GetLabelCssClasses()">@T["Permalink"]</label>
<div class="@Orchard.GetEndCssClasses()">
<div class="@Orchard.GetWrapperClasses()" asp-validation-class-for="Path">
<label asp-for="Path" class="@Orchard.GetLabelClasses()">@T["Permalink"]</label>
<div class="@Orchard.GetEndClasses()">
<div class="input-group">
@if (!string.IsNullOrWhiteSpace(site.BaseUrl))
{
Expand Down Expand Up @@ -64,8 +64,8 @@
{
if (showHomepageOption)
{
<div class="@Orchard.GetWrapperCssClasses()">
<div class="@Orchard.GetEndCssClasses(true)">
<div class="@Orchard.GetWrapperClasses()">
<div class="@Orchard.GetEndClasses(true)">
<div class="form-check">
<input type="checkbox" class="form-check-input" asp-for="SetHomepage" checked="@Model.SetHomepage" />
<label class="form-check-label" asp-for="SetHomepage">@T["Set as homepage"]</label>
Expand All @@ -79,8 +79,8 @@

@if (Model.Settings.AllowUpdatePath)
{
<div class="@Orchard.GetWrapperCssClasses()">
<div class="@Orchard.GetEndCssClasses(true)">
<div class="@Orchard.GetWrapperClasses()">
<div class="@Orchard.GetEndClasses(true)">
<div class="form-check">
<input type="checkbox" class="form-check-input" asp-for="UpdatePath" checked="@Model.UpdatePath" />
<label class="form-check-label" asp-for="UpdatePath">@T["Refresh the path"]</label>
Expand All @@ -92,8 +92,8 @@

@if (containedContentItemsAspect.Accessors.Any() && Model.Settings.AllowRouteContainedItems)
{
<div class="@Orchard.GetWrapperCssClasses()">
<div class="@Orchard.GetEndCssClasses(true)">
<div class="@Orchard.GetWrapperClasses()">
<div class="@Orchard.GetEndClasses(true)">
<div class="form-check">
<input type="checkbox" class="form-check-input" asp-for="RouteContainedItems" checked="@Model.RouteContainedItems" />
<label class="form-check-label" asp-for="RouteContainedItems">@T["Route contained items"]</label>
Expand All @@ -105,8 +105,8 @@

@if (Model.Settings.ManageContainedItemRoutes && Model.Settings.AllowAbsolutePath)
{
<div class="@Orchard.GetWrapperCssClasses()">
<div class="@Orchard.GetEndCssClasses(true)">
<div class="@Orchard.GetWrapperClasses()">
<div class="@Orchard.GetEndClasses(true)">
<div class="form-check">
<input type="checkbox" class="form-check-input" asp-for="Absolute" checked="@Model.Absolute" />
<label class="form-check-label" asp-for="Absolute">@T["Absolute"]</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@
<div class="tab-content" id="tabs">
<div class="tab-pane fade show active" id="properties" role="tabpanel" aria-labelledby="properties-tab">

<div class="@Orchard.GetWrapperCssClasses()" asp-validation-class-for="Title">
<label asp-for="Title" class="@Orchard.GetLabelCssClasses()">@T["Title"]</label>
<div class="@Orchard.GetEndCssClasses()">
<div class="@Orchard.GetWrapperClasses()" asp-validation-class-for="Title">
<label asp-for="Title" class="@Orchard.GetLabelClasses()">@T["Title"]</label>
<div class="@Orchard.GetEndClasses()">
<input asp-for="Title" class="form-control-plaintext" readonly />
</div>
</div>

<div class="@Orchard.GetWrapperCssClasses()" asp-validation-class-for="Description">
<label asp-for="Description" class="@Orchard.GetLabelCssClasses()">@T["Description"]</label>
<div class="@Orchard.GetEndCssClasses()">
<div class="@Orchard.GetWrapperClasses()" asp-validation-class-for="Description">
<label asp-for="Description" class="@Orchard.GetLabelClasses()">@T["Description"]</label>
<div class="@Orchard.GetEndClasses()">
<input asp-for="Description" class="form-control-plaintext" />
</div>
</div>

<div class="@Orchard.GetWrapperCssClasses()" asp-validation-class-for="Schedule">
<label asp-for="Schedule" class="@Orchard.GetLabelCssClasses()">@T["Schedule"]</label>
<div class="@Orchard.GetEndCssClasses()">
<div class="@Orchard.GetWrapperClasses()" asp-validation-class-for="Schedule">
<label asp-for="Schedule" class="@Orchard.GetLabelClasses()">@T["Schedule"]</label>
<div class="@Orchard.GetEndClasses()">
<div class="input-group mb-3">
<input asp-for="Schedule" class="form-control" />
<button id="use-default-schedule" class="btn btn-outline-success">@T["Reset Schedule"]</button>
Expand All @@ -44,8 +44,8 @@
</div>
</div>

<div class="@Orchard.GetWrapperCssClasses()">
<div class="@Orchard.GetEndCssClasses(true)">
<div class="@Orchard.GetWrapperClasses()">
<div class="@Orchard.GetEndClasses(true)">
<div class="form-check">
<input type="checkbox" class="form-check-input" asp-for="UsePipeline" checked="@Model.UsePipeline" />
<label class="form-check-label" asp-for="UsePipeline">@T["Use Tenant Pipeline"]</label>
Expand All @@ -59,18 +59,18 @@
</div>

<div class="tab-pane fade" id="advanced" role="tabpanel" aria-labelledby="advanced-tab">
<div class="@Orchard.GetWrapperCssClasses()" asp-validation-class-for="LockTimeout">
<label asp-for="LockTimeout" class="@Orchard.GetLabelCssClasses()">@T["Lock timeout (ms)"]</label>
<div class="@Orchard.GetEndCssClasses()">
<div class="@Orchard.GetWrapperClasses()" asp-validation-class-for="LockTimeout">
<label asp-for="LockTimeout" class="@Orchard.GetLabelClasses()">@T["Lock timeout (ms)"]</label>
<div class="@Orchard.GetEndClasses()">
<input asp-for="LockTimeout" type="number" min="0" max="30000" class="form-control">
<span class="hint">@T["The timeout in milliseconds to acquire a lock before executing the task atomically. Leave it to zero to not use any locking."]</span>
<span class="hint">@T["Ignored if there is no distributed lock feature enabled."]</span>
</div>
</div>

<div class="@Orchard.GetWrapperCssClasses()" asp-validation-class-for="LockExpiration">
<label asp-for="LockExpiration" class="@Orchard.GetLabelCssClasses()">@T["Lock expiration (ms)"]</label>
<div class="@Orchard.GetEndCssClasses()">
<div class="@Orchard.GetWrapperClasses()" asp-validation-class-for="LockExpiration">
<label asp-for="LockExpiration" class="@Orchard.GetLabelClasses()">@T["Lock expiration (ms)"]</label>
<div class="@Orchard.GetEndClasses()">
<input asp-for="LockExpiration" type="number" min="0" max="30000" class="form-control">
<span class="hint">@T["The expiration in milliseconds of the lock acquired before executing the task atomically. Leave it to zero to not use any locking."]</span>
<span class="hint">@T["Ignored if there is no distributed lock feature enabled."]</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
var settings = Model.PartFieldDefinition.GetSettings<BooleanFieldSettings>();
}

<div class="@Orchard.GetFieldWrapperCssClasses(Model.PartFieldDefinition)" id="@Html.IdFor(x => x.Value)_FieldWrapper">
<div class="@Orchard.GetEndCssClasses(true)">
<div class="@Orchard.GetFieldWrapperClasses(Model.PartFieldDefinition)" id="@Html.IdFor(x => x.Value)_FieldWrapper">
<div class="@Orchard.GetEndClasses(true)">
<div class="form-check form-switch">
<input asp-for="Value" type="checkbox" class="form-check-input content-preview-select" checked="@Model.Value" />
<label asp-for="Value" class="form-check-label">@(string.IsNullOrEmpty(settings.Label) ? Model.PartFieldDefinition.DisplayName() : settings.Label)</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
var settings = Model.PartFieldDefinition.GetSettings<BooleanFieldSettings>();
}

<div class="@Orchard.GetFieldWrapperCssClasses(Model.PartFieldDefinition)" id="@Html.IdFor(x => x.Value)_FieldWrapper">
<div class="@Orchard.GetEndCssClasses(true)">
<div class="@Orchard.GetFieldWrapperClasses(Model.PartFieldDefinition)" id="@Html.IdFor(x => x.Value)_FieldWrapper">
<div class="@Orchard.GetEndClasses(true)">
<div class="form-check">
<input asp-for="Value" type="checkbox" class="form-check-input content-preview-select" checked="@Model.Value" />
<label class="form-check-label" asp-for="Value">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
<script asp-name="vue-multiselect-wrapper" asp-src="~/OrchardCore.ContentFields/Scripts/vue-multiselect-wrapper.js" at="Foot" depends-on="vuejs, vue-multiselect, sortable, vuedraggable"></script>
<style asp-name="vue-multiselect" at="Foot"></style>

<div class="@Orchard.GetFieldWrapperCssClasses(Model.PartFieldDefinition)" id="@Html.IdFor(x => x.ContentItemIds)_FieldWrapper">
<label asp-for="ContentItemIds" class="@Orchard.GetLabelCssClasses()">@Model.PartFieldDefinition.DisplayName()</label>
<div class="@Orchard.GetEndCssClasses()">
<div class="@Orchard.GetFieldWrapperClasses(Model.PartFieldDefinition)" id="@Html.IdFor(x => x.ContentItemIds)_FieldWrapper">
<label asp-for="ContentItemIds" class="@Orchard.GetLabelClasses()">@Model.PartFieldDefinition.DisplayName()</label>
<div class="@Orchard.GetEndClasses()">
<div id="@vueElementId" class="vue-multiselect" data-part="@partName" data-field="@fieldName" data-editor-type="ContentPicker" data-selected-items="@selectedItems" data-search-url="@searchUrl" data-multiple="@multiple">

<ul class="mb-1 list-group w-lg-75 w-xxl-50 content-picker-default__list" v-show="arrayOfItems.length" v-cloak>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
var datepickerId = Html.IdFor(m => m.Value);
}

<div class="@Orchard.GetWrapperCssClasses()">
<label asp-for="Value" class="@Orchard.GetLabelCssClasses()">@Model.PartFieldDefinition.DisplayName()</label>
<div class="@Orchard.GetEndCssClasses()">
<div class="@Orchard.GetLimitedWidthWrapperCssClasses()">
<div class="@Orchard.GetLimitedWidthCssClasses()">
<div class="@Orchard.GetWrapperClasses()">
<label asp-for="Value" class="@Orchard.GetLabelClasses()">@Model.PartFieldDefinition.DisplayName()</label>
<div class="@Orchard.GetEndClasses()">
<div class="@Orchard.GetLimitedWidthWrapperClasses()">
<div class="@Orchard.GetLimitedWidthClasses()">
<input asp-for="Value" type="text" class="form-control content-preview-select datepicker" required="@settings.Required" />
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
}

<script asp-name="jQuery-ui-i18n" at="Foot"></script>
<div class="@Orchard.GetFieldWrapperCssClasses(Model.PartFieldDefinition)" id="@Html.IdFor(x => x.Value)_FieldWrapper">
<label asp-for="Value" class="@Orchard.GetLabelCssClasses()">@Model.PartFieldDefinition.DisplayName()</label>
<div class="@Orchard.GetEndCssClasses()">
<div class="@Orchard.GetLimitedWidthWrapperCssClasses()">
<div class="@Orchard.GetLimitedWidthCssClasses()">
<div class="@Orchard.GetFieldWrapperClasses(Model.PartFieldDefinition)" id="@Html.IdFor(x => x.Value)_FieldWrapper">
<label asp-for="Value" class="@Orchard.GetLabelClasses()">@Model.PartFieldDefinition.DisplayName()</label>
<div class="@Orchard.GetEndClasses()">
<div class="@Orchard.GetLimitedWidthWrapperClasses()">
<div class="@Orchard.GetLimitedWidthClasses()">
<input asp-for="Value" type="date" class="form-control content-preview-select" required="@settings.Required" />
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
var settings = Model.PartFieldDefinition.GetSettings<DateTimeFieldSettings>();
}
<script asp-name="jQuery-ui-i18n" at="Foot"></script>
<div class="@Orchard.GetFieldWrapperCssClasses(Model.PartFieldDefinition)" id="@Html.IdFor(x => x.LocalDateTime)_FieldWrapper">
<label asp-for="LocalDateTime" class="@Orchard.GetLabelCssClasses()">@Model.PartFieldDefinition.DisplayName()</label>
<div class="@Orchard.GetEndCssClasses()">
<div class="@Orchard.GetLimitedWidthWrapperCssClasses()">
<div class="@Orchard.GetLimitedWidthCssClasses()">
<div class="@Orchard.GetFieldWrapperClasses(Model.PartFieldDefinition)" id="@Html.IdFor(x => x.LocalDateTime)_FieldWrapper">
<label asp-for="LocalDateTime" class="@Orchard.GetLabelClasses()">@Model.PartFieldDefinition.DisplayName()</label>
<div class="@Orchard.GetEndClasses()">
<div class="@Orchard.GetLimitedWidthWrapperClasses()">
<div class="@Orchard.GetLimitedWidthClasses()">
<input asp-for="LocalDateTime" type="datetime-local" class="form-control content-preview-select" required="@settings.Required" />
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
var culture = await Orchard.GetContentCultureAsync(Model.Field.ContentItem);
}

<div class="@Orchard.GetFieldWrapperCssClasses(Model.PartFieldDefinition)" id="@Html.IdFor(x => x.Html)_FieldWrapper">
<label asp-for="Html" class="@Orchard.GetLabelCssClasses()">@Model.PartFieldDefinition.DisplayName()</label>
<div class="@Orchard.GetEndCssClasses()">
<div class="@Orchard.GetFieldWrapperClasses(Model.PartFieldDefinition)" id="@Html.IdFor(x => x.Html)_FieldWrapper">
<label asp-for="Html" class="@Orchard.GetLabelClasses()">@Model.PartFieldDefinition.DisplayName()</label>
<div class="@Orchard.GetEndClasses()">
@await DisplayAsync(await New.ShortcodeModal())
<div id="@Html.IdFor(x => x.Html)_editor" asp-for="Text" style="min-height: 400px;" class="form-control" dir="@culture.GetLanguageDirection()"></div>
<textarea asp-for="Html" hidden>@Html.Raw(Model.Html)</textarea>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
var culture = await Orchard.GetContentCultureAsync(Model.Field.ContentItem);
}

<div class="@Orchard.GetFieldWrapperCssClasses(Model.PartFieldDefinition)" id="@Html.IdFor(x => x.Html)_FieldWrapper">
<label asp-for="Html" class="@Orchard.GetLabelCssClasses()">@Model.PartFieldDefinition.DisplayName()</label>
<div class="@Orchard.GetEndCssClasses()">
<div class="@Orchard.GetFieldWrapperClasses(Model.PartFieldDefinition)" id="@Html.IdFor(x => x.Html)_FieldWrapper">
<label asp-for="Html" class="@Orchard.GetLabelClasses()">@Model.PartFieldDefinition.DisplayName()</label>
<div class="@Orchard.GetEndClasses()">
@await DisplayAsync(await New.ShortcodeModal())
<textarea asp-for="Html" rows="5" class="form-control content-preview-text shortcode-modal-input" dir="@culture.GetLanguageDirection()"></textarea>
@if (!string.IsNullOrEmpty(settings.Hint))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ else
<script asp-src="~/OrchardCore.ContentFields/Scripts/trumbowyg.media.tag.min.js" debug-src="~/OrchardCore.ContentFields/Scripts/trumbowyg.media.tag.js" depends-on="trumbowyg" at="Foot"></script>
}

<div class="@Orchard.GetFieldWrapperCssClasses(Model.PartFieldDefinition)" id="@Html.IdFor(x => x.Html)_FieldWrapper">
<label asp-for="Html" class="@Orchard.GetLabelCssClasses()">@Model.PartFieldDefinition.DisplayName()</label>
<div class="@Orchard.GetEndCssClasses()">
<div class="@Orchard.GetFieldWrapperClasses(Model.PartFieldDefinition)" id="@Html.IdFor(x => x.Html)_FieldWrapper">
<label asp-for="Html" class="@Orchard.GetLabelClasses()">@Model.PartFieldDefinition.DisplayName()</label>
<div class="@Orchard.GetEndClasses()">
@await DisplayAsync(await New.ShortcodeModal())
@if (culture.IsRightToLeft())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
<script asp-name="trumbowyg-shortcodes" at="Foot"></script>


<div class="@Orchard.GetFieldWrapperCssClasses(Model.PartFieldDefinition)" id="@Html.IdFor(x => x.Html)_FieldWrapper">
<label asp-for="Html" class="@Orchard.GetLabelCssClasses()">@Model.PartFieldDefinition.DisplayName()</label>
<div class="@Orchard.GetEndCssClasses()">
<div class="@Orchard.GetFieldWrapperClasses(Model.PartFieldDefinition)" id="@Html.IdFor(x => x.Html)_FieldWrapper">
<label asp-for="Html" class="@Orchard.GetLabelClasses()">@Model.PartFieldDefinition.DisplayName()</label>
<div class="@Orchard.GetEndClasses()">
@await DisplayAsync(await New.ShortcodeModal())
@if (culture.IsRightToLeft())
{
Expand Down
Loading

0 comments on commit c9b7333

Please sign in to comment.