Ajax on initial "bookmark this" doesn't work

douggreen - May 29, 2008 - 02:54
Project:Flag
Component:Code
Category:bug report
Priority:normal
Assigned:mooffie
Status:closed
Description

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

#1

mooffie - June 10, 2008 - 17:42

(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

mooffie - June 10, 2008 - 19:12
Version:5.x-1.4» 5.x-1.x-dev
Status:patch (code needs review)» fixed

OK, I commited this.

#3

mooffie - June 10, 2008 - 19:17
Project:Views Bookmark» Flag
Version:5.x-1.x-dev»
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

mooffie - June 10, 2008 - 20:00
Status:patch (to be ported)» fixed

Commited.

#5

Anonymous (not verified) - June 24, 2008 - 20:02
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.