@ -2,27 +2,27 @@
$ ( document ) . ready ( function ( ) {
abp . widgets . CmsReactionSelection = function ( $widget ) {
var $reactionSelection = $widget . find ( '.cms-reaction-selection' ) ;
var widgetManager = $widget . data ( 'abp-widget-manager' ) ;
function getFilters ( ) {
return { } ;
}
function refresh ( filters ) {
location . reload ( ) ; //TODO: JUST TESTING !!!!!!!!
return {
entityType : $reactionSelection . attr ( 'data-entity-type' ) ,
entityId : $reactionSelection . attr ( 'data-entity-id' )
} ;
}
function init ( filters ) {
var $wrapper = $widget . find ( '.cms-reaction-selection' ) ;
$widget . find ( '.cms-reaction-icon' ) . each ( function ( ) {
var $icon = $ ( this ) ;
$icon . click ( function ( ) {
var methodName = $icon . hasClass ( 'cms-reaction-icon-selected' ) ? 'delete' : 'create' ;
volo . cmsKit . reactions . reactionPublic [ methodName ] ( {
entityType: $wrapper . attr ( 'data-entity-type' ) ,
entityId : $wrapper . attr ( 'data-entity-id' ) ,
reactionName : $icon . attr ( 'data-name' )
} ). then ( function ( ) {
refresh( ) ;
volo . cmsKit . reactions . reactionPublic [ methodName ] (
$. extend ( getFilters ( ) , {
reactionName : $icon . attr ( 'data-name' )
} )
). then ( function ( ) {
widgetManager. refresh( $widget ) ;
} ) ;
} ) ;
} ) ;
@ -30,8 +30,7 @@
return {
init : init ,
refresh : refresh ,
getFilters : getFilters
getFilters : getFilters
} ;
} ;