| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- @using Masuit.MyBlogs.Core.Common
- @using Masuit.MyBlogs.Core.Models.DTO
- @using Masuit.MyBlogs.Core.Models.Entity
- @using Masuit.MyBlogs.Core.Models.ViewModel
- @using Masuit.Tools.Core.Net
- @model Masuit.MyBlogs.Core.Models.Entity.PostHistoryVersion
- @{
- ViewBag.Title = Model.Post.Title + "于" + Model.ModifyDate.ToTimeZoneF(Context.Session.Get<string>(SessionKey.TimeZone)) + "的历史版本:" + Model.Title;
- Layout = "~/Views/Shared/_Layout.cshtml";
- string[] colors = { "success", "info", "primary", "warning", "danger", "default", "primary" };
- AdvertisementDto ad = ViewBag.Ads;
- }
- <environment names="Development">
- <link href="~/Assets/jquery.tocify/jquery.tocify.css" rel="stylesheet" />
- <link href="~/Assets/UEditor/third-party/SyntaxHighlighter/styles/shCore.css" rel="stylesheet" />
- <script src="/Assets/UEditor/third-party/SyntaxHighlighter/scripts/shCore.js"></script>
- <script src="/Assets/UEditor/third-party/SyntaxHighlighter/scripts/bundle.min.js"></script>
- <script src="/Assets/jquery.tocify/jquery.tocify.js"></script>
- <script src="/Scripts/global/article.js"></script>
- </environment>
- <environment names="Stage,Production">
- @await Styles.RenderAsync("/bundles/article.css")
- @await Scripts.RenderAsync("/bundles/article.js")
- </environment>
- <div class="container">
- <ol class="cd-breadcrumb triangle">
- <li><a asp-controller="Home" asp-action="Index">首页</a></li>
- <li><a asp-controller="Home" asp-action="Post">文章列表</a></li>
- @if(Model.Category.ParentId>0) {
- if(Model.Category.Parent.ParentId>0) {
- <li><a asp-controller="Home" asp-action="Category" asp-route-id="@Model.Category.Parent.ParentId">@Model.Category.Parent.Parent.Name</a></li>
- }
- <li><a asp-controller="Home" asp-action="Category" asp-route-id="@Model.Category.ParentId">@Model.Category.Parent.Name</a></li>
- }
- <li><a asp-controller="Home" asp-action="Category" asp-route-id="@Model.CategoryId">@Model.Category.Name</a></li>
- <li>@Html.ActionLink(Model.Post.Title.Length > 20 ? Model.Post.Title.Substring(0, 20) + "..." : Model.Post.Title, "Details", "Post", new { id = Model.PostId }, null)</li>
- <li><a asp-controller="Post" asp-action="History" asp-route-id="@Model.PostId">历史版本</a></li>
- <li class="current"><em>@(Model.Title.Length > 35 ? Model.Title.Substring(0, 35) + "..." : Model.Title)</em></li>
- </ol>
- <div class="wrapper-content article">
- <div class="ibox">
- <div class="ibox-content animated fadeIn">
- <main>
- <section class="history">
- <header class="page-header">
- <div class="text-center">
- <a>
- <h2 class="padding-bot10">
- @Model.Title
- </h2>
- </a>
- </div>
- <div class="row">
- <div class="col-sm-7">
- <div class="padding-bot10">
- <span class="label label-@colors[new Random().Next() % colors.Length]">@Model.Modifier</span>修改于<a asp-controller="Home" asp-action="Archieve" asp-route-yyyy="@Model.ModifyDate.Year" asp-route-mm="@Model.ModifyDate.Month" asp-route-dd="@Model.ModifyDate.Day" asp-route-mode="@nameof(Model.ModifyDate)"><time class="text-success">@Model.ModifyDate.ToTimeZoneF(Context.Session.Get<string>(SessionKey.TimeZone))</time></a> |
- 原分类:<i class="icon-map-pin"></i><a asp-controller="Home" asp-action="Category" asp-route-id="@Model.CategoryId" class="label label-@colors[new Random().Next() % colors.Length]">@Model.Category.Name</a>
- @if (Model.Seminar.Any())
- {
- <span> | 原所属专题:</span>
- var seminars = Model.Seminar;
- foreach (var s in seminars)
- {
- <a asp-controller="Seminar" asp-action="Index" asp-route-id="@s.Id" class="label label-@colors[new Random().Next() % colors.Length]">@s.Title</a><text> </text>
- }
- }
- <div class="btn-group">
- <button class="btn btn-danger btn-sm" id="del">删除此版本</button>
- <button class="btn btn-info btn-sm" id="revert">还原到此版本</button>
- </div>
- </div>
- </div>
- @{
- if (!string.IsNullOrEmpty(Model.Label))
- {
- <div class="pull-right margin-right20">
- <div>
- @foreach (string s in Model.Label.Split(',', ',', ' '))
- {
- if (!string.IsNullOrEmpty(s))
- {
- <a asp-controller="Home" asp-action="Tag" asp-route-tag="@s">
- <span class="label label-@colors[new Random().Next() % colors.Length]">@s</span>
- </a>
- }
- }
- </div>
- </div>
- }
- }
- </div>
- <p class="text-focus text-center">您目前正在查看该文章的历史版本,文章的历史版本可能无法为您提供最准确及时的资讯,不具备任何参考价值,<a asp-controller="Post" asp-action="Details" asp-route-id="@Model.PostId">点击前往</a>该文章的最新版本。</p>
- </header>
- <article class="article" id="article">
- @Html.Raw(Model.Content)
- @Html.Raw(Model.ProtectContent)
- </article>
- <div id="cyReward" role="cylabs" data-use="reward"></div>
- </section>
- </main>
- <hr />
- <section class="wow fadeInUp row size16">
- <div class="col-xs-6">
- 前一版本:
- @{
- PostHistoryVersion prev = ViewBag.Prev;
- if (prev != null)
- {
- <a asp-controller="Post" asp-action="HistoryVersion" asp-route-id="@prev.PostId" asp-route-hid="@prev.Id">@prev.Title</a>
- }
- else
- {
- <a>没有了</a>
- }
- }
- </div>
- <div class="col-xs-6 text-right">
- 下一版本:
- @{
- PostHistoryVersion next = ViewBag.Next;
- if (next != null)
- {
- <a asp-controller="Post" asp-action="HistoryVersion" asp-route-id="@next.PostId" asp-route-hid="@next.Id">@next.Title</a>
- }
- else
- {
- <a>没有了</a>
- }
- }
- </div>
- </section>
- <hr class="margin-top10 marginbot10" />
- @if (ad != null)
- {
- await Html.RenderPartialAsync("_ArticleListAdvertisement", ad);
- }
- </div>
- </div>
- </div>
- </div>
- <script>
- $(function() {
- $("#toc").show();
- var toc = $("#toc").tocify({
- selectors: ".ibox-content h3,.ibox-content h4,.ibox-content h5"
- }).data("toc-tocify");
- $(".tocify>.close").on("click", function(e) {
- $(this).parent().hide();
- });
- SyntaxHighlighter.all();
- SyntaxHighlighter.defaults['toolbar'] = false;
- $("#del").on("click", function (e) {
- swal({
- title: "确认删除这个版本吗?",
- text: '@Model.Title',
- showCancelButton: true,
- confirmButtonColor: "#DD6B55",
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- showLoaderOnConfirm: true,
- animation: true,
- allowOutsideClick: false
- }).then(function () {
- $.post("/post/DeleteHistory", {
- id: @Model.Id
- }, function (data) {
- window.notie.alert({
- type: 1,
- text: data.Message,
- time: 4
- });
- location.href="/@Model.PostId/history";
- });
- }, function () {
- });
- });
- $("#revert").on("click", function (e) {
- swal({
- title: "确认还原到这个版本吗?",
- text: '@Model.Title',
- showCancelButton: true,
- confirmButtonColor: "#DD6B55",
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- showLoaderOnConfirm: true,
- animation: true,
- allowOutsideClick: false
- }).then(function () {
- $.post("/post/revert", {
- id: @Model.Id
- }, function (data) {
- window.notie.alert({
- type: 1,
- text: data.Message,
- time: 4
- });
- location.href="/@Model.PostId";
- });
- }, function () {
- });
- });
- })
- </script>
|