mirror of https://github.com/abpframework/abp.git
12 changed files with 184 additions and 43 deletions
@ -0,0 +1,22 @@ |
|||||
|
@page |
||||
|
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal |
||||
|
@using Volo.Docs.Admin.Pages.Docs.Admin.Projects |
||||
|
@inherits Volo.Docs.Admin.Pages.Docs.Admin.DocsAdminPage |
||||
|
@model Volo.Docs.Admin.Pages.Docs.Admin.Projects.PullModel |
||||
|
@{ |
||||
|
Layout = null; |
||||
|
} |
||||
|
|
||||
|
@if (Model.PullDocument != null) |
||||
|
{ |
||||
|
<abp-dynamic-form submit-button="false" abp-model="@Model.PullDocument" asp-page="/Docs/Admin/Projects/Pull"> |
||||
|
<abp-modal size="@(AbpModalSize.Default)"> |
||||
|
<abp-modal-header title="@L["Pull"].Value"></abp-modal-header> |
||||
|
<abp-modal-body> |
||||
|
<abp-form-content /> |
||||
|
</abp-modal-body> |
||||
|
<abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"> |
||||
|
</abp-modal-footer> |
||||
|
</abp-modal> |
||||
|
</abp-dynamic-form> |
||||
|
} |
||||
@ -0,0 +1,75 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Volo.Docs.Admin.Documents; |
||||
|
using Volo.Docs.Admin.Projects; |
||||
|
using Volo.Docs.Documents; |
||||
|
|
||||
|
namespace Volo.Docs.Admin.Pages.Docs.Admin.Projects |
||||
|
{ |
||||
|
public class PullModel : DocsAdminPageModel |
||||
|
{ |
||||
|
[BindProperty] |
||||
|
public PullDocumentViewModel PullDocument { get; set; } |
||||
|
|
||||
|
private readonly IProjectAdminAppService _projectAppService; |
||||
|
private readonly IDocumentAdminAppService _documentAppService; |
||||
|
|
||||
|
public PullModel(IProjectAdminAppService projectAppService, |
||||
|
IDocumentAdminAppService documentAppService) |
||||
|
{ |
||||
|
_projectAppService = projectAppService; |
||||
|
_documentAppService = documentAppService; |
||||
|
} |
||||
|
|
||||
|
public async Task<ActionResult> OnGetAsync(Guid id) |
||||
|
{ |
||||
|
var project = await _projectAppService.GetAsync(id); |
||||
|
|
||||
|
PullDocument = new PullDocumentViewModel() |
||||
|
{ |
||||
|
ProjectId = project.Id, |
||||
|
All = false |
||||
|
}; |
||||
|
|
||||
|
return Page(); |
||||
|
} |
||||
|
|
||||
|
public async Task<IActionResult> OnPostAsync() |
||||
|
{ |
||||
|
if (PullDocument.All) |
||||
|
{ |
||||
|
await _documentAppService.PullAllAsync( |
||||
|
ObjectMapper.Map<PullDocumentViewModel, PullAllDocumentInput>(PullDocument)); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
await _documentAppService.PullAsync( |
||||
|
ObjectMapper.Map<PullDocumentViewModel, PullDocumentInput>(PullDocument)); |
||||
|
} |
||||
|
|
||||
|
return NoContent(); |
||||
|
} |
||||
|
|
||||
|
public class PullDocumentViewModel |
||||
|
{ |
||||
|
[HiddenInput] |
||||
|
public Guid ProjectId { get; set; } |
||||
|
|
||||
|
public bool All { get; set; } |
||||
|
|
||||
|
[Required] |
||||
|
[StringLength(DocumentConsts.MaxNameLength)] |
||||
|
public string Name { get; set; } |
||||
|
|
||||
|
[Required] |
||||
|
[StringLength(DocumentConsts.MaxLanguageCodeNameLength)] |
||||
|
public string LanguageCode { get; set; } |
||||
|
|
||||
|
[Required] |
||||
|
[StringLength(DocumentConsts.MaxVersionNameLength)] |
||||
|
public string Version { get; set; } |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
var abp = abp || {}; |
||||
|
|
||||
|
$(function () { |
||||
|
abp.modals.projectPull = function () { |
||||
|
var initModal = function (publicApi, args) { |
||||
|
var $form = publicApi.getForm(); |
||||
|
var fg = $form.find("#PullDocument_Name").parent(); |
||||
|
var nameInput = fg.html(); |
||||
|
|
||||
|
$form.find("input:checkbox").change(function() { |
||||
|
if ($(this).prop("checked")) { |
||||
|
fg.html(""); |
||||
|
} else { |
||||
|
fg.html(nameInput); |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
return { |
||||
|
initModal: initModal |
||||
|
}; |
||||
|
}; |
||||
|
}); |
||||
Loading…
Reference in new issue