From fbfa99f71c2759998182c8a4f9e66d57496f17ed Mon Sep 17 00:00:00 2001
From: Charles Fulton <fultonc@lafayette.edu>
Date: Thu, 16 May 2013 14:20:16 -0400
Subject: [PATCH] [#1816412] update the add block menu on block removal

---
 homebox.js     | 4 ++++
 homebox.module | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/homebox.js b/homebox.js
index edfd59c..72823d5 100644
--- a/homebox.js
+++ b/homebox.js
@@ -241,6 +241,10 @@
         // Attach click event on close
         $portletHeader.find('.portlet-close').click(function () {
           $portlet.hide();
+
+          // Update add block menu
+          $('div#homebox-add').find('a#' + $portlet.attr('id').replace('homebox-block-', 'homebox-menu-')).removeAttr('class');
+
           Drupal.homebox.equalizeColumnsHeights();
           Drupal.homebox.pageChanged();
         });
diff --git a/homebox.module b/homebox.module
index 0d0407a..1c81cab 100644
--- a/homebox.module
+++ b/homebox.module
@@ -396,9 +396,9 @@ function homebox_build($page) {
     $add_links = array();
     foreach ($allowed_blocks as $module => $blocks) {
       foreach ($blocks as $delta => $info) {
-        $options = array();
+        $options = array('attributes' => array('id' => 'homebox-menu-'.$module.'_'.$delta));
         if (isset($info['used'])) {
-          $options['attributes'] = array('class' => 'used');
+          $options['attributes']['class'] = 'used';
         }
         $add_links[] = homebox_add_link($info['info'], $page, $module, $delta, $options);
       }
-- 
1.8.2.1

