Browse Source

OkButtonText converted to ILocalizableString

pull/5973/head
Mladen Macanovic 6 years ago
parent
commit
947e06aaea
  1. 6
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/UiNotificationOptions.cs
  2. 1
      framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiNotificationService.cs
  3. 7
      framework/src/Volo.Abp.BlazoriseUI/Components/UiNotificationAlert.razor.cs

6
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/UiNotificationOptions.cs

@ -1,4 +1,6 @@
namespace Volo.Abp.AspNetCore.Components.WebAssembly using Volo.Abp.Localization;
namespace Volo.Abp.AspNetCore.Components.WebAssembly
{ {
/// <summary> /// <summary>
/// Options to override notification appearance. /// Options to override notification appearance.
@ -8,7 +10,7 @@
/// <summary> /// <summary>
/// Custom text for the Ok button. /// Custom text for the Ok button.
/// </summary> /// </summary>
public string OkButtonText { get; set; } public ILocalizableString OkButtonText { get; set; }
/// <summary> /// <summary>
/// Custom icon for the Ok button. /// Custom icon for the Ok button.

1
framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiNotificationService.cs

@ -67,7 +67,6 @@ namespace Volo.Abp.BlazoriseUI
{ {
return new UiNotificationOptions return new UiNotificationOptions
{ {
OkButtonText = localizer["Ok"],
}; };
} }
} }

7
framework/src/Volo.Abp.BlazoriseUI/Components/UiNotificationAlert.razor.cs

@ -2,6 +2,7 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Blazorise.Snackbar; using Blazorise.Snackbar;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Localization;
using Volo.Abp.AspNetCore.Components.WebAssembly; using Volo.Abp.AspNetCore.Components.WebAssembly;
namespace Volo.Abp.BlazoriseUI.Components namespace Volo.Abp.BlazoriseUI.Components
@ -24,6 +25,8 @@ namespace Volo.Abp.BlazoriseUI.Components
[Inject] protected BlazoriseUiNotificationService UiNotificationService { get; set; } [Inject] protected BlazoriseUiNotificationService UiNotificationService { get; set; }
[Inject] protected IStringLocalizerFactory StringLocalizerFactory { get; set; }
protected virtual SnackbarColor GetSnackbarColor(UiNotificationType notificationType) protected virtual SnackbarColor GetSnackbarColor(UiNotificationType notificationType)
{ {
return notificationType switch return notificationType switch
@ -50,7 +53,9 @@ namespace Volo.Abp.BlazoriseUI.Components
Title = e.Title; Title = e.Title;
Options = e.Options; Options = e.Options;
SnackbarStack.Push(Message, GetSnackbarColor(e.NotificationType)); var okButtonText = Options?.OkButtonText?.Localize(StringLocalizerFactory);
SnackbarStack.Push(Message, GetSnackbarColor( e.NotificationType ), okButtonText);
} }
public virtual void Dispose() public virtual void Dispose()

Loading…
Cancel
Save