Refactored modal, form and cards.

pull/179/head
Halil İbrahim Kalkan 7 years ago
parent 126b9786e2
commit f2ce836ef1

@ -1,12 +1,11 @@
using Microsoft.AspNetCore.Razor.TagHelpers; using Microsoft.AspNetCore.Razor.TagHelpers;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Card
{ {
public class AbpCardBodyTagHelper : TagHelper public class AbpCardBodyTagHelper : TagHelper
{ {
public override void Process(TagHelperContext context, TagHelperOutput output) public override void Process(TagHelperContext context, TagHelperOutput output)
{ {
//TODO: Remove abp-modal HTML element which is unnecessary!
output.TagName = "div"; output.TagName = "div";
output.Attributes.AddClass("card-body"); output.Attributes.AddClass("card-body");
} }

@ -1,12 +1,11 @@
using Microsoft.AspNetCore.Razor.TagHelpers; using Microsoft.AspNetCore.Razor.TagHelpers;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Card
{ {
public class AbpCardHeaderTagHelper : TagHelper public class AbpCardHeaderTagHelper : TagHelper
{ {
public override void Process(TagHelperContext context, TagHelperOutput output) public override void Process(TagHelperContext context, TagHelperOutput output)
{ {
//TODO: Remove abp-modal HTML element which is unnecessary!
output.TagName = "div"; output.TagName = "div";
output.Attributes.AddClass("card-header"); output.Attributes.AddClass("card-header");
} }

@ -1,12 +1,11 @@
using Microsoft.AspNetCore.Razor.TagHelpers; using Microsoft.AspNetCore.Razor.TagHelpers;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Card
{ {
public class AbpCardTagHelper : TagHelper public class AbpCardTagHelper : TagHelper
{ {
public override void Process(TagHelperContext context, TagHelperOutput output) public override void Process(TagHelperContext context, TagHelperOutput output)
{ {
//TODO: Remove abp-modal HTML element which is unnecessary!
output.TagName = "div"; output.TagName = "div";
output.Attributes.AddClass("card"); output.Attributes.AddClass("card");
} }

@ -7,7 +7,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
{ {
public override void Process(TagHelperContext context, TagHelperOutput output) public override void Process(TagHelperContext context, TagHelperOutput output)
{ {
//TODO: Remove abp-modal HTML element which is unnecessary! output.TagName = null;
output.PreContent.SetHtmlContent(CreatePreContent()); output.PreContent.SetHtmlContent(CreatePreContent());
output.PostContent.SetHtmlContent(CreatePostContent()); output.PostContent.SetHtmlContent(CreatePostContent());
} }

@ -7,9 +7,9 @@
Layout = null; Layout = null;
} }
<abp-modal> <form method="post" asp-page="/Identity/Users/CreateModal">
<form method="post" asp-page="/Identity/Users/CreateModal"> <abp-modal>
<abp-modal-header title="@L["NewUser"]"></abp-modal-header> <abp-modal-header title="@L["NewUser"]"></abp-modal-header>
@ -71,6 +71,6 @@
<abp-modal-footer></abp-modal-footer> <abp-modal-footer></abp-modal-footer>
</form> </abp-modal>
</abp-modal> </form>

@ -7,9 +7,9 @@
Layout = null; Layout = null;
} }
<abp-modal> <form method="post" asp-page="/Identity/Users/EditModal">
<form method="post" asp-page="/Identity/Users/EditModal"> <abp-modal>
<abp-modal-header title="@L["NewUser"]"></abp-modal-header> <abp-modal-header title="@L["NewUser"]"></abp-modal-header>
@ -68,6 +68,6 @@
<abp-modal-footer></abp-modal-footer> <abp-modal-footer></abp-modal-footer>
</form> </abp-modal>
</abp-modal> </form>

@ -58,10 +58,10 @@ $.validator.defaults.ignore = ''; //TODO: Would be better if we can apply only f
function _initAndShowModal() { function _initAndShowModal() {
_$modal = _$modalContainer.find('.modal'); _$modal = _$modalContainer.find('.modal');
_$form = _$modalContainer.find('form');
_$form = _$modal.find('form');
if (_$form.length) { if (_$form.length) {
$.validator.unobtrusive.parse(_$form); $.validator.unobtrusive.parse(_$form); //TODO: We should do a more common system to initialize component on ajax-loaded DOM elements. validator.unobtrusive.parse is only one thing to do.
if (_$form.attr('data-ajaxForm') !== 'false') { if (_$form.attr('data-ajaxForm') !== 'false') {
//TODO: Create abpAjaxForm to not repeat that code! //TODO: Create abpAjaxForm to not repeat that code!
_$form.ajaxForm({ _$form.ajaxForm({

Loading…
Cancel
Save