Skip to content

Added option to specify node-specific icons. Fixes nickperkinslondon/angular-bootstrap-nav-tree#21 #82

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions dist/abn_tree_directive.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/abn_tree_directive.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,13 @@ module.directive 'abnTree',['$timeout',($timeout)->
# <i class="icon-plus"></i>
#
if not branch.noLeaf and (not branch.children or branch.children.length == 0)
tree_icon = attrs.iconLeaf
tree_icon = if branch.iconLeaf then branch.iconLeaf else attrs.iconLeaf
branch.classes.push "leaf" if "leaf" not in branch.classes
else
if branch.expanded
tree_icon = attrs.iconCollapse
tree_icon = if branch.iconCollapse then branch.iconCollapse else attrs.iconCollapse
else
tree_icon = attrs.iconExpand
tree_icon = if branch.iconExpand then branch.iconExpand else attrs.iconExpand


#
Expand Down
5 changes: 5 additions & 0 deletions test/test_page.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,20 @@ app.controller 'AbnTestController',($scope,$timeout)->
label:'Oranges'
,
label:'Apples'
iconCollapse: 'icon-hand-down glyphicon glyphicon-hand-down fa fa-hand-down'
iconExpand: 'icon-hand-right glyphicon glyphicon-hand-right fa fa-hand-right'
children:[
label:'Granny Smith'
onSelect:apple_selected
iconLeaf:'icon-heart-empty glyphicon glyphicon-heart-empty fa fa-heart-empty'
,
label:'Red Delicous'
onSelect:apple_selected
iconLeaf:'icon-star glyphicon glyphicon-star fa fa-star'
,
label:'Fuji'
onSelect:apple_selected
iconLeaf:'icon-music glyphicon glyphicon-music fa fa-music'
]
]
,
Expand Down
11 changes: 8 additions & 3 deletions test/test_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,21 @@
label: 'Oranges'
}, {
label: 'Apples',
iconCollapse: 'icon-hand-down glyphicon glyphicon-hand-down fa fa-hand-down',
iconExpand: 'icon-hand-right glyphicon glyphicon-hand-right fa fa-hand-right',
children: [
{
label: 'Granny Smith',
onSelect: apple_selected
onSelect: apple_selected,
iconLeaf: 'icon-heart-empty glyphicon glyphicon-heart-empty fa fa-heart-empty'
}, {
label: 'Red Delicous',
onSelect: apple_selected
onSelect: apple_selected,
iconLeaf: 'icon-star glyphicon glyphicon-star fa fa-star'
}, {
label: 'Fuji',
onSelect: apple_selected
onSelect: apple_selected,
iconLeaf: 'icon-music glyphicon glyphicon-music fa fa-music'
}
]
}
Expand Down