-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kentico Xperience 13 Refresh 1 changes
- Loading branch information
1 parent
863fd29
commit e4ca843
Showing
6 changed files
with
221 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
223 changes: 126 additions & 97 deletions
223
LearningKitCore/CodeSnippets/Razor/CodeSnippetsTagHelpers.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,97 +1,126 @@ | ||
@*DocSection:PageBuilderScriptsTagHelper*@ | ||
@addTagHelper Kentico.Content.Web.Mvc.PageBuilderScriptsTagHelper, Kentico.Content.Web.Mvc | ||
|
||
<page-builder-scripts /> | ||
@*EndDocSection:PageBuilderScriptsTagHelper*@ | ||
|
||
@*DocSection:PageBuilderStylesTagHelper*@ | ||
@addTagHelper Kentico.Content.Web.Mvc.PageBuilderStylesTagHelper, Kentico.Content.Web.Mvc | ||
|
||
<page-builder-styles /> | ||
@*EndDocSection:PageBuilderStylesTagHelper*@ | ||
|
||
@*DocSection:EditableAreaTagHelperSimple*@ | ||
@addTagHelper Kentico.Content.Web.Mvc.EditableAreaTagHelper, Kentico.Content.Web.Mvc | ||
|
||
<editable-area area-identifier="areaSimple" /> | ||
@*EndDocSection:EditableAreaTagHelperSimple*@ | ||
|
||
@*DocSection:EditableAreaTagHelperAdvanced*@ | ||
@addTagHelper Kentico.Content.Web.Mvc.EditableAreaTagHelper, Kentico.Content.Web.Mvc | ||
@using Kentico.PageBuilder.Web.Mvc | ||
|
||
@{ | ||
var options = new EditableAreaOptions | ||
{ | ||
AllowedWidgets = new[] { "LearningKit.Widgets.NumberWidget", | ||
"LearningKit.Widgets.SomeOtherWidget" }, | ||
AllowedSections = AllowedComponents.ALL | ||
}; | ||
} | ||
|
||
<editable-area area-identifier="areaConfigured" area-options="options" /> | ||
@*EndDocSection:EditableAreaTagHelperAdvanced*@ | ||
|
||
@*DocSection:WidgetZoneTagHelper*@ | ||
@addTagHelper Kentico.Content.Web.Mvc.WidgetZoneTagHelper, Kentico.Content.Web.Mvc | ||
|
||
<widget-zone /> | ||
@*EndDocSection:WidgetZoneTagHelper*@ | ||
|
||
@*DocSection:PageDataTagHelper*@ | ||
@addTagHelper Kentico.Content.Web.Mvc.PageDataTagHelper, Kentico.Content.Web.Mvc | ||
|
||
<form asp-controller="Controller" asp-action="HandlePost" id="form"> | ||
|
||
... | ||
|
||
<page-data /> | ||
|
||
<input type="submit" value="Submit" /> | ||
</form> | ||
@*EndDocSection:PageDataTagHelper*@ | ||
|
||
@*DocSection:ComponentPropertiesDataTagHelper*@ | ||
@addTagHelper Kentico.Content.Web.Mvc.ComponentPropertiesDataTagHelper, Kentico.Content.Web.Mvc | ||
|
||
<form asp-controller="Controller" asp-action="HandlePost" id="form"> | ||
|
||
... | ||
|
||
<component-properties-data /> | ||
|
||
<input type="submit" value="Submit" /> | ||
</form> | ||
@*EndDocSection:ComponentPropertiesDataTagHelper*@ | ||
|
||
@*DocSection:StandaloneWidgetTagHelper*@ | ||
@addTagHelper Kentico.Content.Web.Mvc.StandaloneWidgetTagHelper, Kentico.Content.Web.Mvc | ||
@using Kentico.Forms.Web.Mvc.Widgets | ||
@using Kentico.Content.Web.Mvc | ||
|
||
@{ | ||
var widgetProperties = new FormWidgetProperties() | ||
{ | ||
SelectedForm = "FormCodeName" | ||
}; | ||
} | ||
|
||
@* Renders the system's default Form widget *@ | ||
<standalone-widget widget-type-identifier="@SystemComponentIdentifiers.FORM_WIDGET_IDENTIFIER" widget-properties="widgetProperties" /> | ||
@*EndDocSection:StandaloneWidgetTagHelper*@ | ||
|
||
@*DocSection:NestedWidgetTagHelper*@ | ||
@addTagHelper Kentico.Content.Web.Mvc.NestedWidgetTagHelper, Kentico.Content.Web.Mvc | ||
|
||
@* In this example, the extended widget uses an extended FormWidgetProperties class *@ | ||
@model ComponentViewModel<ExtendedFormWidgetProperties> | ||
|
||
@* Renders the system's default Form widget as the nested widget *@ | ||
<nested-widget widget-type-identifier="@SystemComponentIdentifiers.FORM_WIDGET_IDENTIFIER" widget-properties="Model.Properties" /> | ||
@*EndDocSection:NestedWidgetTagHelper*@ | ||
|
||
@*DocSection:FormZoneTagHelper*@ | ||
@addTagHelper Kentico.Content.Web.Mvc.FormZoneTagHelper, Kentico.Content.Web.Mvc | ||
|
||
<form-zone /> | ||
@*EndDocSection:FormZoneTagHelper*@ | ||
@*DocSection:PageBuilderScriptsTagHelper*@ | ||
@addTagHelper Kentico.Content.Web.Mvc.PageBuilderScriptsTagHelper, Kentico.Content.Web.Mvc | ||
|
||
<page-builder-scripts /> | ||
@*EndDocSection:PageBuilderScriptsTagHelper*@ | ||
|
||
@*DocSection:PageBuilderStylesTagHelper*@ | ||
@addTagHelper Kentico.Content.Web.Mvc.PageBuilderStylesTagHelper, Kentico.Content.Web.Mvc | ||
|
||
<page-builder-styles /> | ||
@*EndDocSection:PageBuilderStylesTagHelper*@ | ||
|
||
@*DocSection:EditableAreaTagHelperSimple*@ | ||
@addTagHelper Kentico.Content.Web.Mvc.EditableAreaTagHelper, Kentico.Content.Web.Mvc | ||
|
||
<editable-area area-identifier="areaSimple" /> | ||
@*EndDocSection:EditableAreaTagHelperSimple*@ | ||
|
||
@*DocSection:EditableAreaTagHelperAdvanced*@ | ||
@addTagHelper Kentico.Content.Web.Mvc.EditableAreaTagHelper, Kentico.Content.Web.Mvc | ||
@using Kentico.PageBuilder.Web.Mvc | ||
|
||
@{ | ||
var options = new EditableAreaOptions | ||
{ | ||
AllowedWidgets = new[] { "LearningKit.Widgets.NumberWidget", | ||
"LearningKit.Widgets.SomeOtherWidget" }, | ||
AllowedSections = AllowedComponents.ALL | ||
}; | ||
} | ||
|
||
<editable-area area-identifier="areaConfigured" area-options="options" /> | ||
@*EndDocSection:EditableAreaTagHelperAdvanced*@ | ||
|
||
@*DocSection:EditableAreaCacheConfiguration*@ | ||
@* widget-output-cache-expires-on *@ | ||
@* Sets the cached entry to expire on 5:02 PM on January 29, 2025. If the specified date is in the past, nothing gets cached. *@ | ||
<editable-area area-identifier="editableArea" area-widget-output-cache="true" widget-output-cache-expires-on="@new DateTime(2025,1,29,17,02,0)" /> | ||
|
||
@* widget-output-cache-expires-after *@ | ||
@* Contents are evicted after five minutes and cached again on subsequent requests. *@ | ||
<editable-area area-identifier="editableArea" area-widget-output-cache="true" widget-output-cache-expires-after="@TimeSpan.FromSeconds(300)" /> | ||
|
||
@* widget-output-cache-expires-sliding *@ | ||
@* Cached content is evicted if not accessed again within 120 seconds of the initial request. *@ | ||
<editable-area area-identifier="editableArea" area-widget-output-cache="true" widget-output-cache-expires-sliding="@TimeSpan.FromSeconds(120)" /> | ||
@*EndDocSection:EditableAreaCacheConfiguration*@ | ||
|
||
@*DocSection:WidgetZoneTagHelper*@ | ||
@addTagHelper Kentico.Content.Web.Mvc.WidgetZoneTagHelper, Kentico.Content.Web.Mvc | ||
|
||
<widget-zone /> | ||
@*EndDocSection:WidgetZoneTagHelper*@ | ||
|
||
@*DocSection:PageDataTagHelper*@ | ||
@addTagHelper Kentico.Content.Web.Mvc.PageDataTagHelper, Kentico.Content.Web.Mvc | ||
|
||
<form asp-controller="Controller" asp-action="HandlePost" id="form"> | ||
|
||
... | ||
|
||
<page-data /> | ||
|
||
<input type="submit" value="Submit" /> | ||
</form> | ||
@*EndDocSection:PageDataTagHelper*@ | ||
|
||
@*DocSection:ComponentPropertiesDataTagHelper*@ | ||
@addTagHelper Kentico.Content.Web.Mvc.ComponentPropertiesDataTagHelper, Kentico.Content.Web.Mvc | ||
|
||
<form asp-controller="Controller" asp-action="HandlePost" id="form"> | ||
|
||
... | ||
|
||
<component-properties-data /> | ||
|
||
<input type="submit" value="Submit" /> | ||
</form> | ||
@*EndDocSection:ComponentPropertiesDataTagHelper*@ | ||
|
||
@*DocSection:StandaloneWidgetTagHelper*@ | ||
@addTagHelper Kentico.Content.Web.Mvc.StandaloneWidgetTagHelper, Kentico.Content.Web.Mvc | ||
@using Kentico.Forms.Web.Mvc.Widgets | ||
@using Kentico.Content.Web.Mvc | ||
|
||
@{ | ||
var widgetProperties = new FormWidgetProperties() | ||
{ | ||
SelectedForm = "FormCodeName" | ||
}; | ||
} | ||
|
||
@* Renders the system's default Form widget *@ | ||
<standalone-widget widget-type-identifier="@SystemComponentIdentifiers.FORM_WIDGET_IDENTIFIER" widget-properties="widgetProperties" /> | ||
@*EndDocSection:StandaloneWidgetTagHelper*@ | ||
|
||
@*DocSection:NestedWidgetTagHelper*@ | ||
@addTagHelper Kentico.Content.Web.Mvc.NestedWidgetTagHelper, Kentico.Content.Web.Mvc | ||
|
||
@* In this example, the extended widget uses an extended FormWidgetProperties class *@ | ||
@model ComponentViewModel<ExtendedFormWidgetProperties> | ||
@* Renders the system's default Form widget as the nested widget *@ | ||
<nested-widget widget-type-identifier="@SystemComponentIdentifiers.FORM_WIDGET_IDENTIFIER" widget-properties="Model.Properties" /> | ||
@*EndDocSection:NestedWidgetTagHelper*@ | ||
|
||
@*DocSection:FormZoneTagHelper*@ | ||
@addTagHelper Kentico.Content.Web.Mvc.FormZoneTagHelper, Kentico.Content.Web.Mvc | ||
|
||
<form-zone /> | ||
@*EndDocSection:FormZoneTagHelper*@ | ||
|
||
@*DocSection:CacheDependencyTagHelper*@ | ||
@addTagHelper Kentico.Web.Mvc.Caching.CacheDependencyTagHelper, Kentico.Web.Mvc | ||
|
||
@{ | ||
var userCacheKeys = new[] { "cms.user|all" }; | ||
|
||
var enabled = false; | ||
} | ||
<cache enabled="@enabled"> | ||
@* Clears the cached data whenever a user object is modified *@ | ||
<cache-dependency cache-keys="@userCacheKeys" enabled="@enabled" /> | ||
|
||
Time: @DateTime.Now | ||
</cache> | ||
@*EndDocSection:CacheDependencyTagHelper*@ |
21 changes: 11 additions & 10 deletions
21
LearningKitCore/Components/FormBuilder/FormSections/TwoColumnFormSection.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
@using Kentico.Web.Mvc | ||
@using Kentico.Forms.Web.Mvc | ||
|
||
namespace LearningKitCore.Components.FormSections | ||
{ | ||
public class TwoColumnFormSection | ||
{ | ||
} | ||
} | ||
<div> | ||
<div style="float:left; width:50%;"> | ||
@await Html.Kentico().FormZoneAsync() | ||
</div> | ||
<div style="float:left; width:50%;"> | ||
@await Html.Kentico().FormZoneAsync() | ||
</div> | ||
<div style="clear:both;" /> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
|
||
using CMS.Membership; | ||
|
||
using Kentico.PageBuilder.Web.Mvc; | ||
|
||
namespace LearningKitCore.Customizations.Caching | ||
{ | ||
public class VaryByUserName : ICacheVaryByOption | ||
{ | ||
public string GetKey() | ||
{ | ||
string userFirstName = MembershipContext.AuthenticatedUser?.FirstName ?? String.Empty; | ||
|
||
return $"UserFirstName={userFirstName}"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.