@@ -13,11 +13,11 @@ var goatMenu = function($scope, $http, $modal, $log, $templateCache) {
13
13
var menuItems = goat . utils . addMenuClasses ( goatConstants . menuPrefix . concat ( menuData . data ) ) ;
14
14
//top-tier 'categories'
15
15
for ( var i = 0 ; i < menuItems . length ; i ++ ) {
16
- menuItems [ i ] . id = menuItems [ i ] . name . replace ( / \s | \( | \) / g , '' ) ; //TODO move the replace routine into util function
16
+ menuItems [ i ] . id = goat . utils . makeId ( menuItems [ i ] . name ) ; //TODO move the replace routine into util function
17
17
menuItems [ i ] . displayClass = ( $scope . openMenu === menuItems [ i ] . id ) ? goatConstants . keepOpenClass : '' ;
18
18
if ( menuItems [ i ] . children ) {
19
19
for ( var j = 0 ; j < menuItems [ i ] . children . length ; j ++ ) {
20
- menuItems [ i ] . children [ j ] . id = menuItems [ i ] . children [ j ] . name . replace ( / \s | \( | \) / g , '' ) ;
20
+ menuItems [ i ] . children [ j ] . id = goat . utils . makeId ( menuItems [ i ] . children [ j ] . name ) ;
21
21
//handle selected Menu state
22
22
if ( menuItems [ i ] . children [ j ] . id === $scope . curMenuItemSelected ) {
23
23
menuItems [ i ] . children [ j ] . selectedClass = goatConstants . selectedMenuClass ;
@@ -32,7 +32,8 @@ var goatMenu = function($scope, $http, $modal, $log, $templateCache) {
32
32
if ( menuItems [ i ] . children [ j ] . children ) {
33
33
for ( var k = 0 ; k < menuItems [ i ] . children [ j ] . children . length ; k ++ ) {
34
34
//TODO make utility function for name >> id
35
- menuItems [ i ] . children [ j ] . children [ k ] . id = menuItems [ i ] . children [ j ] . children [ k ] . name . replace ( / \s | \( | \) / g, '' ) ;
35
+ menuItems [ i ] . children [ j ] . children [ k ] . id = goat . utils . makeId ( menuItems [ i ] . children [ j ] . children [ k ] . name ) ;
36
+ //menuItems[i].children[j].children[k].id = menuItems[i].children[j].children[k].name.replace(/\s|\(|\)/g,'');
36
37
//handle selected Menu state
37
38
if ( menuItems [ i ] . children [ j ] . children [ k ] . id === $scope . curMenuItemSelected ) {
38
39
menuItems [ i ] . children [ j ] . children [ k ] . selectedClass = goatConstants . selectedMenuClass ;
0 commit comments