Currently menu_minipanels.js parses the contents of the page to find menu minipanels for the page. This however has a few issues:

  • Requiring regular expression to detect menu id.
  • Javascript errors from settings Drupal.settings.menuMinipanels.panels[panel_MLID] not existing, if it was added to the page after the drupal_add_js settings were applied.
  • Recursion, if a menu minipanel contains a panel that has a menu with a menu minipanel assigned to it.

Patch to follow.

Comments

codycraven’s picture

Status: Active » Needs review
StatusFileSize
new4.01 KB

The attached patch addresses all three points of concern.

  • No regular expressions are needed as jQuery selectors are selected by their recorded data in Drupal.settings.menuMinipanels.panels[panel_MLID]
  • Javascript errors will not occur as a qTip will not be attempted to be generated except when there is settings data present.
  • A filter is present to eliminate the potential for recursion.
codycraven’s picture

Forgot to mention, this also allows menu_minipanels to continue functioning if a site overrides the theming of menus to not use a ul li a structure.

damienmckenna’s picture

Status: Needs review » Fixed

Nice patch. Committed.

damienmckenna’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Fixed » Patch (to be ported)

This needs to be ported to D7 so we can keep both codebases close.

damienmckenna’s picture

Assigned: Unassigned » damienmckenna
damienmckenna’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new5.11 KB

Could use some review.

damienmckenna’s picture

It appears to still work in my testing. I think it's good to go.

damienmckenna’s picture

@codycraven: Out of interest, was there a reason to remove the $ in front of the 'target' variable? It was my understanding that was a coding standard for variables that point to jQuery objects?

damienmckenna’s picture

Upon reading the JS coding standards I don't anything about using $, so I'm going to remove it.

damienmckenna’s picture

Of course then I look in contextual.js and see lines like the following:

Drupal.behaviors.contextualLinks = {
  attach: function (context) {
    $('div.contextual-links-wrapper', context).once('contextual-links', function () {
      var $wrapper = $(this);
      var $region = $wrapper.closest('.contextual-links-region');
      var $links = $wrapper.find('ul.contextual-links');
damienmckenna’s picture

StatusFileSize
new5.11 KB

This patch improves upon the one from #6 but makes the $var naming structure consistent.

damienmckenna’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
StatusFileSize
new1.08 KB

This patch for the D6 branch updates the variable naming.

damienmckenna’s picture

Status: Needs review » Fixed

Committed. Thanks @codycraven.

Status: Fixed » Closed (fixed)

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

damienmckenna’s picture

Assigned: damienmckenna » Unassigned
Issue summary: View changes