Use jquery to show vocabs according to selected group

whyameye - September 30, 2008 - 17:52
Project:OG Vocabulary
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work
Description

I've done some reading here and it appears that this might be expected behavior, but I would like to confirm: I cannot see the drop-down list of og categories in my group when creating a blog post. If I hit "preview" I still cannot see the list. I can only see the list if I post to the group, then edit the post.

This is a real problem for me as my users need to be required to choose a category/vocab/taxonomy/whatever-the-nomenclature when posting. I have been looking at using rules with tokens to force edit following blog post submission, but that seems awkward and besides I can't get it to work. Any other ideas or am I missing something obvious?

Drupal 6.4

#1

Amitaibu - December 24, 2008 - 17:15

#2

whyameye - January 9, 2009 - 15:13
Category:support request» feature request
Status:duplicate» active

this isn't a duplicate. What I am saying is that you have to hit "preview" before you can see the vocab for the group you have chosen when you are creating new content. What would be much more intuitive for users in my opinion is if this module used JQuery or AJAX to show the vocabs available for each group at the time the group is chosen, rather after the form is submitted.

#3

Amitaibu - January 9, 2009 - 15:16
Title:cannot see og group vocab unless editing a preexisting post» Use jquery to show vocabs according to selected group
Component:Documentation» Code

Nice idea. A patch is welcomed.

#4

darren.ferguson - May 14, 2009 - 19:44

This is really funny since this is the functionality i was actually looking to get into the og vocab module.

Based off this attached is a patch that we currently run for it providing the css, js and updated module patch.

Please let me know if this will meet the needs.

We utilize it so we can attach posts and also things like files directly to the term in the audience from either the add or edit portion in the system. This original code came about due to the need for it in the add portion mostly.

AttachmentSize
og_vocab-315373.patch 2.29 KB
og_vocab-315373.tar_.gz 1008 bytes

#5

Amitaibu - May 14, 2009 - 20:57
Status:active» needs work

@darren,
Thank you for the patch.

og_vocab.module:

+ $vocabularies = db_query("SELECT nid, vid FROM {og_vocab}");

We don't need *all* vocabs, we just need to get those that are related to this node. So you can use og_vocab_get_vocabularies().

og_vocab.js:

+ if (Drupal.jsEnabled) {
+ ...
+ }

You can use Drupal.Behaviours, so we won't need this part.

btw, can you please re-roll it with the JS and CSS included (not tar) - http://drupal.org/patch/create, so I'll test the code.

#6

darren.ferguson - May 15, 2009 - 12:51

The reason behind getting all of them was that if the node has not been created yet then we would like all of the audiences so we can hide and show them as needed. As i said this patch originally was done because we wanted to make sure uploaded files were put into the correct audience and then the blog posting would go to a specific taxonomy based off the audience that was supplied. Hence since the audience is not known in the begining this is why i took all of them in the begining and the jquery will show and hide based off the audience that is selected.

 
 

Drupal is a registered trademark of Dries Buytaert.