New behavior for Admin Menu Dropdown

markus_petrux - March 16, 2008 - 15:10
Project:Administration Menu Dropdown
Version:5.x-1.x-dev
Component:User interface
Category:feature request
Priority:normal
Assigned:Deciphered
Status:closed
Description

Hi,

I've been using a javascript snippet with this module to toggle admin menu visibility. It's pretty small and uses jQuery. Maybe you could add something like this.

Here's the snippet I use, if anyone want to give it a try:

if (Drupal.jsEnabled) {
  Drupal.admin_menu_fix = {
    init: function() {
      $("div#admin-menu").children("ul:first").children("li:gt(0)").hide();
      $("div#admin-menu").width("24px").height("24px").css("overflow","hidden");
      $("img.admin-menu-icon").attr("src","/favicon.ico").css("cursor","pointer").title("Click here to toggle administration menu visibility!");
      $("li.admin-menu-icon:first a:first").css("padding","4px");
      Drupal.admin_menu_fix.is_ready = true;
      Drupal.admin_menu_fix.is_collapsed = true;
      $("li.admin-menu-icon:first a:first").click(function() {
        this.blur();
        if (!Drupal.admin_menu_fix.is_ready) return;
        Drupal.admin_menu_fix.is_ready = false;
        if (Drupal.admin_menu_fix.is_collapsed) {
          $("div#admin-menu").width("100%").css("overflow","visible").children("ul:first").children("li:gt(0)").show();
          Drupal.admin_menu_fix.is_collapsed = false;
        }
        else {
          $("div#admin-menu").width("24px").css("overflow","hidden").children("ul:first").children("li:gt(0)").hide();
          Drupal.admin_menu_fix.is_collapsed = true;
        }
        Drupal.admin_menu_fix.is_ready = true;
        return false;
      });
    }
  };
  $(document).ready(Drupal.admin_menu_fix.init);
}

As it is, just place into any .js file, i.e. admin_menu_toggle.js and then something like the following in your page.tpl.php script.
<?php if (user_access('access administration menu')) : ?>
<script type="text/javascript" src="<?=base_path() . path_to_theme()?>/js/admin_menu_toggle.js"></script>
<?php endif; ?>

Adjust path to suit your needs.

Cheers

#1

sun - April 2, 2008 - 22:14
Project:Administration menu» Administration Menu Dropdown
Version:5.x-2.x-dev» 5.x-1.x-dev

I think this feature request is more appropriate for the Administration Menu Dropdown enhancement module. Thus, moving over there.

#2

Deciphered - June 15, 2008 - 23:24
Assigned to:Anonymous» Deciphered

Looking into this as a secondary mode.

#3

Deciphered - June 25, 2008 - 07:53
Title:Toggle admin menu with javascript» New behavior for Admin Menu Dropdown
Status:active» fixed

New behavior added to 5.x-2.x-dev and 6.x-2.x-dev which should be available shortly.

#4

Anonymous (not verified) - July 9, 2008 - 08:02
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.