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

Commit

Permalink
Add optional wrapping buttons with angular conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
pkrp committed Feb 15, 2016
1 parent cf3ef29 commit b911888
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ bower install iisg/cytoscape-actionbar --save
icon: 'fa fa-search-minus' # class for actionbar button
tooltip: 'Zoom out' # button tooltip message
action: (cy) -> # function to call
condition: $compile("<span ng-show='isVisible'></span>")($scope) # optional compiled angular expression which wraps button
...
},
..
Expand Down
8 changes: 7 additions & 1 deletion src/CytoscapeActionbar.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@
$.each(options.items, (itemIndex, element) ->
clazz = options.actionItemClass + ' icon ' + element.icon
$element = $("<span id='action-#{itemIndex}' class='#{clazz}' title='#{element.tooltip}'></span>")
$actionbar.append($element)

if element.condition
$condition = $(element.condition)
$actionbar.append($condition)
$($actionbar[0].lastChild).append($element)
else
$actionbar.append($element)

$element
.on('click', ->
Expand Down

0 comments on commit b911888

Please sign in to comment.