mirror of https://github.com/abpframework/abp.git
17 changed files with 585 additions and 17 deletions
@ -0,0 +1,40 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.Domain.Entities; |
||||
|
|
||||
|
namespace Volo.Docs.Admin.Documents |
||||
|
{ |
||||
|
[Serializable] |
||||
|
public class DocumentDto : EntityDto<Guid> |
||||
|
{ |
||||
|
public virtual Guid ProjectId { get; protected set; } |
||||
|
|
||||
|
public virtual string Name { get; protected set; } |
||||
|
|
||||
|
public virtual string Version { get; protected set; } |
||||
|
|
||||
|
public virtual string LanguageCode { get; protected set; } |
||||
|
|
||||
|
public virtual string FileName { get; set; } |
||||
|
|
||||
|
public virtual string Content { get; set; } |
||||
|
|
||||
|
public virtual string Format { get; set; } |
||||
|
|
||||
|
public virtual string EditLink { get; set; } |
||||
|
|
||||
|
public virtual string RootUrl { get; set; } |
||||
|
|
||||
|
public virtual string RawRootUrl { get; set; } |
||||
|
|
||||
|
public virtual string LocalDirectory { get; set; } |
||||
|
|
||||
|
public virtual DateTime CreationTime { get; set; } |
||||
|
|
||||
|
public virtual DateTime LastUpdatedTime { get; set; } |
||||
|
|
||||
|
public virtual DateTime? LastSignificantUpdateTime { get; set; } |
||||
|
|
||||
|
public virtual DateTime LastCachedTime { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Docs.Documents; |
||||
|
|
||||
|
namespace Volo.Docs.Admin.Documents |
||||
|
{ |
||||
|
public class GetAllInput : PagedAndSortedResultRequestDto |
||||
|
{ |
||||
|
public Guid? ProjectId { get; set; } |
||||
|
|
||||
|
[StringLength(DocumentConsts.MaxNameLength)] |
||||
|
public string Name { get; set; } |
||||
|
|
||||
|
[StringLength(DocumentConsts.MaxLanguageCodeNameLength)] |
||||
|
public string LanguageCode { get; set; } |
||||
|
|
||||
|
[StringLength(DocumentConsts.MaxVersionNameLength)] |
||||
|
public string Version { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,52 @@ |
|||||
|
@page |
||||
|
@using Microsoft.AspNetCore.Authorization |
||||
|
@using Volo.Abp.AspNetCore.Mvc.UI.Layout |
||||
|
@using Volo.Docs.Admin |
||||
|
@using Volo.Docs.Admin.Navigation |
||||
|
@using Microsoft.AspNetCore.Mvc.Localization |
||||
|
@using Volo.Docs.Localization |
||||
|
@model Volo.Docs.Admin.Pages.Docs.Admin.Documents.IndexModel |
||||
|
@inject IHtmlLocalizer<DocsResource> L |
||||
|
@inject IAuthorizationService Authorization |
||||
|
@{ |
||||
|
ViewBag.PageTitle = L["Menu:Documents"]; |
||||
|
} |
||||
|
@inject IPageLayout PageLayout |
||||
|
@{ |
||||
|
PageLayout.Content.Title = L["Documents"].Value; |
||||
|
PageLayout.Content.BreadCrumb.Add(L["Menu:DocumentManagement"].Value); |
||||
|
PageLayout.Content.MenuItemName = DocsMenuNames.Documents; |
||||
|
} |
||||
|
|
||||
|
@section scripts { |
||||
|
<abp-script src="/Pages/Docs/Admin/Documents/index.js" /> |
||||
|
} |
||||
|
|
||||
|
<abp-card> |
||||
|
<abp-card-header> |
||||
|
<abp-row> |
||||
|
<h2>Filters ...</h2> |
||||
|
@*<abp-column size-md="_6" class="text-right"> |
||||
|
<abp-button button-type="Primary" icon="plus" text="@L["ReIndexAllProjects"].Value" id="ReIndexAllProjects" /> |
||||
|
</abp-column>*@ |
||||
|
</abp-row> |
||||
|
</abp-card-header> |
||||
|
<abp-card-body> |
||||
|
<abp-table striped-rows="true" id="DocumentsTable" class="nowrap"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th>@L["Actions"]</th> |
||||
|
<th>@L["Name"]</th> |
||||
|
<th>@L["Version"]</th> |
||||
|
<th>@L["LanguageCode"]</th> |
||||
|
<th>@L["FileName"]</th> |
||||
|
<th>@L["Format"]</th> |
||||
|
<th>@L["CreationTime"]</th> |
||||
|
<th>@L["LastUpdatedTime"]</th> |
||||
|
<th>@L["LastSignificantUpdateTime"]</th> |
||||
|
<th>@L["LastCachedTime"]</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
</abp-table> |
||||
|
</abp-card-body> |
||||
|
</abp-card> |
||||
@ -0,0 +1,15 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
|
||||
|
namespace Volo.Docs.Admin.Pages.Docs.Admin.Documents |
||||
|
{ |
||||
|
[Authorize(DocsAdminPermissions.Projects.Default)] |
||||
|
public class IndexModel : DocsAdminPageModel |
||||
|
{ |
||||
|
public virtual Task<IActionResult> OnGet() |
||||
|
{ |
||||
|
return Task.FromResult<IActionResult>(Page()); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,153 @@ |
|||||
|
$(function () { |
||||
|
|
||||
|
var l = abp.localization.getResource('Docs'); |
||||
|
|
||||
|
var _dataTable = $('#DocumentsTable').DataTable(abp.libs.datatables.normalizeConfiguration({ |
||||
|
processing: true, |
||||
|
serverSide: true, |
||||
|
scrollX: true, |
||||
|
paging: true, |
||||
|
searching: false, |
||||
|
autoWidth: false, |
||||
|
scrollCollapse: true, |
||||
|
ajax: abp.libs.datatables.createAjax(volo.docs.admin.documentsAdmin.getAll), |
||||
|
columnDefs: [ |
||||
|
{ |
||||
|
rowAction: { |
||||
|
items: |
||||
|
[ |
||||
|
{ |
||||
|
text: l('RemoveFromCache'), |
||||
|
visible: abp.auth.isGranted('Docs.Admin.Documents'), |
||||
|
confirmMessage: function (data) { return l('RemoveFromCacheConfirmation'); }, |
||||
|
action: function (data) { |
||||
|
volo.docs.admin.documentsAdmin |
||||
|
.removeFromCache(data.record.id) |
||||
|
.then(function () { |
||||
|
abp.message.success(l('RemovedFromCache')); |
||||
|
_dataTable.ajax.reload(); |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
text: l('ReIndex'), |
||||
|
visible: abp.auth.isGranted('Docs.Admin.Documents'), |
||||
|
confirmMessage: function (data) { return l('ReIndexDocumentConfirmation'); }, |
||||
|
action: function (data) { |
||||
|
volo.docs.admin.documentsAdmin |
||||
|
.reindex(data.record.id) |
||||
|
.then(function () { |
||||
|
abp.message.success(l('ReindexCompleted')); |
||||
|
_dataTable.ajax.reload(); |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
text: l('DeleteFromDatabase'), |
||||
|
visible: abp.auth.isGranted('Docs.Admin.Documents'), |
||||
|
confirmMessage: function (data) { return l('DeleteDocumentFromDbConfirmation'); }, |
||||
|
action: function (data) { |
||||
|
volo.docs.admin.documentsAdmin |
||||
|
.deleteFromDatabase(data.record.id) |
||||
|
.then(function () { |
||||
|
abp.message.success(l('Deleted')); |
||||
|
_dataTable.ajax.reload(); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
target: 1, |
||||
|
data: "name" |
||||
|
}, |
||||
|
{ |
||||
|
target: 2, |
||||
|
data: "version" |
||||
|
}, |
||||
|
{ |
||||
|
target: 3, |
||||
|
data: "languageCode" |
||||
|
}, |
||||
|
{ |
||||
|
target: 4, |
||||
|
data: "fileName" |
||||
|
}, |
||||
|
{ |
||||
|
target: 5, |
||||
|
data: "format", |
||||
|
render: function (data) { |
||||
|
if (data === 'md') { |
||||
|
return 'markdown'; |
||||
|
} |
||||
|
|
||||
|
return data; |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
target: 6, |
||||
|
data: "creationTime", |
||||
|
render: function (creationTime) { |
||||
|
if (!creationTime) { |
||||
|
return ""; |
||||
|
} |
||||
|
|
||||
|
var date = Date.parse(creationTime); |
||||
|
return (new Date(date)).toLocaleDateString(abp.localization.currentCulture.name); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
target: 7, |
||||
|
data: "lastUpdatedTime", |
||||
|
render: function (lastUpdatedTime) { |
||||
|
if (!lastUpdatedTime) { |
||||
|
return ""; |
||||
|
} |
||||
|
|
||||
|
var date = Date.parse(lastUpdatedTime); |
||||
|
return (new Date(date)).toLocaleDateString(abp.localization.currentCulture.name); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
target: 8, |
||||
|
data: "lastSignificantUpdateTime", |
||||
|
render: function (lastSignificantUpdateTime) { |
||||
|
if (!lastSignificantUpdateTime) { |
||||
|
return ""; |
||||
|
} |
||||
|
|
||||
|
var date = Date.parse(lastSignificantUpdateTime); |
||||
|
return (new Date(date)).toLocaleDateString(abp.localization.currentCulture.name); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
target: 9, |
||||
|
data: "lastCachedTime", |
||||
|
render: function (lastCachedTime) { |
||||
|
if (!lastCachedTime) { |
||||
|
return ""; |
||||
|
} |
||||
|
|
||||
|
var date = Date.parse(lastCachedTime); |
||||
|
return (new Date(date)).toLocaleDateString(abp.localization.currentCulture.name); |
||||
|
} |
||||
|
} |
||||
|
] |
||||
|
})); |
||||
|
|
||||
|
|
||||
|
$("#ReIndexAllProjects").click(function (event) { |
||||
|
abp.message.confirm(l('ReIndexAllProjectConfirmationMessage')) |
||||
|
.done(function (accepted) { |
||||
|
if (accepted) { |
||||
|
volo.docs.admin.projectsAdmin |
||||
|
.reindexAll() |
||||
|
.then(function () { |
||||
|
abp.message.success(l('SuccessfullyReIndexAllProject')); |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
}); |
||||
Loading…
Reference in new issue