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'


Origin commit data
------------------
Commit: a78fcbc6a9
Author: vanhofen <vanhofen@gmx.de>
Date: 2013-07-05 (Fri, 05 Jul 2013)

Origin message was:
------------------
- 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:
vanhofen
2013-07-05 16:08:30 +02:00
parent e1f3c21df0
commit 51fd69f2d8
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();