From 5d27ed4df6fc7c276b39301be8b0577ee64463e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?"J.=20Rene=CC=81e=20Beach"?= Date: Mon, 6 May 2013 13:38:47 -0400 Subject: [PATCH] fix for /admin path bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: J. ReneĢe Beach --- core/modules/contextual/contextual.toolbar.js | 36 +++++++++++++------------ 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/core/modules/contextual/contextual.toolbar.js b/core/modules/contextual/contextual.toolbar.js index 3742c43..869d9ea 100644 --- a/core/modules/contextual/contextual.toolbar.js +++ b/core/modules/contextual/contextual.toolbar.js @@ -50,25 +50,27 @@ function initContextualToolbar (context) { }); // Show the edit tab while there's >=1 contextual link. - var collection = Drupal.contextual.collection; - var updateVisibility = function () { - model.set('isVisible', collection.length > 0); - }; - collection.on('reset remove add', updateVisibility); - updateVisibility(); - - // Whenever edit mode is toggled, update all contextual links. - model.on('change:isViewing', function() { - collection.each(function (contextualModel) { - contextualModel.set('isLocked', !model.get('isViewing')); + var collection = Drupal.contextual && Drupal.contextual.collection; + if (collection) { + var updateVisibility = function () { + model.set('isVisible', collection.length > 0); + }; + collection.on('reset remove add', updateVisibility); + updateVisibility(); + + // Whenever edit mode is toggled, update all contextual links. + model.on('change:isViewing', function() { + collection.each(function (contextualModel) { + contextualModel.set('isLocked', !model.get('isViewing')); + }); }); - }); - // Checks whether localStorage indicates we should start in edit mode - // rather than view mode. - // @see Drupal.contextualToolbar.VisualView.persist() - if (localStorage.getItem('Drupal.contextualToolbar.isViewing') === 'false') { - model.set('isViewing', false); + // Checks whether localStorage indicates we should start in edit mode + // rather than view mode. + // @see Drupal.contextualToolbar.VisualView.persist() + if (localStorage.getItem('Drupal.contextualToolbar.isViewing') === 'false') { + model.set('isViewing', false); + } } } -- 1.7.10.4