- yweb: add new function 'add_yExtensions()' to avoid duplicate code

* remove prefix '-' from added items
* add class 'y_menu_sec_ext' to added items
* rename unused class 'y_menu_prim_item' to 'y_menu_prim_ext'
This commit is contained in:
svenhoefer
2013-07-05 16:08:30 +02:00
parent 9e90a1ac56
commit a78fcbc6a9
9 changed files with 37 additions and 124 deletions

View File

@@ -182,6 +182,22 @@ Object.extend(Y.extension.prototype, {
},this);
}
});
function add_yExtensions(_ymenu, _id) {
var menu=ext.select_menu(_ymenu);
menu.each(function(e){
var el=new Element('li').update(
new Element('a', {
'class': (_ymenu == 'main') ? 'y_menu_prim_ext' : 'y_menu_sec_ext',
'target': (_ymenu == 'main') ? 'base' : 'work',
'title': e.get('desc'),
'href': e.get('file')
}).update(e.get('menuitem'))
);
$(_id).insert({'bottom':el});
});
}
/* singleton pattern*/
if (window == top.top_main.prim_menu) {
var ext = new Y.extension();