Created
January 14, 2015 03:16
-
-
Save NickBolles/ad383387180a50ad2790 to your computer and use it in GitHub Desktop.
designer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="import" href="../polymer/polymer.html"> | |
<link rel="import" href="../core-menu/core-submenu.html"> | |
<link rel="import" href="../core-item/core-item.html"> | |
<link rel="import" href="../core-icons/core-icons.html"> | |
<script> | |
PolymerExpressions.prototype.json = function(object) { | |
return JSON.stringify(object); | |
} | |
</script> | |
<polymer-element name="recursive-menu" attributes="items selected selectedItem"> | |
<template> | |
<core-menu selected="{{selected}}" selectedItem="{{item}}" on-core-select="{{onSelect}}"> | |
<template repeat="{{items}}" id="test"> | |
<template if="{{children}}"> | |
<template if="{{children.length > 0}}"> | |
<core-submenu label="{{ label }} submenu" icon="{{icon}}" > | |
<template repeat="{{child, childIndex in children}}"> | |
<core-item label="{{child.label}}"> | |
</core-item> | |
</template> | |
<!--<template ref="test" repeat="{{children}}"></template>--> | |
</core-submenu> | |
</template> | |
</template> | |
<template if="{{!children}}"> | |
<core-item label="{{ label }} item" icon="{{icon}}" > | |
</core-item> | |
</template> | |
</template> | |
</core-menu> | |
<div>selected label: {{item.label}}</div> | |
<div>selected item: {{selected}}</div> | |
</template> | |
<script> | |
//{{ function(){ if (item.children.length > 0){console.log("RETURNING TRUE!!!"); return true;}else{console.log("RETRURNING FALSE"); return false;} } }} | |
Polymer('recursive-menu',{ | |
onSelect:function(){ | |
debugger; | |
console.log("Selected"); | |
}, | |
created: function() { | |
this.selectedItem = null; | |
this.selected = -1; | |
this.items = [ | |
{"id":1, "label": "item 1", "action": "", "icon":"arrow-back", "children": [ | |
{"id":1, "label": "item 1-1", "action": "", "icon":"assignment-ind", "children":[ | |
{"id":1, "label": "item 1-1-1", "action": "", "icon":"grade", "children":[ | |
{"id":1, "label": "item 1-1-1", "action": "", "icon":"filter-list" } | |
] | |
} | |
] | |
}, | |
{"id":1, "label": "item 1-2", "action": "", "icon":"done-all", "children":[ | |
{"id":1, "label": "item 1-2-1", "action": "", "icon":"folder" } | |
] | |
} | |
] | |
}, | |
{"id":2, "label": "item 2", "action": "", "icon":"group-work", "children":[ | |
{"id":2, "label": "item 2-1", "action": "", "icon":"send-money" } | |
] | |
}, | |
{"id":3, "label": "item 3", "action": "", "icon":"settings-backup-restore"}, | |
{"id":4, "label": "item 4","action": "", "icon":"shopping-cart"}, | |
{"id":5, "label": "item 5","action": "", "icon":"settings"} | |
] | |
} | |
}); | |
</script> | |
</polymer-element> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment