Created
April 13, 2015 15:35
-
-
Save jgdovin/ac2bd1f03f2f50636ce0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
if (Meteor.isClient) { | |
Meteor.subscribe('menuItems'); | |
// counter starts at 0 | |
Session.setDefault('counter', 0); | |
Template.main.helpers({ | |
menuItems : function() { | |
return menuItems.find({parentId : null}); | |
} | |
}); | |
Template.menuItemsTemplate.helpers({ | |
hasChildren: function() { | |
return menuItems.find({parentId : this._id}).count() > 0; | |
}, | |
children: function() { | |
return menuItems.find({parentId: this._id}); | |
} | |
}); | |
Template.main.events({ | |
}); | |
} | |
if (Meteor.isServer) { | |
Meteor.startup(function() { | |
if(menuItems.find().count() === 0) { | |
var firstMenu = menuItems.insert({name: 'Top Level'}); | |
var secondLevel = menuItems.insert({name: 'Second Level 1', parentId: firstMenu}); | |
var thirdLevel = menuItems.insert({name: 'Third Level 1', parentId: secondLevel}); | |
var fourthLevel = menuItems.insert({name: 'Fourth Level', parentId: thirdLevel}); | |
var fifthLevel = menuItems.insert({name: 'This is getting ridiculous', parentId: fourthLevel}); | |
var secondLevel2 = menuItems.insert({name: 'Second Level 2', parentId: firstMenu}); | |
var singleLevel = menuItems.insert({name: 'Top Level again'}); | |
} | |
}); | |
Meteor.publish('menuItems'); | |
} | |
menuItems = new Mongo.Collection('menuItems'); |
This file contains hidden or 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
.dropdown-submenu { | |
position: relative; | |
} | |
.dropdown-submenu>.dropdown-menu { | |
top: 0; | |
left: 100%; | |
margin-top: -6px; | |
margin-left: -1px; | |
-webkit-border-radius: 0 6px 6px 6px; | |
-moz-border-radius: 0 6px 6px; | |
border-radius: 0 6px 6px 6px; | |
} | |
.dropdown-submenu:hover>.dropdown-menu { | |
display: block; | |
} | |
.dropdown-submenu>a:after { | |
display: block; | |
content: " "; | |
float: right; | |
width: 0; | |
height: 0; | |
border-color: transparent; | |
border-style: solid; | |
border-width: 5px 0 5px 5px; | |
border-left-color: #ccc; | |
margin-top: 5px; | |
margin-right: -10px; | |
} | |
.dropdown-submenu:hover>a:after { | |
border-left-color: #fff; | |
} | |
.dropdown-submenu.pull-left { | |
float: none; | |
} | |
.dropdown-submenu.pull-left>.dropdown-menu { | |
left: -100%; | |
margin-left: 10px; | |
-webkit-border-radius: 6px 0 6px 6px; | |
-moz-border-radius: 6px 0 6px 6px; | |
border-radius: 6px 0 6px 6px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment