Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
<input asp-for="Url" name="Url" class="form-control ms-1 me-1" style="min-width:350px;" />
<span asp-validation-for="Url" class="text-danger"></span>
</div>
<button type="submit" class="btn btn-primary">@sr["Add Javascript Url"]</button>
<button type="submit" class="btn btn-primary">@sr["Add JavaScript Url"]</button>
</form>
Original file line number Diff line number Diff line change
@@ -1,9 +1,33 @@
@model cloudscribe.SimpleContent.Web.ViewModels.PageDevelopmentViewModel
@inject IPageRoutes pageRoutes
@inject IStringLocalizer<SimpleContent> sr
<h1>@ViewBag.Title <small><a href="@Url.RouteUrl(pageRoutes.PageRouteName, new { slug=Model.Slug })">@sr["Cancel"]</a></small></h1>
<p>@sr["With great power comes great responsibility. This page is intended for use by developers, for adding javscript and css into the page. Use this page only if you understand what you are doing."]</p>
<div>
<div class="d-flex justify-content-between align-items-center mb-3">
<h1>@ViewBag.Title</h1>
<a href="@Url.RouteUrl(pageRoutes.PageEditRouteName, new { slug=Model.Slug })" class="btn btn-secondary">@sr["Return to Page Editing"]</a>
</div>
<div class="alert alert-warning col-md-10 col-lg-8 py-2">
@sr["With great power comes great responsibility. This page is intended for use by developers, for adding javscript and css into the page. Use this page only if you understand what you are doing."]
</div>

<h2>@sr["Raw JavaScript"]</h2>
<div class="mb-4">
<form asp-controller="Page" asp-action="AddScriptResource" role="form">
<div class="mb-3">
<label asp-for="Script" class="form-label">@sr["Enter your JavaScript below. Do not include <script> tags."]</label>
<p>
@sr["Scripts are automatically validated for security - only safe DOM manipulation and event handling are permitted."] <br />
</p>
<input type="hidden" asp-for="Slug" />
<textarea asp-for="Script" class="form-control" rows="8" data-bs-toggle="tooltip"
title='@sr["Enter custom Javascript to run on your page. Do not include <script> tags."]'></textarea>
<span asp-validation-for="Script" class="invalid-feedback"></span>
</div>
<button type="submit" class="btn btn-primary">@sr["Save JavaScript"]</button>
</form>
</div>

<h2>@sr["JavaScript URLs"]</h2>
<div class="mb-4">
<table class="table table-striped table-hover">
<tr>
<th>@sr["Environment"]</th>
Expand Down Expand Up @@ -32,10 +56,10 @@
</td>
</tr>
</table>

</div>
<div>

<h2>@sr["CSS URLs"]</h2>
<div class="mb-4">
<table class="table table-striped table-hover">
<tr>
<th>@sr["Environment"]</th>
Expand Down Expand Up @@ -65,9 +89,8 @@
</tr>
</table>
</div>

@section Scripts {
<script src="~/cr/js/jquery.validate.min.js"></script>
<script src="~/cr/js/jquery.validate.unobtrusive.min.js"></script>

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
}
@if (showDev)
{
<a class="btn btn-primary" asp-route="@pageRoutes.PageDevelopRouteName" asp-route-slug="@Model.Slug">@sr["Developer Tools"]</a>
<a class="btn btn-primary" asp-route="@pageRoutes.PageDevelopRouteName" asp-route-slug="@Model.Slug" data-unsaved-warning="@sr["You have unsaved changes in the editor. Are you sure you want to navigate to Developer Tools? Your changes will be lost."]">@sr["Developer Tools"]</a>
}

</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ else
}
}
<script src="/csscsr/js/edit-script.js"></script>
<script src="/csscsr/js/unsaved-changes-warning.js"></script>
<partial name="SummernoteScripts" />
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
}
@if (showDev)
{
<a class="btn btn-primary" asp-route="@pageRoutes.PageDevelopRouteName" asp-route-slug="@Model.Slug">@sr["Developer Tools"]</a>
<a class="btn btn-primary" asp-route="@pageRoutes.PageDevelopRouteName" asp-route-slug="@Model.Slug" data-unsaved-warning="@sr["You have unsaved changes in the editor. Are you sure you want to navigate to Developer Tools? Your changes will be lost."]">@sr["Developer Tools"]</a>
}

</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
}
<script src="~/cr/js/bootstrap-tooltip-toggle.js"></script>
<script src="/csscsr/js/edit-script.js"></script>
<script src="/csscsr/js/unsaved-changes-warning.js"></script>
<partial name="SummernoteScripts" />
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
@model cloudscribe.SimpleContent.Web.ViewModels.PageViewModel
<script src="~/cr/js/ckeditor4114/plugins/codesnippet/lib/highlight/highlight.pack.js"></script>
<script src="~/cr/js/syntax-highlight-init.js"></script>

@if (Model.CurrentPage?.Script != null && !string.IsNullOrWhiteSpace(Model.CurrentPage.Script))
{
<script src="@Url.Action("InlineScript", "Page", new { pageId = Model.CurrentPage.Id, v = Model.CurrentPage.LastModified.Ticks })"></script>
}
2 changes: 1 addition & 1 deletion src/cloudscribe.SimpleContent.Models/Blog/Post.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,6 @@ public static Post FromIPost(IPost post)
post.CopyTo(p);
return p;
}

public string Script { get; set; }
}
}
2 changes: 1 addition & 1 deletion src/cloudscribe.SimpleContent.Models/IContentItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ public interface IContentItem
string Content { get; set; }
DateTime? PubDate { get; set; }
string MetaDescription { get; set; }

string Script { get; set; }
}
}
1 change: 1 addition & 0 deletions src/cloudscribe.SimpleContent.Models/ModelExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ public static void CopyTo(this IPage input, IPage target)
target.ShowCreatedDate = input.ShowCreatedDate;
target.ShowLastModifiedBy = input.ShowLastModifiedBy;
target.ShowLastModifiedDate = input.ShowLastModifiedDate;
target.Script = input.Script;
}

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions src/cloudscribe.SimpleContent.Models/Page/IPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,6 @@ public interface IPage : IContentItem
public bool? ShowCreatedDate { get; set; }
public bool? ShowLastModifiedBy { get; set; }
public bool? ShowLastModifiedDate { get; set; }
public string? Script { get; set; }
}
}
1 change: 1 addition & 0 deletions src/cloudscribe.SimpleContent.Models/Page/Page.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,6 @@ public static Page FromIPage(IPage page)
public bool? ShowCreatedDate { get; set; }
public bool? ShowLastModifiedBy { get; set; }
public bool? ShowLastModifiedDate { get; set; }
public string? Script { get; set; }
}
}
1 change: 0 additions & 1 deletion src/cloudscribe.SimpleContent.Models/Page/PageResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public PageResource()
public string Id { get; set; }
public string ContentId { get; set; }
public int Sort { get; set; } = 1;

public string Type { get; set; }
public string Environment { get; set; }
public string Url { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,5 +233,6 @@ public static PageEntity FromIPage(IPage page)
public bool? ShowCreatedDate { get; set; }
public bool? ShowLastModifiedBy { get; set; }
public bool? ShowLastModifiedDate { get; set; }
public string Script { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ public string PageEntityId
get { return pageEntityId; }
set { pageEntityId = value; }
}

public int Sort { get; set; } = 1;

public string Type { get; set; }
public string Environment { get; set; }
public string Url { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,6 @@ public static PostEntity FromIPost(IPost post)
post.CopyTo(p);
return p;
}

public string Script { get; set; }
}
}
Loading