diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json index 5638d92fa8..76a2867ac8 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/en.json @@ -46,6 +46,7 @@ "LoginToAddComment": "Login to add comment", "LoginToRate": "Login to rate", "LoginToReply": "Login to reply", + "LoginToReact": "Login to react", "Menu:CMS": "CMS", "Message": "Message", "MessageDeletionConfirmationMessage": "This comment will be deleted completely.", diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json index 73c02088ea..c1ff6d47b8 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json +++ b/modules/cms-kit/src/Volo.CmsKit.Domain.Shared/Volo/CmsKit/Localization/Resources/tr.json @@ -45,6 +45,7 @@ "LoginToAddComment": "Yorum yapmak için giriş yap", "LoginToRate": "Oylamak için giriş yapın", "LoginToReply": "Cevap vermek için giriş yap", + "LoginToReact": "Reaksiyon vermek için giriş yap", "Menu:CMS": "CMS", "Message": "Mesaj", "MessageDeletionConfirmationMessage": "Bu yorum tamamen silinecektir", diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/ReactionSelection/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/ReactionSelection/Default.cshtml index 9e4882125e..926524df93 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/ReactionSelection/Default.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/ReactionSelection/Default.cshtml @@ -1,42 +1,49 @@ @inject ICurrentUser CurrentUser +@inject IHtmlLocalizer L @using Volo.Abp.Users +@using Volo.CmsKit.Localization +@using Microsoft.AspNetCore.Mvc.Localization @model Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.ReactionSelection.ReactionSelectionViewComponent.ReactionSelectionViewModel -@if (CurrentUser.IsAuthenticated || Model.Reactions.Count(r => r.Count > 0) > 0) -{ -
-
-
- - Reactions - -
-
- - @foreach (var reaction in Model.Reactions.Where(r => r.Count > 0)) - { - - - @(reaction.Count) - - } - @if (CurrentUser.IsAuthenticated) - { - - - - - } - -
+
+
+
+ + Reactions + +
+
+ + + @foreach (var reaction in Model.Reactions.Where(r => r.Count > 0)) + { + + + @(reaction.Count) + + } + @if (CurrentUser.IsAuthenticated) + { + + + + + } + else + { +
"> + + + } +
-} \ No newline at end of file +
\ No newline at end of file diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/ReactionSelection/ReactionSelectionViewComponent.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/ReactionSelection/ReactionSelectionViewComponent.cs index ff10ea662c..46869a3399 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/ReactionSelection/ReactionSelectionViewComponent.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/ReactionSelection/ReactionSelectionViewComponent.cs @@ -4,6 +4,7 @@ using JetBrains.Annotations; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI; using Volo.Abp.AspNetCore.Mvc.UI.Widgets; using Volo.CmsKit.Public.Reactions; using Volo.CmsKit.Web; @@ -23,12 +24,16 @@ namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.ReactionSelectio protected CmsKitUiOptions Options { get; } + public AbpMvcUiOptions AbpMvcUiOptions { get; } + public ReactionSelectionViewComponent( IReactionPublicAppService reactionPublicAppService, - IOptions options) + IOptions options, + IOptions abpMvcUiOptions) { ReactionPublicAppService = reactionPublicAppService; Options = options.Value; + AbpMvcUiOptions = abpMvcUiOptions.Value; } public virtual async Task InvokeAsync( @@ -37,11 +42,15 @@ namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.ReactionSelectio { var result = await ReactionPublicAppService.GetForSelectionAsync(entityType, entityId); + var loginUrl = + $"{AbpMvcUiOptions.LoginUrl}?returnUrl={HttpContext.Request.Path.ToString()}&returnUrlHash=#cms-rating_{entityType}_{entityId}"; + var viewModel = new ReactionSelectionViewModel { EntityType = entityType, EntityId = entityId, - Reactions = new List() + Reactions = new List(), + LoginUrl = loginUrl }; foreach (var reactionDto in result.Items) @@ -67,6 +76,8 @@ namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.ReactionSelectio public string EntityId { get; set; } public List Reactions { get; set; } + + public string LoginUrl { get; set; } } public class ReactionViewModel