Favorite star doesn't un-fav when filled and clicked
-
Mark Armendariz
- Assigned user set to Ed Finkler
Just downloaded your codebase moments ago to see if i could offer any help. Still trying to wrap my head around things, but I found a fix for this - although it's far too early for me to suggest it as a change as I've no idea what it could Possibly break. At any rate...
In Spaz.Data.makeFavorite(), you are explicitly adding the "favorited" class directly:
$('.timeline-entry[data-status-id='+postid+']').addClass('favorited');But in spaz.controller, under '.status-action-fav', you're using the Spaz.UI.getElementFromStatusId() method to get the element meant to be un/favorited. I'm not sure what it's returning, but it's definitely returning the wrong element, and hence, the $(element).hasClass('favorited') always returns false.
In Spaz.UI.getElementFromStatusId(), I replaced the current line (which is far less precise) with the one from Spaz.Data.makeFavorite():
Spaz.UI.getElementFromStatusId = function(id) { // var element = $('.entry-id:contains('+id+')').parent().get()[0]; // Original var element = $('.timeline-entry[data-status-id='+id+']') if (element) { sch.dump(element.id); return element } return false; };And now it works great, although there's no telling what that may have shattered.
I don't really use spaz much, but I'm a fan of the project. Rock on.
Mark (enobrev)
-
Mark Armendariz
- Assigned user cleared.
-
Ed Finkler
- Assigned user set to Ed Finkler
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.