i18n Menu

Permalink
How do I make a drop down menu like when you click to edit/add a block? See attached for reference.

I've been looking through the code and can't seem to find an example.

1 Attachment

ijessup
 
ijessup replied on at Permalink Reply 1 Attachment
ijessup
Figured it out. Code follows:

External JS File:
ccm_showMenu = function(obj, e, items) {
   var addOnly = (obj.addOnly)?1:0;
   ccm_hideMenus();
   e.stopPropagation();
   ccm_menuActivated = true;
   // now, check to see if this menu has been made
   var aobj = document.getElementById("ccm-item-menu" + obj.attr("itemID"));
   if (!aobj) {
      // create the 1st instance of the menu
      el = document.createElement("DIV");
      el.id = "ccm-item-menu" + obj.attr("itemID");
      el.className = "ccm-menu";
      el.style.display = "none";
      document.body.appendChild(el);
      aobj = $("#ccm-item-menu" + obj.attr("itemID"));
Add onClick event:
<script type="text/javascript">
var menuItems = [
   {
      'title' : 'Add Something',
      'iconURL' : CCM_IMAGE_PATH + '/icons/add.png',
      'ID' : 'menuAddNewBlock' + $(this).attr("menuID"), //optional 
      'URL' : '', 
      'width' :  550, //optional 
      'height' : 380 //optional
   },
   {'break' : 1 },
   {
      'title' : 'Another Add Something',
      'iconURL' : CCM_IMAGE_PATH + '/icons/add.png',
      'ID' : 'anotherUniqueID' + $(this).attr("menuID"), //optional
Attached shows the results of using the menuItem variable.
ijessup replied on at Permalink Reply
ijessup
Sorry, the above assumes you have the dialog window js active as well. Other wise the menu item is just a regular link.
var menuItems = [
   {
      'title' : 'Add Something',
      'iconURL' : CCM_IMAGE_PATH + '/icons/add.png',
      'ID' : 'menuItem_' + $(this).attr("menuID"), 
      'URL' : ''
   },
   {'break' : 1 },
   {
      'title' : 'Another Add Something',
      'iconURL' : CCM_IMAGE_PATH + '/icons/add.png',
      'ID' : 'menuItem_' + $(this).attr("menuID"), 
      'URL' : ''
   }
]
Balance replied on at Permalink Reply
Hi,

Thanks for the code,
Minor correction needed to display the icons:
<span style="background-image: url(' + iconURL +')">'

The closing ")" was missing from your code.
TheRealSean replied on at Permalink Reply
TheRealSean
I think I am missing something here I am attempting to use this in the dashboard.

I have loaded the custom.js

But when I select the div, I get a "Uncaught ReferenceError: e is not defined", am I not including something here? I thought that the dialog js had been loaded?