Browse Source

Identity-SettingManagement: Enhancements for MVC UI

pull/12137/head
Engincan VESKE 5 years ago
parent
commit
cd6154168e
  1. 10
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml
  2. 12
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml
  3. 1
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/Index.cshtml
  4. 7
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/index.css
  5. 57
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/index.js
  6. 8
      modules/setting-management/src/Volo.Abp.SettingManagement.Web/AbpSettingManagementWebModule.cs
  7. 8
      modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Components/EmailSettingGroup/Default.cshtml
  8. 6
      modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Components/EmailSettingGroup/Default.js
  9. 4
      modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Components/EmailSettingGroup/EmailSettingGroupViewComponent.cs
  10. 11
      modules/setting-management/src/Volo.Abp.SettingManagement.Web/SettingManagementWebAutoMapperProfile.cs
  11. 1
      modules/setting-management/src/Volo.Abp.SettingManagement.Web/Volo.Abp.SettingManagement.Web.csproj

10
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml

@ -7,6 +7,7 @@
@using Volo.Abp.Localization
@using Volo.Abp.ObjectExtending
@using Volo.Abp.Data
@using Volo.Abp.Identity
@model CreateModalModel
@inject IHtmlLocalizer<IdentityResource> L
@inject IStringLocalizerFactory StringLocalizerFactory
@ -25,7 +26,14 @@
<abp-input asp-for="UserInfo.UserName" />
<abp-input asp-for="UserInfo.Name" />
<abp-input asp-for="UserInfo.Surname" />
<abp-input asp-for="UserInfo.Password" />
<div class="mb-3">
<label asp-for="UserInfo.Password" class="form-label">@L["Password"] *</label>
<div class="input-group">
<input type="password" class="form-control" maxlength="@IdentityUserConsts.MaxPasswordLength" asp-for="UserInfo.Password" />
<button class="btn btn-secondary" type="button" id="PasswordVisibilityButton"><i class="fa fa-eye-slash" aria-hidden="true"></i></button>
</div>
<span asp-validation-for="UserInfo.Password"></span>
</div>
<abp-input asp-for="UserInfo.Email" />
<abp-input asp-for="UserInfo.PhoneNumber" />
<abp-input asp-for="UserInfo.IsActive" />

12
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml

@ -7,6 +7,7 @@
@using Volo.Abp.Localization
@using Volo.Abp.ObjectExtending
@using Volo.Abp.Data
@using Volo.Abp.Identity
@model EditModalModel
@inject IHtmlLocalizer<IdentityResource> L
@inject IStringLocalizerFactory StringLocalizerFactory
@ -25,7 +26,16 @@
<abp-input asp-for="UserInfo.UserName" />
<abp-input asp-for="UserInfo.Name" />
<abp-input asp-for="UserInfo.Surname" />
<abp-input asp-for="UserInfo.Password" />
<div class="mb-3">
<label asp-for="UserInfo.Password" class="form-label">@L["Password"]</label>
<div class="input-group">
<input type="password" class="form-control" maxlength="@IdentityUserConsts.MaxPasswordLength" asp-for="UserInfo.Password"/>
<button class="btn btn-secondary" type="button" id="PasswordVisibilityButton">
<i class="fa fa-eye-slash" aria-hidden="true"></i>
</button>
</div>
<span asp-validation-for="UserInfo.Password"></span>
</div>
<abp-input asp-for="UserInfo.Email" />
<abp-input asp-for="UserInfo.PhoneNumber" />
<abp-input asp-for="UserInfo.IsActive" />

1
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/Index.cshtml

@ -19,6 +19,7 @@
@section styles {
<abp-style-bundle name="@typeof(IndexModel).FullName">
<abp-style src="/Pages/AbpPermissionManagement/permission-management-modal.css" />
<abp-style src="/Pages/identity/users/index.css"/>
</abp-style-bundle>
}
@section scripts {

7
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/index.css

@ -0,0 +1,7 @@
/*
By default Microsoft Edge, adds password reveal button inside the password input.
https://docs.microsoft.com/en-us/microsoft-edge/web-platform/password-reveal
*/
::-ms-reveal {
display: none;
}

57
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/index.js

@ -2,12 +2,51 @@
var l = abp.localization.getResource('AbpIdentity');
var _identityUserAppService = volo.abp.identity.identityUser;
var _editModal = new abp.ModalManager(
abp.appPath + 'Identity/Users/EditModal'
);
var _createModal = new abp.ModalManager(
abp.appPath + 'Identity/Users/CreateModal'
);
var togglePasswordVisibility = function () {
$("#PasswordVisibilityButton").click(function (e) {
var button = $(this);
var passwordInput = button.parent().find("input");
if(!passwordInput) {
return;
}
if(passwordInput.attr("type") === "password") {
passwordInput.attr("type", "text");
}
else {
passwordInput.attr("type", "password");
}
var icon = button.find("i");
if(icon) {
icon.toggleClass("fa-eye-slash").toggleClass("fa-eye");
}
});
}
abp.modals.createUser = function () {
var initModal = function (publicApi, args) {
togglePasswordVisibility();
};
return { initModal: initModal };
}
abp.modals.editUser = function () {
var initModal = function (publicApi, args) {
togglePasswordVisibility();
};
return { initModal: initModal };
}
var _editModal = new abp.ModalManager({
viewUrl: abp.appPath + 'Identity/Users/EditModal',
modalClass: "editUser"
});
var _createModal = new abp.ModalManager({
viewUrl: abp.appPath + 'Identity/Users/CreateModal',
modalClass: "createUser"
});
var _permissionsModal = new abp.ModalManager(
abp.appPath + 'AbpPermissionManagement/PermissionManagementModal'
);
@ -44,9 +83,9 @@
},
{
text: l('Delete'),
visible: abp.auth.isGranted(
'AbpIdentity.Users.Delete'
),
visible: function(data) {
return abp.auth.isGranted('AbpIdentity.Users.Delete') && abp.currentUser.id !== data.id;
},
confirmMessage: function (data) {
return l(
'UserDeletionConfirmationMessage',

8
modules/setting-management/src/Volo.Abp.SettingManagement.Web/AbpSettingManagementWebModule.cs

@ -2,6 +2,7 @@
using Microsoft.Extensions.DependencyInjection;
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;
using Volo.Abp.Modularity;
using Volo.Abp.SettingManagement.Web.Navigation;
@ -14,6 +15,7 @@ namespace Volo.Abp.SettingManagement.Web;
[DependsOn(
typeof(AbpSettingManagementApplicationContractsModule),
typeof(AbpAutoMapperModule),
typeof(AbpAspNetCoreMvcUiThemeSharedModule),
typeof(AbpSettingManagementDomainSharedModule)
)]
@ -58,5 +60,11 @@ public class AbpSettingManagementWebModule : AbpModule
{
options.DisableModule(SettingManagementRemoteServiceConsts.ModuleName);
});
context.Services.AddAutoMapperObjectMapper<AbpSettingManagementWebModule>();
Configure<AbpAutoMapperOptions>(options =>
{
options.AddProfile<SettingManagementWebAutoMapperProfile>(validate: true);
});
}
}

8
modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Components/EmailSettingGroup/Default.cshtml

@ -1,14 +1,14 @@
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.SettingManagement.Localization
@inject IHtmlLocalizer<AbpSettingManagementResource> L
@model Volo.Abp.SettingManagement.EmailSettingsDto
@model Volo.Abp.SettingManagement.UpdateEmailSettingsDto
<form id="EmailSettingsForm">
<form id="EmailSettingsForm" method="post">
<abp-row>
<abp-column size-md="_12">
<div>
<abp-input asp-for="DefaultFromDisplayName" label="@L["DefaultFromDisplayName"].Value" />
<abp-input asp-for="DefaultFromAddress" label="@L["DefaultFromAddress"].Value" />
<abp-input asp-for="DefaultFromDisplayName" label="@(L["DefaultFromDisplayName"].Value + " * ")" />
<abp-input asp-for="DefaultFromAddress" label="@(L["DefaultFromAddress"].Value + " * ")" />
<abp-input asp-for="SmtpHost" label="@L["SmtpHost"].Value" />
<abp-input asp-for="SmtpPort" label="@L["SmtpPort"].Value" />
<abp-input asp-for="SmtpEnableSsl" label="@L["SmtpEnableSsl"].Value" />

6
modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Components/EmailSettingGroup/Default.js

@ -6,8 +6,12 @@
$("#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");
});

4
modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Components/EmailSettingGroup/EmailSettingGroupViewComponent.cs

@ -16,8 +16,8 @@ public class EmailSettingGroupViewComponent : AbpViewComponent
public virtual async Task<IViewComponentResult> InvokeAsync()
{
var model = await EmailSettingsAppService.GetAsync();
var emailSettings = await EmailSettingsAppService.GetAsync();
var model = ObjectMapper.Map<EmailSettingsDto, UpdateEmailSettingsDto>(emailSettings);
return View("~/Pages/SettingManagement/Components/EmailSettingGroup/Default.cshtml", model);
}
}

11
modules/setting-management/src/Volo.Abp.SettingManagement.Web/SettingManagementWebAutoMapperProfile.cs

@ -0,0 +1,11 @@
using AutoMapper;
namespace Volo.Abp.SettingManagement.Web;
public class SettingManagementWebAutoMapperProfile : Profile
{
public SettingManagementWebAutoMapperProfile()
{
CreateMap<EmailSettingsDto, UpdateEmailSettingsDto>();
}
}

1
modules/setting-management/src/Volo.Abp.SettingManagement.Web/Volo.Abp.SettingManagement.Web.csproj

@ -15,6 +15,7 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AutoMapper\Volo.Abp.AutoMapper.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Localization\Volo.Abp.Localization.csproj" />
<ProjectReference Include="..\Volo.Abp.SettingManagement.Domain.Shared\Volo.Abp.SettingManagement.Domain.Shared.csproj" />

Loading…
Cancel
Save