Skip to content

Commit

Permalink
Fix Media Field dependency (#15017)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeAlhayek authored Jan 9, 2024
1 parent a35eda5 commit 19f61d9
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
<script asp-name="media" at="Foot"></script>
<style asp-name="media" at="Head"></style>

<script at="Foot">
<script at="Foot" asp-name="MediaFieldAppInitializer" depends-on="media">
initializeMediaApplication(false, '@Url.Action("MediaApplication", "Admin", new { area = "OrchardCore.Media" })', '@Context.Request.PathBase.ToString()');
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
<script asp-name="media" at="Foot"></script>
<style asp-name="media" at="Head"></style>

<script at="Foot">
<script at="Foot" asp-name="MediaFieldAppInitializer" depends-on="media">
initializeMediaApplication(false, '@Url.Action("MediaApplication", "Admin", new { area = "OrchardCore.Media" })', '@Context.Request.PathBase.ToString()');
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
<script asp-name="media" at="Foot"></script>
<style asp-name="media" at="Head"></style>

<script at="Foot">
<script at="Foot" asp-name="MediaFieldAppInitializer" depends-on="media">
initializeMediaApplication(false, '@Url.Action("MediaApplication", "Admin", new { area = "OrchardCore.Media" })', '@Context.Request.PathBase.ToString()');
</script>
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<script asp-name="media" at="Foot"></script>
<style asp-name="media" at="Head"></style>

<script at="Foot">
<script at="Foot" asp-name="MediaFieldAppInitializer" depends-on="media">
initializeMediaApplication(true, '@Url.Action("MediaApplication", "Admin", new { area = "OrchardCore.Media" })', '@Context.Request.PathBase.ToString()');
</script>

<script at="Foot">
@* mediaApp is absolutely positioned. When a warning is shown we need to move it down to avoid overlapping. *@
$(function () {
if (!$('.message').length) { return; };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
var mediaFieldId = Html.IdFor(m => m);
}

<script asp-name="media" at="Foot"></script>
<style asp-name="media" at="Head"></style>

<div class="@Orchard.GetFieldWrapperClasses(Model.PartFieldDefinition)" id="@Html.IdFor(x => x.Paths)_FieldWrapper">
Expand Down Expand Up @@ -65,6 +64,7 @@
<partial name="Shared/MediaFieldEditLocalization.cshtml" />
</div>

<script asp-name="media" at="Foot"></script>
<script at="Foot">
initializeAttachedMediaField(
document.getElementById('@mediaFieldId'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
var settings = Model.PartFieldDefinition.GetSettings<MediaFieldSettings>();
var modalMediaId = "Modal" + Html.IdFor(m => m);
}
<script asp-name="media" at="Foot"></script>
<style asp-name="media" at="Head"></style>

<div class="@Orchard.GetFieldWrapperClasses(Model.PartFieldDefinition)" id="@Html.IdFor(x => x.Paths)_FieldWrapper">
Expand Down Expand Up @@ -62,9 +61,12 @@
<partial name="Shared/MediaFieldEditLocalization.cshtml" />
</div>

<script at="Foot">
<script asp-name="media" at="Foot"></script>
<script at="Foot" asp-name="MediaFieldAppInitializer" depends-on="media">
initializeMediaApplication(false, '@Url.Action("MediaApplication", "Admin", new { area = "OrchardCore.Media", extensions = string.Join(',', Model.AllowedExtensions) })', '@Context.Request.PathBase.ToString()');
</script>

<script at="Foot">
initializeMediaField(
document.getElementById('@Html.IdFor(m => m)'),
document.getElementById('@Html.IdFor(m => m)-ModalBody'),
Expand Down

0 comments on commit 19f61d9

Please sign in to comment.