From 96c9efc376883ae2fd742a2c2f720af374a2cb88 Mon Sep 17 00:00:00 2001 From: OldHawk Date: Thu, 21 Sep 2017 11:24:47 +0800 Subject: [PATCH] feat(config): add torrent type config of software and eBook --- config/env/torrents.js | 40 +++++++++++++++++++ modules/core/client/app/trans-string-en.js | 13 ++++++ modules/core/client/app/trans-string-zh.js | 13 ++++++ .../client/config/torrents.client.menus.js | 23 +++++++---- .../client/config/torrents.client.routes.js | 20 +++++----- 5 files changed, 93 insertions(+), 16 deletions(-) diff --git a/config/env/torrents.js b/config/env/torrents.js index c3c6823c..18003e45 100644 --- a/config/env/torrents.js +++ b/config/env/torrents.js @@ -242,11 +242,16 @@ module.exports = { * @url: window location url of type * @divider: divider status of submenu item * @position: position of submenu item(ordered index) + * + * if you add a config json item, please add translate string: + * MENU_TORRENTS_SUB + * TORRENT_TYPE_LABEL */ torrentType: { name: 'TYPE', value: [ { + enable: true, name: 'MOVIE', value: 'movie', title: 'MENU_TORRENTS_SUB.MOVIE', @@ -256,6 +261,7 @@ module.exports = { position: 1 }, { + enable: true, name: 'TVSERIAL', value: 'tvserial', title: 'MENU_TORRENTS_SUB.TVSERIAL', @@ -265,6 +271,7 @@ module.exports = { position: 2 }, { + enable: true, name: 'MUSIC', value: 'music', title: 'MENU_TORRENTS_SUB.MUSIC', @@ -274,6 +281,7 @@ module.exports = { position: 3 }, { + enable: true, name: 'VARIETY', value: 'variety', title: 'MENU_TORRENTS_SUB.VARIETY', @@ -283,6 +291,27 @@ module.exports = { position: 4 }, { + enable: true, + name: 'SOFTWARE', + value: 'software', + title: 'MENU_TORRENTS_SUB.SOFTWARE', + state: 'torrents.software', + url: '/software', + divider: true, + position: 4 + }, + { + enable: true, + name: 'EBOOK', + value: 'ebook', + title: 'MENU_TORRENTS_SUB.EBOOK', + state: 'torrents.ebook', + url: '/ebook', + divider: false, + position: 4 + }, + { + enable: true, name: 'OTHER', value: 'other', title: 'MENU_TORRENTS_SUB.OTHER', @@ -520,6 +549,17 @@ module.exports = { {name: 'INDIA', icon: ''}, {name: 'ARAB', icon: ''} ] + }, + { + name: 'PLATFORM', + cats: ['software'], + value: [ + {name: 'Windows', icon: ''}, + {name: 'MacOS', icon: ''}, + {name: 'Linux', icon: ''}, + {name: 'iOS', icon: ''}, + {name: 'Android', icon: ''} + ] } ], checkbox: [ diff --git a/modules/core/client/app/trans-string-en.js b/modules/core/client/app/trans-string-en.js index c1de78a0..8ed60a14 100644 --- a/modules/core/client/app/trans-string-en.js +++ b/modules/core/client/app/trans-string-en.js @@ -41,6 +41,8 @@ TVSERIAL: 'TVSerial', MUSIC: 'Music', VARIETY: 'Variety', + SOFTWARE: 'Software', + EBOOK: 'eBook', OTHER: 'Other' }, @@ -473,6 +475,8 @@ TVSERIAL: 'TVSerial', MUSIC: 'Music', VARIETY: 'Variety', + SOFTWARE: 'Software', + EBOOK: 'eBook', OTHER: 'Other' }, TORRENT_STATUS_LABEL: { @@ -892,6 +896,15 @@ SELF: 'Music Sub Category', CD: 'CD', MTV: 'MTV' + }, + + PLATFORM: { + SELF: 'Platform', + Windows: 'Windows', + MacOS: 'MacOS', + Linux: 'Linux', + iOS: 'iOS', + Android: 'Android' } } }; diff --git a/modules/core/client/app/trans-string-zh.js b/modules/core/client/app/trans-string-zh.js index 3f6bc9c2..af4e7968 100644 --- a/modules/core/client/app/trans-string-zh.js +++ b/modules/core/client/app/trans-string-zh.js @@ -41,6 +41,8 @@ TVSERIAL: '电视剧', MUSIC: '音乐', VARIETY: '综艺', + SOFTWARE: '软件', + EBOOK: '电子书', OTHER: '其它' }, @@ -473,6 +475,8 @@ TVSERIAL: '电视剧', MUSIC: '音乐', VARIETY: '综艺', + SOFTWARE: '软件', + EBOOK: '电子书', OTHER: '其它' }, TORRENT_STATUS_LABEL: { @@ -892,6 +896,15 @@ SELF: '音乐类型', CD: 'CD', MTV: 'MTV' + }, + + PLATFORM: { + SELF: 'Platform', + Windows: 'Windows', + MacOS: 'MacOS', + Linux: 'Linux', + iOS: 'iOS', + Android: 'Android' } } }; diff --git a/modules/torrents/client/config/torrents.client.menus.js b/modules/torrents/client/config/torrents.client.menus.js index 304a9a73..1d079093 100644 --- a/modules/torrents/client/config/torrents.client.menus.js +++ b/modules/torrents/client/config/torrents.client.menus.js @@ -18,15 +18,24 @@ position: 0 }); + menuService.addMenuItem('topbar', { + title: 'MENU_UPLOAD', + state: 'torrents.uploads', + roles: ['*'], + position: 3 + }); + // Add the dropdown list item angular.forEach(torrentTypeConfig.value, function (cfg) { - menuService.addSubMenuItem('topbar', 'torrents', { - title: cfg.title, - state: cfg.state, - divider: cfg.divider, - roles: ['*'], - position: cfg.position - }); + if (cfg.enable) { + menuService.addSubMenuItem('topbar', 'torrents', { + title: cfg.title, + state: cfg.state, + divider: cfg.divider, + roles: ['*'], + position: cfg.position + }); + } }); } }()); diff --git a/modules/torrents/client/config/torrents.client.routes.js b/modules/torrents/client/config/torrents.client.routes.js index d874f482..6827db03 100644 --- a/modules/torrents/client/config/torrents.client.routes.js +++ b/modules/torrents/client/config/torrents.client.routes.js @@ -30,15 +30,17 @@ }); angular.forEach(torrentTypeConfig.value, function (cfg) { - $stateProvider - .state(cfg.state, { - url: cfg.url, - templateUrl: '/modules/torrents/client/views/torrent-list.client.view.html', - data: { - pageTitle: 'PAGETITLE.MOVIE_LIST', - torrentType: cfg.value - } - }); + if (cfg.enable) { + $stateProvider + .state(cfg.state, { + url: cfg.url, + templateUrl: '/modules/torrents/client/views/torrent-list.client.view.html', + data: { + pageTitle: 'PAGETITLE.MOVIE_LIST', + torrentType: cfg.value + } + }); + } }); $stateProvider