[drupal-devel] [feature] AJAX Google Suggest feature for Folksonomy
Module
Steven
drupal-devel at drupal.org
Tue May 24 03:53:03 UTC 2005
Issue status update for http://drupal.org/node/21116
Project: Drupal
Version: cvs
Component: taxonomy.module
Category: feature requests
Priority: normal
Assigned to: killes at www.drop.org
Reported by: factoryjoe
Updated by: Steven
Status: patch
I've confirmed the "extra spaces after commas" problem occurs. The
simplest fix is to just implode and explode the same and ignore whether
spaces are correct. They will be trimmed off when the terms are saved
anyway.
Also, this bit of code could use a bit of commenting:
// The user enters a comma-separated list of tags. We only autocomplete
the last tag.
Steven
Previous comments:
------------------------------------------------------------------------
April 22, 2005 - 20:20 : factoryjoe
When adding folksonomy terms to a node, drawing from existing terms
would be a useful feature. There are two options worth considering:
An initially hidden flat list of the most used 150 tags that you can
click to add to your text input (see my demo [1])
A Google-suggest [2] like feature for pulling out of /all available/
tags
[1] http://factorycity.net/demos/drupal/node_creation/
[2] http://www.google.com/webhp?complete=1&hl=en
------------------------------------------------------------------------
April 22, 2005 - 21:05 : factoryjoe
This was intended for Morbus' freetagging code, which doesn't have a
separate project. Thus, I'm moving it to the drupal project.
------------------------------------------------------------------------
May 21, 2005 - 01:03 : killes at www.drop.org
I think that should be easy once Thox' Ajax code has hit core.
See:
http://drupal.org/node/22471
------------------------------------------------------------------------
May 23, 2005 - 22:00 : killes at www.drop.org
Attachment: http://drupal.org/files/issues/taxonomy_autocomplete.patch (2.41 KB)
Ok, somebody please try this patch. You'll need to apply the ajax patch
first.
------------------------------------------------------------------------
May 24, 2005 - 05:18 : Steven
Good patch, some niggles:
The check_plain() does nothing to either commas or pipes, so you can do
it at the end after all the imploding. In fact, you also need to
check_plain() the existing words again, so moving the check_plain() to
the end fixes that too. The existing words are in plain-text form when
they arrive and need to be inserted back into HTML.
First you explode by ',' (no space), then you implode by ', ' (with
space). It seems to me that each time you use an autocompletion
suggestion, you get extra spaces after a comma. It's possible HTML's
whitespace rules collapse the multiple spaces, but it needs to be
tested.
Like the other Ajax patch, we should hardcode $limit to prevent abuse.
More information about the drupal-devel
mailing list