From 9c70d7c3935af142ba23c21a54e73c6f5c915238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 17 Jul 2020 18:27:41 +0300 Subject: [PATCH] widget-manager should use findWithSelf --- .../jquery/widget-manager.js | 8 ++--- .../Components/ReactionSelection/default.js | 29 +++++++++---------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/jquery/widget-manager.js b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/jquery/widget-manager.js index 0b746b5e37..e0fdf0bafa 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/jquery/widget-manager.js +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/jquery/widget-manager.js @@ -27,7 +27,7 @@ var getFilters = function ($widgetWrapperDiv) { var filters = {}; - + if (opts.filterForm) { opts.filterForm.each(function() { filters = $.extend(filters, opts.filterForm.serializeFormToObject()); @@ -47,7 +47,7 @@ }; var init = function () { - opts.wrapper.find('.abp-widget-wrapper').each(function () { + opts.wrapper.findWithSelf('.abp-widget-wrapper').each(function () { var $widgetWrapperDiv = $(this); var widgetName = $widgetWrapperDiv.attr('data-widget-name'); var widgetApiClass = abp.widgets[widgetName]; @@ -62,7 +62,7 @@ }; var refresh = function () { - opts.wrapper.find('.abp-widget-wrapper').each(function () { + opts.wrapper.findWithSelf('.abp-widget-wrapper').each(function () { var $widgetWrapperDiv = $(this); var refreshUrl = $widgetWrapperDiv.attr('data-refresh-url'); @@ -104,4 +104,4 @@ return publicApi; }; -})(jQuery); \ No newline at end of file +})(jQuery); diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/ReactionSelection/default.js b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/ReactionSelection/default.js index 298ab57c66..c7b31b1e1b 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/ReactionSelection/default.js +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/ReactionSelection/default.js @@ -1,19 +1,17 @@ (function ($) { $(document).ready(function () { - abp.widgets.CmsReactionSelection= function ($widget) { + abp.widgets.CmsReactionSelection = function ($widget) { - var getFilters = function () { - return { - - }; + function getFilters() { + return {}; } - var refresh = function (filters) { - - }; + function refresh(filters) { + location.reload(); //TODO: JUST TESTING !!!!!!!! + } - var init = function (filters) { + function init(filters) { var $wrapper = $widget.find('.cms-reaction-selection'); $widget.find('.cms-reaction-icon').each(function () { var $icon = $(this); @@ -24,23 +22,22 @@ entityId: $wrapper.attr('data-entity-id'), reactionName: $icon.attr('data-name') }).then(function () { - location.reload(); //TODO: JUST TESTING !!!!!!!! + refresh(); }); }); }); - }; + } return { - getFilters: getFilters, init: init, - refresh: refresh + refresh: refresh, + getFilters : getFilters }; }; - $('.abp-widget-wrapper[data-widget-name="CmsReactionSelection"]').each(function(){ - var $widget = $(this); + $('.abp-widget-wrapper[data-widget-name="CmsReactionSelection"]').each(function () { var widgetManager = new abp.WidgetManager({ - wrapper: $widget.parent(), //TODO: Change to $widget once WidgetManager supports it! + wrapper: $(this), }); widgetManager.init();