Merge pull request #13143 from abpframework/SettingManagement

Add js file to setting views.
pull/13150/head
liangshiwei 3 years ago committed by GitHub
commit eeab3a388f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,7 +1,5 @@
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
using Volo.Abp.AutoMapper;
using Volo.Abp.Http.ProxyScripting.Generators.JQuery;
@ -29,7 +27,7 @@ public class AbpSettingManagementWebModule : AbpModule
{
options.AddAssemblyResource(typeof(AbpSettingManagementResource), typeof(AbpSettingManagementWebModule).Assembly);
});
PreConfigure<IMvcBuilder>(mvcBuilder =>
{
mvcBuilder.AddApplicationPartIfNotExists(typeof(AbpSettingManagementWebModule).Assembly);
@ -54,21 +52,11 @@ public class AbpSettingManagementWebModule : AbpModule
options.FileSets.AddEmbedded<AbpSettingManagementWebModule>();
});
Configure<AbpBundlingOptions>(options =>
{
options.ScriptBundles
.Configure(typeof(IndexModel).FullName,
configuration =>
{
configuration.AddFiles("/Pages/SettingManagement/Components/EmailSettingGroup/Default.js");
});
});
Configure<DynamicJavaScriptProxyOptions>(options =>
{
options.DisableModule(SettingManagementRemoteServiceConsts.ModuleName);
});
context.Services.AddAutoMapperObjectMapper<AbpSettingManagementWebModule>();
Configure<AbpAutoMapperOptions>(options =>
{

@ -6,6 +6,8 @@
@inject IPermissionChecker PermissionChecker
@model Volo.Abp.SettingManagement.Web.Pages.SettingManagement.Components.EmailSettingGroup.EmailSettingGroupViewComponent.UpdateEmailSettingsViewModel
<abp-script src="/Pages/SettingManagement/Components/EmailSettingGroup/Default.js" />
<form id="EmailSettingsForm" method="post">
<abp-row>
<abp-column size-md="_12">
@ -36,4 +38,4 @@
</div>
</abp-column>
</abp-row>
</form>
</form>

@ -8,46 +8,44 @@
var l = abp.localization.getResource('AbpSettingManagement');
abp.event.on('Abp.SettingManagement.View.Render.Volo.Abp.EmailSetting', function (eventData) {
$("#EmailSettingsForm").on('submit', function (event) {
event.preventDefault();
$("#EmailSettingsForm").on('submit', function (event) {
event.preventDefault();
if (!$(this).valid()) {
return;
}
var form = $(this).serializeFormToObject();
volo.abp.settingManagement.emailSettings.update(form).then(function (result) {
$(document).trigger("AbpSettingSaved");
});
if (!$(this).valid()) {
return;
}
var form = $(this).serializeFormToObject();
volo.abp.settingManagement.emailSettings.update(form).then(function (result) {
$(document).trigger("AbpSettingSaved");
});
$('#SmtpUseDefaultCredentials').change(function () {
if (this.checked) {
$('#HideSectionWhenUseDefaultCredentialsIsChecked').slideUp();
} else {
$('#HideSectionWhenUseDefaultCredentialsIsChecked').slideDown();
}
});
});
_sendTestEmailModal.onOpen(function () {
var $form = _sendTestEmailModal.getForm();
_sendTestEmailModal.getForm().off('abp-ajax-success');
$('#SmtpUseDefaultCredentials').change(function () {
if (this.checked) {
$('#HideSectionWhenUseDefaultCredentialsIsChecked').slideUp();
} else {
$('#HideSectionWhenUseDefaultCredentialsIsChecked').slideDown();
}
});
$form.on('abp-ajax-success', function () {
_sendTestEmailModal.setResult();
});
})
_sendTestEmailModal.onOpen(function () {
var $form = _sendTestEmailModal.getForm();
_sendTestEmailModal.getForm().off('abp-ajax-success');
_sendTestEmailModal.onResult(function () {
abp.notify.success(l('SuccessfullySent'));
$form.on('abp-ajax-success', function () {
_sendTestEmailModal.setResult();
});
})
_sendTestEmailModal.onResult(function () {
abp.notify.success(l('SuccessfullySent'));
});
$("#SendTestEmailButton").click(function (e) {
e.preventDefault();
_sendTestEmailModal.open();
});
$("#SendTestEmailButton").click(function (e) {
e.preventDefault();
_sendTestEmailModal.open();
});
});

@ -21,7 +21,6 @@
$('#tab-content').children('.tab-pane').removeClass('show').removeClass('active');
_this.attr('data-bs-target', '#' + $.escapeSelector($.escapeSelector(id)));
$('#tab-content').append('<div id=' + $.escapeSelector(id) + ' class="tab-pane fade active show">' + response + '</div>');
abp.event.trigger('Abp.SettingManagement.View.Render.' + id);
})
});
}).first().click();

Loading…
Cancel
Save