function createContextMenu(id, items) {
      var menu, item, i;
      menu = '<ul id="' + id + '" class="dropdown-menu" role="menu" ' +
             'style="display: none; z-index: 999;">';

      for (i = 0; i < items.length; i++) {
        item = items[i];
        if (item.role && !userHasRole(item.role)) {
          continue;
        }
        if (item.name === '-') {
          menu += '<li class="divider"></li>';
        } else {
          menu += '<li><a href="#" tabindex="-1">' + item.name + '</a></li>';
        }
      }

      menu += '</ul>';
      $('body').append(menu);
    }
/**
     * Create the context menus dynamically
     *
     * @param  {String} id    The ID of the context menu.
     * @param  {Array}  items An array of menu item objects - specifying at least a name.
     * @return {undefined}
     */
Create the context menus dynamically
@param  {String} id    The ID of the context menu.
@param  {Array}  items An array of menu item objects - specifying at least a name.
@return {undefined}
Create the context menus dynamically @param { String } id The ID of the context menu . @param { Array } items An array of menu item objects - specifying at least a name . @return { undefined }
function createContextMenu(id, items) {
      var menu, item, i;
      menu = '<ul id="' + id + '" class="dropdown-menu" role="menu" ' +
             'style="display: none; z-index: 999;">';
      for (i = 0; i < items.length; i++) {
        item = items[i];
        if (item.role && !userHasRole(item.role)) {
          continue;
        }
        if (item.name === '-') {
          menu += '<li class="divider"></li>';
        } else {
          menu += '<li><a href="#" tabindex="-1">' + item.name + '</a></li>';
        }
      }
      menu += '</ul>';
      $('body').append(menu);
    }
function createContextMenu ( id , items ) { var menu , item , i ; menu = '<ul id="' + id + '" class="dropdown-menu" role="menu" ' + 'style="display: none; z-index: 999;">' ; for ( i = 0 ; i < items . length ; i ++ ) { item = items [ i ] ; if ( item . role && ! userHasRole ( item . role ) ) { continue ; } if ( item . name === '-' ) { menu += '<li class="divider"></li>' ; } else { menu += '<li><a href="#" tabindex="-1">' + item . name + '</a></li>' ; } } menu += '</ul>' ; $ ( 'body' ) . append ( menu ) ; }
Create the context menus dynamically
 @param  {String} id    The ID of the context menu.
Create the context menus dynamically @param { String } id The ID of the context menu .