The community_tags-regular-vocabularies_4.patch by nedjo in this thread adds support for tagging nodes in teasers -- but it also has a lot of other stuff as well that added too much complexity.

Early in that thread, nedjo said, "I've also included support for tagging on node teasers. This required some reworking of the data model, which was previously limited to a single node's data. Is this of interest? If so, I could factor it out into a separate patch."

I'm definitely interested in this being broken out into a separate patch as it would allow me to add in the community tags input form on multiple nodes within a view.

Comments

KentBye’s picture

There's a bug in nedjo's patch whenever a node doesn't have any initial tags, then the o.tags[nid] is an empty object with a value of "[object Object]" and it gives the following error:

o.tags[nid].push is not a function
addHandler("3693")
(no name)()
e(click clientX=0, clientY=0)
o.tags[nid].push(textfield[0].value);

community_tags.js (line 45)
community_tags.js (line 60)
community_tags.js (line 67)
jquery.js (line 2)

Another version of this bug is also in the regular version of community_tags, and is described in this issue It was fixed in the trunk version by initializing the o.tags to an empty array, and I took a similar approach to getting it to work.

In community_tags.js, I changed this code snippet from:

      // Prepare the add Ajax handler and add the button.
      var addHandler = function (nid) {

to:

      // Prepare the add Ajax handler and add the button.
      var addHandler = function (nid) {
        if(o.tags[nid].toString() == "[object Object]") {
          o.tags[nid] = "";
        }

And nedjo's patch now works with tagging nodes in teasers, but the non-essential functionality from the original feature request would need to be stripped out and cleaned up in order for this to be accepted.

patchak’s picture

@KentBye:

I'm sure some people here would be ready to chip in and sponsor work on this patch. We all need ( I think) a way to tag nodes directly from the teaser, ideally in a collapsible fieldset. If you are interested, please let me know.

@Steven: Do you think you would be willing to accept a simple patch that simply allows nodes to be tagged from the teaser, only for freetagging vocabs? If yes, we could work something out with the people here that are interested!

Thanks,
patchak

KentBye’s picture

@patchak
That'd be great to get some help on this, and I would be definitely willing to test it.
I'll also e-mail Steven asking about it since I haven't been able to catch him on IRC lately

It looks like nedjo has already done a lot of the heavy lifting -- but at the same time there are some things that are broken.

For example, when nedjo's patch is applied, then the tags are not being deleted correctly with the deleteHandler(nid) javascript code. Specifically, this section of code: var i = $(this).attr('key'); returns an undefined key, and so the first listed tag is always being deleted (i.e. key =0).

For example, given this code:

<ul class="inline-tags clear-block">
  <li key="0">a_tag</li>
  <li key="1">b_tag</li>
  <li key="2">c_tag</li>
</ul>

If the c_tag was clicked to be deleted, then it would delete the a_tag in any case where an "x" delete tag was clicked.
And therefore deleted taxonomy terms are not properly be deleted from the main term_node table.

killes@www.drop.org’s picture

@KentBye: After applying Nedjo's patch, the JS you mention doesn't appear in the file anymore. I am a bit confused. :)

KentBye’s picture

Yeah, Nedjo's patch was from back in May '07, and there has been some changes committed since then.
Unfortunately, there hasn't been an official release, and so it's difficult to suggest downloading a specific point release.

But my recollection is that Nedjo's patch still applied to 2nd update of Community Tags after the 5.x port (i.e. the May 3rd versions listed)

http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/community_t...
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/community_t...
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/community_t...
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/community_t...
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/community_t...

plus delete.png & tag.png

chaps2’s picture

Status: Active » Closed (duplicate)

Duplicate of #514686: How to show the tagging widget in the teaser or node list view? which works in 6.x-1.x-beta4 and on.