I wanted to try out behavior_weights with tinynav so I wrote some code to allow it.

I just switched to using Drupal behaviors and added the weight.

It's seems slightly more elegant like this anyway.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Jaesin’s picture

I forgot to add the new "tininav.js" file to the patch.

This should be applied to the 7.x-1.0-dev branch.

btopro’s picture

Status: Active » Needs work

I agree this is much more elegant (at a glance). I'll take a look at rolling it next week but some further testing from the community would be nice as well. Also not sure that the added js file should be called tinynav.js as that's the name of the jquery library being pulled in. Maybe something like tinynav-integration.js or something to suggest by looking at the files that this is just the integration of the library, the fork is the forked library allowed to be included / built off of and that someone implementing the original library would be tinynav.js (or tinynav.min.js).

So, next steps. Reroll patch with different name for .js file, get testing from someone other then you and I and I think we're RTBC. Nice patch.

Jaesin’s picture

I added some comments to the js file and changed the name to tinynav-drupal.js .

tinynav-drupal.js is also adding a div wrapper to the select element. This is often needed for creating custom dropdowns for a select elements with CSS.

The Additional code:

// Add a wrapper to the select element
$('select.tinynav').wrap('<div class="tinynav-wrapper"/>');
btopro’s picture

Status: Needs work » Fixed

Committed a modified version of your patch. It has true and "flase" as strings and needed to be boolean on the php side. the drupal file was also spelled wrong and there was minor logistical flaws in the handling of active and header which rendered them broken.

I fixed these small issues in the patch and committed it as two commits

updates to a behaviors based approach -- http://drupalcode.org/project/tinynav.git/commit/afd1ac9

updates to tinynav fork -- http://drupalcode.org/project/tinynav.git/commit/c4f4b0d

Jaesin’s picture

Cool, now if someone is having issues with load order, they will just need to install behavior_weights to make sure tinynav loads last.

btopro’s picture

If that's the OP we could also just apply the drupal_add_js call with a lower weight, there's no reason for it to fire before things that would potentially cause an issue but that can be resolved in another thread if that's a feature desired.

Status: Fixed » Closed (fixed)

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