Browse Source

Implement widget auto initialize.

pull/5569/head
Halil İbrahim Kalkan 5 years ago
parent
commit
28ba0bd8a1
  1. 19
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/jquery/widget-manager.js
  2. 9
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/AbpViewComponentHelper.cs
  3. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/WidgetAttribute.cs
  4. 3
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/WidgetDefinition.cs
  5. 4
      modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/CommentingViewComponent.cs
  6. 272
      modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/default.js
  7. 11
      modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Rating/RatingViewComponent.cs
  8. 151
      modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Rating/default.js
  9. 3
      modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/ReactionSelection/ReactionSelectionViewComponent.cs
  10. 104
      modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/ReactionSelection/default.js
  11. 6
      modules/cms-kit/test/Volo.CmsKit.Application.Tests/Reactions/ReactionPublicAppService_Tests.cs

19
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/jquery/widget-manager.js

@ -115,4 +115,23 @@
return publicApi;
};
function autoInitWidgets($wrapper){
$wrapper.findWithSelf('.abp-widget-wrapper[data-widget-auto-init="true"]')
.each(function(){
var widgetManager = new abp.WidgetManager({
wrapper: $(this),
});
widgetManager.init();
});
}
abp.dom.onNodeAdded(function(args){
autoInitWidgets(args.$el);
})
$(function(){
autoInitWidgets($('body'));
});
})(jQuery);

9
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/AbpViewComponentHelper.cs

@ -65,11 +65,16 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets
{
wrapperAttributesBuilder.Append($" data-refresh-url=\"{widget.RefreshUrl}\"");
}
if (widget.AutoInitialize)
{
wrapperAttributesBuilder.Append(" data-widget-auto-init=\"true\"");
}
return new HtmlContentBuilder()
.AppendHtml($"<div {wrapperAttributesBuilder}>")
.AppendHtml(await DefaultViewComponentHelper.InvokeAsync(widget.ViewComponentType, arguments))
.AppendHtml("</div>");
}
}
}
}

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/WidgetAttribute.cs

@ -33,6 +33,8 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets
public string RefreshUrl { get; set; }
public bool AutoInitialize { get; set; }
public static bool IsWidget(Type type)
{
return type.IsSubclassOf(typeof(ViewComponent)) &&

3
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/WidgetDefinition.cs

@ -50,6 +50,8 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets
[CanBeNull]
public string RefreshUrl { get; set; }
public bool AutoInitialize { get; set; }
public WidgetDefinition(
[NotNull] Type viewComponentType,
[CanBeNull] ILocalizableString displayName = null)
@ -64,6 +66,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets
Styles = GetStyles(WidgetAttribute);
Scripts = GetScripts(WidgetAttribute);
RefreshUrl = WidgetAttribute.RefreshUrl;
AutoInitialize = WidgetAttribute.AutoInitialize;
}
private static List<WidgetResourceItem> GetStyles(WidgetAttribute widgetAttribute)

4
modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/CommentingViewComponent.cs

@ -8,7 +8,6 @@ using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.UI;
using Volo.Abp.AspNetCore.Mvc.UI.Widgets;
using Volo.CmsKit.Public.Comments;
using Volo.CmsKit.Web;
namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Commenting
{
@ -16,7 +15,8 @@ namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Commenting
[Widget(
ScriptTypes = new[] {typeof(CommentingScriptBundleContributor)},
StyleTypes = new[] {typeof(CommentingStyleBundleContributor)},
RefreshUrl = "/CmsKitPublicWidgets/Commenting"
RefreshUrl = "/CmsKitPublicWidgets/Commenting",
AutoInitialize = true
)]
public class CommentingViewComponent : AbpViewComponent
{

272
modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/default.js

@ -2,181 +2,169 @@
var l = abp.localization.getResource('CmsKit');
$(document).ready(function () {
abp.widgets.CmsCommenting = function ($widget) {
var widgetManager = $widget.data('abp-widget-manager');
var $commentArea = $widget.find('.cms-comment-area');
abp.widgets.CmsCommenting = function ($widget) {
var widgetManager = $widget.data('abp-widget-manager');
var $commentArea = $widget.find('.cms-comment-area');
function getFilters() {
return {
entityType: $commentArea.attr('data-entity-type'),
entityId: $commentArea.attr('data-entity-id')
};
}
function getFilters() {
return {
entityType: $commentArea.attr('data-entity-type'),
entityId: $commentArea.attr('data-entity-id')
};
}
function registerEditLinks($container) {
$container.find('.comment-edit-link').each(function () {
var $link = $(this);
$link.on('click', function (e) {
e.preventDefault();
function registerEditLinks($container) {
$container.find('.comment-edit-link').each(function () {
var $link = $(this);
$link.on('click', function (e) {
e.preventDefault();
var commentId = $link.data('id');
var commentId = $link.data('id');
var $relatedCommentContentArea = $container.find('.cms-comment-content-area[data-id=' + commentId + ']');
var $relatedCommentEditFormArea = $container.find('.cms-comment-edit-area[data-id=' + commentId + ']');
var $relatedCommentContentArea = $container.find('.cms-comment-content-area[data-id=' + commentId + ']');
var $relatedCommentEditFormArea = $container.find('.cms-comment-edit-area[data-id=' + commentId + ']');
$relatedCommentContentArea.hide();
$relatedCommentEditFormArea.show();
$link.removeAttr('href');
});
$relatedCommentContentArea.hide();
$relatedCommentEditFormArea.show();
$link.removeAttr('href');
});
$container.find('.comment-edit-cancel-button').each(function () {
var $button = $(this);
$button.on('click', function (e) {
e.preventDefault();
});
$container.find('.comment-edit-cancel-button').each(function () {
var $button = $(this);
$button.on('click', function (e) {
e.preventDefault();
var commentId = $button.data('id');
var commentId = $button.data('id');
var $relatedCommentContentArea = $container.find('.cms-comment-content-area[data-id=' + commentId + ']');
var $relatedCommentEditFormArea = $container.find('.cms-comment-edit-area[data-id=' + commentId + ']');
var $link = $container.find('.comment-edit-link[data-id=' + commentId + ']');
var $relatedCommentContentArea = $container.find('.cms-comment-content-area[data-id=' + commentId + ']');
var $relatedCommentEditFormArea = $container.find('.cms-comment-edit-area[data-id=' + commentId + ']');
var $link = $container.find('.comment-edit-link[data-id=' + commentId + ']');
$relatedCommentContentArea.show();
$relatedCommentEditFormArea.hide();
$link.attr('href', '#');
});
$relatedCommentContentArea.show();
$relatedCommentEditFormArea.hide();
$link.attr('href', '#');
});
}
});
}
function registerReplyLinks($container) {
$container.find('.comment-reply-link').each(function () {
var $link = $(this);
$link.on('click', function (e) {
e.preventDefault();
function registerReplyLinks($container) {
$container.find('.comment-reply-link').each(function () {
var $link = $(this);
$link.on('click', function (e) {
e.preventDefault();
var replyCommentId = $link.data('reply-id');
var replyCommentId = $link.data('reply-id');
var $relatedCommentArea = $container.find('.cms-comment-form-area[data-reply-id=' + replyCommentId + ']');
var $links = $container.find('.comment-reply-link[data-reply-id=' + replyCommentId + ']');
var $relatedCommentArea = $container.find('.cms-comment-form-area[data-reply-id=' + replyCommentId + ']');
var $links = $container.find('.comment-reply-link[data-reply-id=' + replyCommentId + ']');
$relatedCommentArea.show();
$relatedCommentArea.find('textarea').focus();
$links.addClass('disabled');
});
$relatedCommentArea.show();
$relatedCommentArea.find('textarea').focus();
$links.addClass('disabled');
});
$container.find('.reply-cancel-button').each(function () {
var $button = $(this);
$button.on('click', function (e) {
e.preventDefault();
});
$container.find('.reply-cancel-button').each(function () {
var $button = $(this);
$button.on('click', function (e) {
e.preventDefault();
var replyCommentId = $button.data('reply-id');
var replyCommentId = $button.data('reply-id');
var $relatedCommentArea = $container.find('.cms-comment-form-area[data-reply-id=' + replyCommentId + ']');
var $links = $container.find('.comment-reply-link[data-reply-id=' + replyCommentId + ']');
var $relatedCommentArea = $container.find('.cms-comment-form-area[data-reply-id=' + replyCommentId + ']');
var $links = $container.find('.comment-reply-link[data-reply-id=' + replyCommentId + ']');
$relatedCommentArea.hide();
$links.removeClass('disabled');
});
$relatedCommentArea.hide();
$links.removeClass('disabled');
});
}
function registerDeleteLinks($container) {
$container.find('.comment-delete-link').each(function () {
var $link = $(this);
$link.on('click', '', function (e) {
e.preventDefault();
abp.message.confirm(l("MessageDeletionConfirmationMessage"), function (ok) {
if (ok) {
volo.cmsKit.public.comments.commentPublic.delete($link.data('id')
).then(function () {
widgetManager.refresh($widget);
});
}
});
});
}
function registerDeleteLinks($container) {
$container.find('.comment-delete-link').each(function () {
var $link = $(this);
$link.on('click', '', function (e) {
e.preventDefault();
abp.message.confirm(l("MessageDeletionConfirmationMessage"), function (ok) {
if (ok) {
volo.cmsKit.public.comments.commentPublic.delete($link.data('id')
).then(function () {
widgetManager.refresh($widget);
});
}
});
});
}
function registerUpdateOfNewComment($container) {
$container.find('.cms-comment-update-form').each(function () {
var $form = $(this);
$form.submit(function (e) {
e.preventDefault();
var formAsObject = $form.serializeFormToObject();
volo.cmsKit.public.comments.commentPublic.update(
formAsObject.id,
{
text: formAsObject.commentText
}
).then(function () {
widgetManager.refresh($widget);
});
});
}
function registerUpdateOfNewComment($container) {
$container.find('.cms-comment-update-form').each(function () {
var $form = $(this);
$form.submit(function (e) {
e.preventDefault();
var formAsObject = $form.serializeFormToObject();
volo.cmsKit.public.comments.commentPublic.update(
formAsObject.id,
{
text: formAsObject.commentText
}
).then(function () {
widgetManager.refresh($widget);
});
});
}
function registerSubmissionOfNewComment($container) {
$container.find('.cms-comment-form').each(function () {
var $form = $(this);
$form.submit(function (e) {
e.preventDefault();
var formAsObject = $form.serializeFormToObject();
volo.cmsKit.public.comments.commentPublic.create(
$commentArea.attr('data-entity-type'),
$commentArea.attr('data-entity-id'),
{
repliedCommentId: formAsObject.repliedCommentId,
text: formAsObject.commentText
}
).then(function () {
widgetManager.refresh($widget);
});
});
}
function registerSubmissionOfNewComment($container) {
$container.find('.cms-comment-form').each(function () {
var $form = $(this);
$form.submit(function (e) {
e.preventDefault();
var formAsObject = $form.serializeFormToObject();
volo.cmsKit.public.comments.commentPublic.create(
$commentArea.attr('data-entity-type'),
$commentArea.attr('data-entity-id'),
{
repliedCommentId: formAsObject.repliedCommentId,
text: formAsObject.commentText
}
).then(function () {
widgetManager.refresh($widget);
});
});
}
});
}
function focusOnHash($container) {
if (!location.hash.toLowerCase().startsWith('#cms-comment')) {
return;
}
function focusOnHash($container) {
if (!location.hash.toLowerCase().startsWith('#cms-comment')) {
return;
}
var $link = $(location.hash + '_link');
var $link = $(location.hash + '_link');
if ($link.length > 0) {
$link.click();
}
else {
$(location.hash).find('textarea').focus();
}
if ($link.length > 0) {
$link.click();
}
else {
$(location.hash).find('textarea').focus();
}
}
function init() {
registerReplyLinks($widget);
registerEditLinks($widget);
registerDeleteLinks($widget);
function init() {
registerReplyLinks($widget);
registerEditLinks($widget);
registerDeleteLinks($widget);
registerUpdateOfNewComment($widget);
registerSubmissionOfNewComment($widget);
registerUpdateOfNewComment($widget);
registerSubmissionOfNewComment($widget);
focusOnHash($widget);
}
focusOnHash($widget);
}
return {
init: init,
getFilters: getFilters
};
return {
init: init,
getFilters: getFilters
};
$('.abp-widget-wrapper[data-widget-name="CmsCommenting"]')
.each(function () {
var widgetManager = new abp.WidgetManager({
wrapper: $(this),
});
widgetManager.init($(this));
});
});
};
})(jQuery);

11
modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Rating/RatingViewComponent.cs

@ -15,7 +15,8 @@ namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Rating
[Widget(
StyleTypes = new[] {typeof(RatingStyleBundleContributor)},
ScriptTypes = new[] {typeof(RatingScriptBundleContributor)},
RefreshUrl = "/CmsKitPublicWidgets/Rating"
RefreshUrl = "/CmsKitPublicWidgets/Rating",
AutoInitialize = true
)]
public class RatingViewComponent : AbpViewComponent
{
@ -29,7 +30,7 @@ namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Rating
AbpMvcUiOptions = options.Value;
CurrentUser = currentUser;
}
public virtual async Task<IViewComponentResult> InvokeAsync(string entityType, string entityId)
{
var ratings = await RatingPublicAppService.GetGroupedStarCountsAsync(entityType, entityId);
@ -40,7 +41,7 @@ namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Rating
{
currentUserRating = ratings.Find(x => x.IsSelectedByCurrentUser)?.StarCount;
}
var loginUrl =
$"{AbpMvcUiOptions.LoginUrl}?returnUrl={HttpContext.Request.Path.ToString()}&returnUrlHash=#cms-rating_{entityType}_{entityId}";
@ -53,7 +54,7 @@ namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Rating
CurrentRating = currentUserRating,
TotalRating = totalRating
};
return View("~/Pages/CmsKit/Shared/Components/Rating/Default.cshtml", viewModel);
}
}
@ -72,4 +73,4 @@ namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Rating
public int TotalRating { get; set; }
}
}
}

151
modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Rating/default.js

@ -1,93 +1,82 @@
(function () {
var l = abp.localization.getResource("CmsKit");
$(document).ready(function () {
abp.widgets.CmsRating = function ($widget) {
var widgetManager = $widget.data("abp-widget-manager");
var $ratingArea = $widget.find(".cms-rating-area");
abp.widgets.CmsRating = function ($widget) {
var widgetManager = $widget.data("abp-widget-manager");
var $ratingArea = $widget.find(".cms-rating-area");
function getFilters() {
return {
entityType: $ratingArea.attr("data-entity-type"),
entityId: $ratingArea.attr("data-entity-id")
};
}
function registerCreateOfNewRating() {
$widget.find(".my-rating").each(function () {
var authenticated = $(this).attr("data-authenticated");
$(this).starRating({
initialRating: 0,
starSize: 16,
emptyColor: '#eee',
hoverColor: '#ffc107',
activeColor: '#ffc107',
useGradient: false,
strokeWidth: 0,
disableAfterRate: true,
useFullStars: true,
readOnly: authenticated === "True",
onHover: function (currentIndex, currentRating, $el) {
$widget.find(".live-rating").text(currentIndex);
},
onLeave: function (currentIndex, currentRating, $el) {
$widget.find(".live-rating").text(currentRating);
},
callback: function (currentRating, $el) {
volo.cmsKit.public.ratings.ratingPublic.create(
$ratingArea.attr("data-entity-type"),
$ratingArea.attr("data-entity-id"),
{
starCount: parseInt(currentRating)
}
).then(function () {
widgetManager.refresh($widget);
})
}
});
}
);
}
function getFilters() {
return {
entityType: $ratingArea.attr("data-entity-type"),
entityId: $ratingArea.attr("data-entity-id")
};
}
function registerUndoLink() {
$widget.find(".rating-undo-link").each(function () {
$(this).on('click', '', function (e) {
e.preventDefault();
function registerCreateOfNewRating() {
$widget.find(".my-rating").each(function () {
var authenticated = $(this).attr("data-authenticated");
abp.message.confirm(l("RatingUndoMessage"), function (ok) {
if (ok) {
volo.cmsKit.public.ratings.ratingPublic.delete(
$ratingArea.attr("data-entity-type"),
$ratingArea.attr("data-entity-id")
).then(function () {
widgetManager.refresh($widget);
});
}
})
$(this).starRating({
initialRating: 0,
starSize: 16,
emptyColor: '#eee',
hoverColor: '#ffc107',
activeColor: '#ffc107',
useGradient: false,
strokeWidth: 0,
disableAfterRate: true,
useFullStars: true,
readOnly: authenticated === "True",
onHover: function (currentIndex, currentRating, $el) {
$widget.find(".live-rating").text(currentIndex);
},
onLeave: function (currentIndex, currentRating, $el) {
$widget.find(".live-rating").text(currentRating);
},
callback: function (currentRating, $el) {
volo.cmsKit.public.ratings.ratingPublic.create(
$ratingArea.attr("data-entity-type"),
$ratingArea.attr("data-entity-id"),
{
starCount: parseInt(currentRating)
}
).then(function () {
widgetManager.refresh($widget);
})
}
});
});
}
}
);
}
function init() {
registerCreateOfNewRating();
registerUndoLink();
}
function registerUndoLink() {
$widget.find(".rating-undo-link").each(function () {
$(this).on('click', '', function (e) {
e.preventDefault();
return {
init: init,
getFilters: getFilters
}
};
$('.abp-widget-wrapper[data-widget-name="CmsRating"]')
.each(function () {
var widgetManager = new abp.WidgetManager({
wrapper: $(this),
abp.message.confirm(l("RatingUndoMessage"), function (ok) {
if (ok) {
volo.cmsKit.public.ratings.ratingPublic.delete(
$ratingArea.attr("data-entity-type"),
$ratingArea.attr("data-entity-id")
).then(function () {
widgetManager.refresh($widget);
});
}
})
});
widgetManager.init($(this));
});
});
}
function init() {
registerCreateOfNewRating();
registerUndoLink();
}
return {
init: init,
getFilters: getFilters
}
};
})
(jQuery);
(jQuery);

3
modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/ReactionSelection/ReactionSelectionViewComponent.cs

@ -14,7 +14,8 @@ namespace Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.ReactionSelectio
[Widget(
ScriptTypes = new[] {typeof(ReactionSelectionScriptBundleContributor)},
StyleTypes = new[] {typeof(ReactionSelectionStyleBundleContributor)},
RefreshUrl = "/CmsKitPublicWidgets/ReactionSelection"
RefreshUrl = "/CmsKitPublicWidgets/ReactionSelection",
AutoInitialize = true
)]
public class ReactionSelectionViewComponent : AbpViewComponent
{

104
modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/ReactionSelection/default.js

@ -8,71 +8,59 @@
myDefaultWhiteList.span.push('data-reaction-name');
}
$(document).ready(function () {
abp.widgets.CmsReactionSelection = function ($widget) {
var widgetManager = $widget.data('abp-widget-manager');
var $reactionArea = $widget.find('.cms-reaction-area');
var $selectIcon = $widget.find('.cms-reaction-select-icon');
var $popoverContent = $widget.find('.cms-reaction-selection-popover-content');
abp.widgets.CmsReactionSelection = function ($widget) {
var widgetManager = $widget.data('abp-widget-manager');
var $reactionArea = $widget.find('.cms-reaction-area');
var $selectIcon = $widget.find('.cms-reaction-select-icon');
var $popoverContent = $widget.find('.cms-reaction-selection-popover-content');
function getFilters() {
return {
entityType: $reactionArea.attr('data-entity-type'),
entityId: $reactionArea.attr('data-entity-id')
};
}
function getFilters() {
return {
entityType: $reactionArea.attr('data-entity-type'),
entityId: $reactionArea.attr('data-entity-id')
};
}
function registerClickOfReactionIcons($container) {
$container.find('.cms-reaction-icon').each(function () {
var $icon = $(this);
var reactionName = $icon.attr('data-reaction-name');
if ($icon.attr('data-click-action') === 'false'){
return;
}
$icon.click(function () {
var methodName = $icon.hasClass('cms-reaction-icon-selected') ? 'delete' : 'create';
volo.cmsKit.public.reactions.reactionPublic[methodName](
$reactionArea.attr('data-entity-type'),
$reactionArea.attr('data-entity-id'),
reactionName
).then(function () {
$selectIcon.popover('hide');
widgetManager.refresh($widget);
});
function registerClickOfReactionIcons($container) {
$container.find('.cms-reaction-icon').each(function () {
var $icon = $(this);
var reactionName = $icon.attr('data-reaction-name');
if ($icon.attr('data-click-action') === 'false') {
return;
}
$icon.click(function () {
var methodName = $icon.hasClass('cms-reaction-icon-selected') ? 'delete' : 'create';
volo.cmsKit.public.reactions.reactionPublic[methodName](
$reactionArea.attr('data-entity-type'),
$reactionArea.attr('data-entity-id'),
reactionName
).then(function () {
$selectIcon.popover('hide');
widgetManager.refresh($widget);
});
});
}
});
}
function init() {
function init() {
$selectIcon.popover({
placement: 'left',
html: true,
trigger: 'focus',
title: l('PickYourReaction'),
content: $popoverContent.html()
}).on('shown.bs.popover', function () {
var $popover = $('#' + $selectIcon.attr('aria-describedby'));
registerClickOfReactionIcons($popover);
});
$selectIcon.popover({
placement: 'left',
html: true,
trigger: 'focus',
title: l('PickYourReaction'),
content: $popoverContent.html()
}).on('shown.bs.popover', function () {
var $popover = $('#' + $selectIcon.attr('aria-describedby'));
registerClickOfReactionIcons($popover);
});
registerClickOfReactionIcons($widget);
}
registerClickOfReactionIcons($widget);
}
return {
init: init,
getFilters: getFilters
};
return {
init: init,
getFilters: getFilters
};
$('.abp-widget-wrapper[data-widget-name="CmsReactionSelection"]')
.each(function () {
var widgetManager = new abp.WidgetManager({
wrapper: $(this),
});
widgetManager.init();
});
});
};
})(jQuery);

6
modules/cms-kit/test/Volo.CmsKit.Application.Tests/Reactions/ReactionPublicAppService_Tests.cs

@ -65,13 +65,13 @@ namespace Volo.CmsKit.Reactions
UsingDbContext(context =>
{
var reaction = context.Set<UserReaction>().FirstOrDefault(x =>
var reaction = context.Set<UserReaction>().Where(x =>
x.CreatorId == _cmsKitTestData.User1Id &&
x.ReactionName == StandardReactions.Eyes &&
x.EntityId == _cmsKitTestData.EntityId2 &&
x.EntityType == _cmsKitTestData.EntityType2);
x.EntityType == _cmsKitTestData.EntityType2).ToList();
reaction.ShouldNotBeNull();
reaction.Count.ShouldBe(1);
});
}

Loading…
Cancel
Save