Download & Extend

Ajax on initial "bookmark this" doesn't work

Project:Flag
Component:Code
Category:bug report
Priority:normal
Assigned:mooffie
Status:closed (fixed)

Issue Summary

When the link says "bookmark this" after page refresh (not after any ajax), if you click on the link, the ajax properly updates the database, but the jquery doesn't properly update the text such that the link still says "bookmark this". If you refresh the page at this point, everything is OK. But if you don't refresh the page, this link says the wrong thing.

This happens because you are searching for a views-bookmark-mark with a space on the end of it, however Firebug shows that the class is there without the space. I think the reason you searched for the class with the space is because it conflicts with the views-bookmark-marked class. So the simplest change is to search for views-bookmark-mark without the space, and to change the views-bookmark-marked to another class name.

AttachmentSize
ajax.patch1.63 KB

Comments

#1

(I won't be able to verify this bug report in the near future, because I can't run Drupal right now.)

1. A quick fix is to change:

var current_class = $(element).attr('class');
if (current_class.indexOf('views-bookmark-mark ') == -1) {

to:

if ($(element).is('.views-bookmark-mark')) {

2. How is it that we didn't notice this bug before? I'm a bit skeptic ;-)

#2

Version:5.x-1.4» 5.x-1.x-dev
Status:needs review» fixed

OK, I commited this.

#3

Project:Views Bookmark» Flag
Version:5.x-1.x-dev» <none>
Component:JavaScript» Code
Assigned to:Anonymous» mooffie
Status:fixed» patch (to be ported)

Now I need to port this.

But first I need to eat ;-)

#4

Status:patch (to be ported)» fixed

Commited.

#5

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

nobody click here