Orchardcore crestapps resources

From CrestApps/CrestApps.AgentSkills · View interactive version

Orchardcore crestapps resources is an AI agent skill from the GitHub repository CrestApps/CrestApps.AgentSkills. Skill for the CrestApps Resources module in Orchard Core. Covers the shared script and stylesheet manifest, FullCalendar 7.1.4, the d3-org-chart organization chart, the AI chat UI resources, the DateRangePicker, ItemSelector, PartyPicker and RecordPicker view components, the FileDropInput, PageSecti

How to use this skill

Skill file

CrestApps Resources

Consume CrestApps shared frontend resources

You are an Orchard Core expert. CrestApps.OrchardCore.Resources is the shared resource manifest for CrestApps modules. It registers named scripts and stylesheets with Orchard Core Resource Management, ships the DateRangePicker, ItemSelector, PartyPicker and RecordPicker view components, the FileDropInput, PageSections and TemplatedEmailTemplatesEditor shapes, and the party and record search endpoints. Consumers request a resource by name and let Orchard Core choose the local or CDN URL.

Guidelines

Feature overview

| Feature ID | Purpose |

|---|---|

| CrestApps.OrchardCore.Resources | Shared resource manifest, view components, shared shapes, Admin/api/crestapps/parties/search and Admin/api/crestapps/records/search; with OrchardCore.Contents, the Content record kind |

{
  "steps": [
    {
      "name": "Feature",
      "enable": [
        "CrestApps.OrchardCore.Resources"
      ],
      "disable": []
    }
  ]
}

Registered resource names

All names are registered in ResourceManagementOptionsConfiguration, added through services.AddResourceConfiguration<ResourceManagementOptionsConfiguration>().

| Name | Kind | Depends on | Notes |

|---|---|---|---|

| list-management-ui | Script | - | Select-all and row selection for admin list tables; data-minimum-selection (default 2) sets how many checked rows show the bulk actions; local only |

| item-selector | Script and style | - | Searchable selector behind the ItemSelector view component, local only |

| collapsible-panel | Script | - | Collapsible admin panel behavior, local only |

| file-drop | Script and style | - | Behind the FileDropInput shape, local only |

| tool-instance-parameters | Script | - | AI tool instance parameter editor, local only |

| easymde | Script and style | - | EasyMDE 2.21.0, local only |

| chart.js | Script | - | Chart.js 4.5.1, jsDelivr fallback |

| medium-zoom | Script | - | medium-zoom 1.1.0, enlarges chat figures, jsDelivr fallback |

| marked | Script | - | marked 18, bundled to window.marked, jsDelivr fallback |

| flatpickr | Script and style | - | Flatpickr 4.6.13, jsDelivr fallback |

| flatpickr-culture | Script | - | flatpickrCulture.createLocalizedDateConfig / createLocalizedDateTimeConfig helpers that map .NET culture patterns to Flatpickr |

| date-range-picker | Script | flatpickr, flatpickr-culture | Date-range dropdown, see below |

| dompurify | Script | - | DOMPurify 3.4, jsDelivr fallback |

| highlightjs | Script and style | - | Highlight.js 11.12.0; the script is CDN only (cdnjs), the GitHub style has a local copy |

| technical-name-generator | Script | - | From @crestapps/ai-chat-ui |

| document-drop-zone | Script and style | - | From @crestapps/ai-chat-ui |

| chat-markers | Script | chart.js | window.CoreAIChatMarkers, turns [doc:N], [fig:N], [chart:{...}], [tbl:N] markers into citations, pictures, charts and tables |

| chat-image-carousel | Script and style | - | window.CoreAIChatImageCarousel, stacks two or more pictures of one answer into a swipeable carousel |

| realtime-audio | Script | signalr, dompurify | window.CoreAIRealtime, speech-to-speech audio controller |

| intl-tel-input | Script and style | - | intl-tel-input 29.5.3 with utils, jsDelivr fallback |

| sip.js | Script | - | sip.js 0.21.2 bundled to window.SIP, local only |

| telnyx-webrtc | Script | - | Telnyx WebRTC SDK bundled to window.TelnyxWebRTC, local only |

| fullcalendar | Script and style | - | FullCalendar 7.1.4 global build (script) and its skeleton CSS (style); local scripts are minified by the asset build (readable in debug mode), jsDelivr fallback with SRI |

| fullcalendar-locales | Script | fullcalendar | FullCalendar locales |

| fullcalendar-theme | Script and style | fullcalendar | The classic theme plugin and theme CSS; FullCalendar 7 draws nothing without a theme |

| fullcalendar-palette | Style | fullcalendar-theme | The classic theme palette |

| leaflet | Script and style | - | Leaflet 1.9.4, jsDelivr fallback with SRI |

| leaflet-markercluster, leaflet-markercluster-default | Script and styles | leaflet | Leaflet.markercluster 1.5.3 |

| leaflet-geoman | Script and style | leaflet | Geoman free 2.20.4 drawing tools |

| crestapps-map | Script | leaflet | Map wrapper that reads the site's tile settings from the map element, local only |

| d3 | Script | - | d3 7.9.0, local only |

| d3-flextree | Script | d3 | d3-flextree 2.1.2, local only |

| d3-org-chart | Script | d3, d3-flextree | d3-org-chart 3.1.1, organization charts with zoom, pan, expand and collapse (the staff organization chart, see orchardcore-staff), local only |

The AI chat resources come from the @crestapps/ai-chat-ui package. Their CDN URLs are built from the shared AIChatUiCdn.DistUrl constant (CrestApps.OrchardCore.Abstractions, AIChatUiCdn.Version is 2.0.0-preview.258 at the time of writing), so one constant moves every chat UI resource; local copies and SRI hashes are updated with it. The AIChatApp and ChatInteractionApp scripts declare dependencies on chat-markers, chat-image-carousel, realtime-audio and medium-zoom, so pages that require those apps need no change.

Register resources in Razor

<style asp-name="flatpickr"></style>
<script asp-name="flatpickr" at="Foot"></script>
<script asp-name="flatpickr-culture" at="Foot"></script>

<style asp-name="intl-tel-input"></style>
<script asp-name="intl-tel-input" at="Foot"></script>

<script asp-name="marked" at="Foot"></script>
<script asp-name="dompurify" at="Foot"></script>

Request chart.js by name rather than a cdn.jsdelivr.net URL so environments that prefer local assets keep working:

@model MyModule.ViewModels.ChartViewModel

<script asp-name="chart.js" at="Foot"></script>

<canvas id="@Model.CanvasId"></canvas>
<script at="Foot">
    new Chart(document.getElementById("@Model.CanvasId"), {
        type: "bar",
        data: @Html.Raw(Model.ChartDataJson)
    });
</script>

Date range picker

date-range-picker enhances two machine-formatted inputs (from and to) with one Bootstrap dropdown offering presets grouped into Relative days (Last 24 Hours, Today, Yesterday, Last 7/30/90 Days), Calendar periods (This/Last Week, Month, Quarter, Year), Rolling months (Last 3/6/12 Months), a Custom Range, and single On or before / On or after bounds. The toggle always shows the current selection as text. It is purely client-side and general purpose (the Reports module uses it).

Defaults: when a user opens an empty custom or single-bound panel, the picker seeds it with today's local date. Lower-bound inputs default to 00:00, upper-bound inputs to 23:59. Presets are computed in the browser with the culture's first day of week.

Render with the view component (recommended)

DateRangePickerViewComponent renders the full markup and requires its own resources.

@await Component.InvokeAsync("DateRangePicker", new
{
    fromName = Html.NameFor(m => m.From),
    toName = Html.NameFor(m => m.To),
    fromId = Html.IdFor(m => m.From),
    toId = Html.IdFor(m => m.To),
    from = Model.From,
    to = Model.To,
    selectedRangeName = Html.NameFor(m => m.Range),
    selectedRange = Model.Range,
    label = T["Date range"].Value,
})

| Parameter | Purpose |

|---|---|

| fromName / toName | Required. Posted field names for the bounds. |

| fromId / toId | Optional ids; derived from the names by default. |

| from / to | Optional DateTime? initial values, written as yyyy-MM-ddTHH:mm. |

| selectedRangeName / selectedRange | Optional hidden field name and value that persist the preset key (for example last30 or custom). |

| label, labelCssClass | Optional label; class defaults to form-label. |

| placeholder | Toggle text when nothing is selected; defaults to "Select range". |

| wrapperCssClass | Root classes; defaults to col p-1. |

| toggleCssClass | Toggle classes; defaults to form-select. Use form-select form-select-sm in dense filter forms. |

| allowAllTime | Offer All Time (key all), which clears both bounds; only for a form that accepts a range with neither bound. Defaults to false. |

Bind the bounds to DateTime? and the preset key to a string. Without selectedRangeName the picker falls back to Custom Range whenever initial values exist. For paginated list filters, also add the key to the driver's route values next to the bounds. Named presets keep the stored range and are not recomputed on reload.

Markup contract (manual rendering)

Require flatpickr (style and script), flatpickr-culture and date-range-picker. The script auto-initializes each [data-date-range-picker] element:

| Selector | Purpose |

|---|---|

| [data-date-range-picker] | Root; reads data-week-start (0 = Sunday), data-date-pattern, data-time-pattern, data-drp-initial, and localized data-prior-label, data-after-label, data-from-word, data-to-word |

| [data-drp-toggle] / [data-drp-label] | Dropdown toggle and its text; data-placeholder shows when empty |

| [data-drp-selected] | Optional hidden input receiving the preset key |

| input[type=radio][data-drp-range] | One per option; values last24Hours, today, yesterday, last7, last30, last90, thisWeek, lastWeek, thisMonth, lastMonth, last3Months, last6Months, last12Months, thisQuarter, lastQuarter, thisYear, lastYear, custom, prior, after, and all when All Time is offered |

| [data-drp-panel="custom"] | Holds the real submit inputs [data-drp-from] and [data-drp-to] |

| [data-drp-panel="prior"] | [data-drp-prior-date] sets only the to bound |

| [data-drp-panel="after"] | [data-drp-after-date] sets only the from bound |

The module's Views/Shared/Components/DateRangePicker/Default.cshtml is the complete, localized reference.

Item selector

ItemSelectorViewComponent renders a searchable <select> built on Orchard Core's bootstrap-select resource and the item-selector script. It requires bootstrap-select (which depends on bootstrap), so the page needs Orchard Core's OrchardCore.Resources feature.

@await Component.InvokeAsync("ItemSelector", new
{
    id = "agent-user-selector",
    inputName = Html.NameFor(m => m.UserName),
    endpoint = Model.UserSearchEndpoint,
    initialItemsJson = "[]",
    multiple = false,
    enableSearch = true,
    buttonText = T["Browse users"].Value,
    searchPlaceholder = T["Search users"].Value,
    emptyResultsText = T["No users found."].Value,
})

Shared pickers and shapes

| Name | Kind | Use |

|---|---|---|

| PartyPicker | View component | Pick parties of one or more kinds; values Kind:Id |

| RecordPicker | View component | Pick records of one kind (IRecordSource); values are ids or Kind:Id |

| FileDropInput | Shape | Drop, paste or browse files into a normal file input |

| PageSections | Shape | Group a record page's Content zone into side-list sections (AddPageSection) |

| TemplatedEmailTemplatesEditor | Shape | Settings editor for a module's templated emails |

@await DisplayAsync(await New.FileDropInput(InputName: "files", Target: "form"))

@await Component.InvokeAsync("RecordPicker", new
{
    name = Html.NameFor(m => m.ContentItemId).ToString(),
    kind = "Content",
    selectedValues = new[] { Model.ContentItemId },
})

Read shared components for every parameter, the search endpoints, adding an IRecordSource, page sections and confirm buttons.

Building the module's front-end assets

CrestApps.OrchardCore 3.0 replaced the Gulp pipeline with a Vite-based build in one npm workspace. Built wwwroot files are committed and included in the NuGet packages, so package consumers build nothing. Read references/building-assets.md when changing a module's scripts or styles, adding a library, or converting an Assets.json.

Quick reference (run at the repository root with Node.js 24 and npm 11):

npm install
npm run rebuild
npm run build -- -n date-range-picker.js
npm run watch -- -t Resources
npm run dry-run -- -t vendor

Add a shared resource to CrestApps Resources

When extending the module itself, add the source under Assets/, an Assets.json group, and the manifest entry together. A vite group writes both the readable and .min files; register both.

_manifest
    .DefineScript("example-widget")
    .SetUrl(
        "~/CrestApps.OrchardCore.Resources/scripts/example-widget.min.js",
        "~/CrestApps.OrchardCore.Resources/scripts/example-widget.js")
    .SetVersion("1.0.0");

Add SetCdn(...) and SetCdnIntegrity(...) only when a published artifact with a known hash exists. When bumping a vendored library, update the package version, local files, CDN URLs, version and hashes in one change.

Upgrading from 2.x

Troubleshooting

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.