So this is a part of likes.js:
likeItem: function()
{
if (!self.options.registeredUser)
{
return false;
}
EasyDiscuss.ajax('site.views.likes.like' ,
{
'postid' : self.options.postId
})
.done(function(result )
{
self.likeText().html(result);
});
},
'{likeButton} click' : function(element )
{
// If user is not logged in, do not allow them to click this.
var btnLike = self.likeButton();
btnLike.addClass('btnUnlike');
btnLike.attr('data-original-title', $.language('COM_EASYDISCUSS_UNLIKE_THIS_POST'));
btnLike.find('i')
.removeClass('icon-ed-love')
.addClass('icon-ed-remove');
self.likeStatus().html($.language('COM_EASYDISCUSS_UNLIKE'));
btnLike.removeClass('btnLike');
self.likeItem(element);
},
The comment in the click function says that it should do something which it doesn't and instead is done later on, when the button already been changed to Unlike.
So I modified it to this, which does the trick:
likeItem: function()
{
EasyDiscuss.ajax('site.views.likes.like' ,
{
'postid' : self.options.postId
})
.done(function(result )
{
self.likeText().html(result);
});
},
'{likeButton} click' : function(element )
{
// If user is not logged in, do not allow them to click this.
if (!self.options.registeredUser)
{
return false;
}
var btnLike = self.likeButton();
btnLike.addClass('btnUnlike');
btnLike.attr('data-original-title', $.language('COM_EASYDISCUSS_UNLIKE_THIS_POST'));
btnLike.find('i')
.removeClass('icon-ed-love')
.addClass('icon-ed-remove');
self.likeStatus().html($.language('COM_EASYDISCUSS_UNLIKE'));
btnLike.removeClass('btnLike');
self.likeItem(element);
},
But I would like to display a message saying something like "You have to be logged in to be able to like.". What message functions are available from the EasyDiscuss js library? I need something fancier than window.alert().
Thanks