feat(core): load torrent type submenu items from torrent.js configure items

This commit is contained in:
OldHawk
2017-09-20 16:05:29 +08:00
parent 7e38012d59
commit 2f39da00b9

View File

@@ -5,9 +5,12 @@
.module('torrents')
.run(menuConfig);
menuConfig.$inject = ['menuService'];
menuConfig.$inject = ['menuService', 'MeanTorrentConfig'];
function menuConfig(menuService, MeanTorrentConfig) {
var torrentTypeConfig = MeanTorrentConfig.meanTorrentConfig.torrentType;
console.log(torrentTypeConfig);
function menuConfig(menuService) {
menuService.addMenuItem('topbar', {
title: 'MENU_TORRENTS',
state: 'torrents',
@@ -17,31 +20,42 @@
});
// Add the dropdown list item
menuService.addSubMenuItem('topbar', 'torrents', {
title: 'MENU_TORRENTS_SUB.MOVIE',
state: 'torrents.movie',
roles: ['*']
});
menuService.addSubMenuItem('topbar', 'torrents', {
title: 'MENU_TORRENTS_SUB.TVSERIAL',
state: 'torrents.tvserial',
roles: ['*']
});
menuService.addSubMenuItem('topbar', 'torrents', {
title: 'MENU_TORRENTS_SUB.MUSIC',
state: 'torrents.music',
roles: ['*']
});
menuService.addSubMenuItem('topbar', 'torrents', {
title: 'MENU_TORRENTS_SUB.OTHER',
state: 'torrents.other',
roles: ['*']
});
menuService.addMenuItem('topbar', {
title: 'MENU_UPLOAD',
state: 'torrents.uploads',
roles: ['*'],
position: 3
angular.forEach(torrentTypeConfig.value, function (cfg) {
menuService.addSubMenuItem('topbar', 'torrents', {
title: cfg.title,
state: cfg.state,
divider: cfg.divider,
roles: ['*'],
position: cfg.position
});
});
//
//
//menuService.addSubMenuItem('topbar', 'torrents', {
// title: 'MENU_TORRENTS_SUB.MOVIE',
// state: 'torrents.movie',
// roles: ['*']
//});
//menuService.addSubMenuItem('topbar', 'torrents', {
// title: 'MENU_TORRENTS_SUB.TVSERIAL',
// state: 'torrents.tvserial',
// roles: ['*']
//});
//menuService.addSubMenuItem('topbar', 'torrents', {
// title: 'MENU_TORRENTS_SUB.MUSIC',
// state: 'torrents.music',
// roles: ['*']
//});
//menuService.addSubMenuItem('topbar', 'torrents', {
// title: 'MENU_TORRENTS_SUB.OTHER',
// state: 'torrents.other',
// roles: ['*']
//});
//menuService.addMenuItem('topbar', {
// title: 'MENU_UPLOAD',
// state: 'torrents.uploads',
// roles: ['*'],
// position: 3
//});
}
}());