Skip to content

Commit

Permalink
Asset Manager Parcel prod.js -> min.js (#17552)
Browse files Browse the repository at this point in the history
  • Loading branch information
Skrypt authored Mar 7, 2025
1 parent 827037f commit c364605
Show file tree
Hide file tree
Showing 50 changed files with 289 additions and 261 deletions.
4 changes: 2 additions & 2 deletions .scripts/assets-manager/parcel.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ function buildParcelOptions(command, assetConfig) {
/**
* Processes JavaScript files in the specified asset configuration destination,
* removing source mapping URL comments and creating corresponding production
* JavaScript files with the ".prod.js" extension.
* JavaScript files with the ".min.js" extension.
*
* @param {Object} assetConfig - The asset configuration object.
* @param {string} assetConfig.dest - The directory containing JavaScript files to process.
Expand All @@ -184,7 +184,7 @@ const createProdJsFile = async (assetConfig) => {
});

const newContent = lines.join("\n");
const prodFilePath = filePath.replace(/\.js$/, ".prod.js");
const prodFilePath = filePath.replace(/\.js$/, ".min.js");
await fs.writeFile(prodFilePath, newContent);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@model AuditTrailListViewModel

<script asp-name="bootstrap-select" depends-on="bootstrap" at="Foot"></script>
<script asp-name="bootstrap-select" at="Foot" depends-on="admin"></script>
<style asp-name="audittrailui" asp-src="~/OrchardCore.AuditTrail/Styles/audittrailui.min.css" debug-src="~/OrchardCore.AuditTrail/Styles/audittrailui.css" at="Head"></style>

<!-- Hidden submit button do not remove -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@

@await DisplayAsync(Model.Pager)

<script asp-name="bootstrap-select" depends-on="bootstrap" at="Foot"></script>
<script asp-name="bootstrap-select" at="Foot" depends-on="admin"></script>

<script at="Foot">
$(function () {
Expand Down
7 changes: 7 additions & 0 deletions src/OrchardCore.Modules/OrchardCore.ContentTypes/Assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,12 @@
"name": "content-types",
"source": "Assets/js/list-items-filter.js",
"tags": ["admin", "dashboard", "js"]
},
{
"action": "parcel",
"name": "autocomplete",
"source": "Assets/js/autocomplete.ts",
"dest": "wwwroot/Scripts/autocomplete",
"tags": ["admin", "dashboard", "js"]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { getTechnicalName } from '@orchardcore/theadmin/js/TheAdmin/TheAdmin';

const nameElement = document.querySelector('[data-name]') as HTMLInputElement;
const displayNameElement = document.querySelector('[data-displayname]') as HTMLInputElement;

let nameAltered = false;

nameElement.addEventListener('keydown', () => {
nameAltered = true;
});

const compute = () => {
// stop processing automatically if altered by the user
if (nameAltered) {
return true;
}

nameElement.value = getTechnicalName(displayNameElement.value);
};

displayNameElement.addEventListener('keyup', compute);
displayNameElement.addEventListener('blur', compute);
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,23 @@
var returnUrl = ViewData["returnUrl"]?.ToString();
}

<script asp-src="~/OrchardCore.ContentTypes/Scripts/autocomplete/autocomplete.js" at="Foot" depends-on="jQuery"></script>
<zone Name="Title"><h1>@RenderTitleSegments(T["Add New Field To \"{0}\"", Model.Part.DisplayName()])</h1></zone>

<form asp-action="AddFieldTo" asp-route-returnUrl="@ViewData["returnUrl"]">
@Html.ValidationSummary()
<div class="mb-3">
<div class="w-md-75 w-xl-50">
<label asp-for="DisplayName" class="form-label">@T["Display Name"]</label>
<input asp-for="DisplayName" class="form-control" autofocus />
<input data-displayname="@Html.IdFor(m => m.DisplayName)" asp-for="DisplayName" class="form-control" autofocus />
</div>
<span class="hint">@T["Name of the field as it will be displayed in screens."]</span>
</div>

<div class="mb-3">
<div class="w-sm-75 w-lg-75 w-xl-50">
<label asp-for="Name" class="form-label">@T["Technical Name"]</label>
<input asp-for="Name" class="form-control" />
<input data-name="@Html.IdFor(m => m.DisplayName)" asp-for="Name" class="form-control" />
</div>
<span class="hint">@T["Technical name of the field."]</span>
</div>
Expand Down Expand Up @@ -50,29 +51,3 @@
}
</div>
</form>

<script at="Foot">
//<![CDATA[
$(function () {
var $name = $("#@Html.IdFor(m => m.Name)");
var $displayName = $("#@Html.IdFor(m => m.DisplayName)");
var nameAltered;
$name.keydown(function () {
nameAltered = true;
});
var compute = function () {
// stop processing automatically if altered by the user
if (nameAltered) {
return true;
}
$name.val(getTechnicalName($displayName.val()));
};
$displayName.keyup(compute);
$displayName.blur(compute);
})
//]]>
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
@{
int i = 0;
}

<script asp-src="~/OrchardCore.ContentTypes/Scripts/autocomplete/autocomplete.js" at="Foot" depends-on="jQuery"></script>
<zone Name="Title"><h1>@T["Add Named Part To \"{0}\"", Model.Type.DisplayName]</h1></zone>

<form asp-action="AddReusablePartTo">
Expand All @@ -11,14 +13,14 @@
@if (Model.PartSelections.Any())
{
<div class="mb-3">
<label asp-for="DisplayName" class="form-label">@T["Display Name"]</label>
<label data-displayname="@Html.IdFor(m => m.DisplayName)" asp-for="DisplayName" class="form-label">@T["Display Name"]</label>
<input asp-for="DisplayName" class="form-control" autofocus />
<span class="hint">@T["Name of the reusable part as it will be displayed in screens."]</span>
</div>

<div class="mb-3">
<label asp-for="Name" class="form-label">@T["Technical Name"]</label>
<input asp-for="Name" class="form-control" />
<input data-name="@Html.IdFor(m => m.DisplayName)" asp-for="Name" class="form-control" />
<span class="hint">@T["Technical name of the reusable part."]</span>
</div>

Expand Down Expand Up @@ -59,28 +61,3 @@
</div>
</form>

<script at="Foot">
//<![CDATA[
$(function () {
var $name = $("#@Html.IdFor(m => m.Name)");
var $displayName = $("#@Html.IdFor(m => m.DisplayName)");
var nameAltered;
$name.keydown(function () {
nameAltered = true;
});
var compute = function () {
// stop processing automatically if altered by the user
if (nameAltered) {
return true;
}
$name.val(getTechnicalName($displayName.val()));
};
$displayName.keyup(compute);
$displayName.blur(compute);
})
//]]>
</script>
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
@model CreateTypeViewModel

<script asp-src="~/OrchardCore.ContentTypes/Scripts/autocomplete/autocomplete.js" at="Foot" depends-on="jQuery"></script>
<zone Name="Title"><h1>@RenderTitleSegments(T["New Content Type"])</h1></zone>

<form asp-action="Create">
@Html.ValidationSummary()

<div class="mb-3">
<label asp-for="DisplayName" class="form-label">@T["Display Name"]</label>
<input asp-for="DisplayName" class="form-control w-md-75 w-xl-50" autofocus />
<input data-displayname="@Html.IdFor(m => m.DisplayName)" asp-for="DisplayName" class="form-control w-md-75 w-xl-50" autofocus />
<span class="hint">@T["Name of the type as it will be displayed on screens."]</span>
</div>

<div class="mb-3">
<label asp-for="Name" class="form-label">@T["Technical Name"]</label>
<input asp-for="Name" class="form-control w-md-75 w-xl-50" />
<input data-name="@Html.IdFor(m => m.DisplayName)" asp-for="Name" class="form-control w-md-75 w-xl-50" />
<span class="hint">@T["Technical name of the type."]</span>
</div>

Expand All @@ -22,28 +23,4 @@
</div>
</form>

<script at="Foot">
//<![CDATA[
$(function () {
var $name = $("#@Html.IdFor(m => m.Name)");
var $displayName = $("#@Html.IdFor(m => m.DisplayName)");

var nameAltered;
$name.keydown(function () {
nameAltered = true;
});
var compute = function () {
// stop processing automatically if altered by the user
if (nameAltered) {
return true;
}
$name.val(getTechnicalName($displayName.val()));
};
$displayName.keyup(compute);
$displayName.blur(compute);
})
//]]>
</script>

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@model ListContentsViewModel

<script asp-name="bootstrap-select" depends-on="bootstrap" at="Foot"></script>
<script asp-name="bootstrap-select" at="Foot" depends-on="admin"></script>

<!-- Hidden submit button do not remove -->
<input type="submit" name="submit.Filter" id="submitFilter" class="visually-hidden" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
int startIndex = (Model.Pager.Page - 1) * (Model.Pager.PageSize) + 1;
int endIndex = startIndex + Model.DeploymentPlans.Count - 1;
}
<script asp-name="bootstrap-select" depends-on="bootstrap" at="Foot"></script>
<script asp-name="bootstrap-select" at="Foot" depends-on="admin"></script>

<zone Name="Title"><h1>@RenderTitleSegments(T["Deployment Plans"])</h1></zone>

Expand Down
Loading

0 comments on commit c364605

Please sign in to comment.