Skip to content
This repository has been archived by the owner on Apr 3, 2022. It is now read-only.

Commit

Permalink
Adding itemMenuClasses to item
Browse files Browse the repository at this point in the history
  • Loading branch information
izabellaszlosarczyk committed Oct 27, 2017
1 parent ba2fcb9 commit 9c67bf7
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions cytoscape-context-menus.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,12 @@
}

// Get string representation of css classes
function getMenuItemClassStr(classes, hasTrailingDivider) {
var str = getClassStr(classes);
function getMenuItemClassStr(classes, itemClases, hasTrailingDivider) {
var str = classes.join(' ');

if (itemClases != null) {
str += itemClases.join(' ');
}

str += ' ' + menuItemCSSClass;

Expand All @@ -99,21 +103,6 @@
return str;
}

// Get string representation of css classes
function getClassStr(classes) {
var str = '';

for( var i = 0; i < classes.length; i++ ) {
var className = classes[i];
str += className;
if(i !== classes.length - 1) {
str += ' ';
}
}

return str;
}

function displayComponent($component) {
$component.css('display', 'block');
}
Expand Down Expand Up @@ -239,7 +228,7 @@

// create cxtMenu and append it to body
function createAndAppendCxtMenuComponent() {
var classes = getClassStr(options.contextMenuClasses);
var classes = options.contextMenuClasses.join(' ');
// classes += ' cy-context-menus-cxt-menu';
$cxtMenu = $('<div class=' + classes + '></div>');
$cxtMenu.addClass('cy-context-menus-cxt-menu');
Expand All @@ -251,7 +240,7 @@

// Creates a menu item as an html component
function createMenuItemComponent(item) {
var classStr = getMenuItemClassStr(options.menuItemClasses, item.hasTrailingDivider) + " " + item.class;
var classStr = getMenuItemClassStr(options.menuItemClasses, item.menuItemClasses, item.hasTrailingDivider);
var itemStr = '<button id="' + item.id + '" class="' + classStr + '"';

if(item.tooltipText) {
Expand Down

0 comments on commit 9c67bf7

Please sign in to comment.