From ebafecd20942dba320ea99cb87935c15233ffd46 Mon Sep 17 00:00:00 2001 From: OldHawk Date: Tue, 22 May 2018 23:42:05 +0800 Subject: [PATCH] feat(albums): add top menu item of albums --- .../client/config/albums.client.menus.js | 19 +++++++++++++ .../chat/client/config/chat.client.menus.js | 2 +- modules/core/client/app/trans-string-en.js | 1 + modules/core/client/app/trans-string-zh-tw.js | 3 +- modules/core/client/app/trans-string-zh.js | 3 +- .../controllers/header.client.controller.js | 28 +++++++++++++++++-- .../core/client/views/header.client.view.html | 2 +- .../client/config/forums.client.menus.js | 2 +- .../client/config/requests.client.menus.js | 2 +- .../client/config/torrents.client.menus.js | 2 +- modules/vip/client/config/vip.client.menus.js | 2 +- 11 files changed, 55 insertions(+), 11 deletions(-) create mode 100644 modules/albums/client/config/albums.client.menus.js diff --git a/modules/albums/client/config/albums.client.menus.js b/modules/albums/client/config/albums.client.menus.js new file mode 100644 index 00000000..592b2d02 --- /dev/null +++ b/modules/albums/client/config/albums.client.menus.js @@ -0,0 +1,19 @@ +(function () { + 'use strict'; + + angular + .module('albums') + .run(menuConfig); + + menuConfig.$inject = ['menuService']; + + function menuConfig(menuService) { + // Set top bar menu items + menuService.addMenuItem('topbar', { + title: 'MENU_ALBUMS', + state: 'albums.list', + roles: ['*'], + position: 1 + }); + } +}()); diff --git a/modules/chat/client/config/chat.client.menus.js b/modules/chat/client/config/chat.client.menus.js index 2f2bcaf3..199775c1 100644 --- a/modules/chat/client/config/chat.client.menus.js +++ b/modules/chat/client/config/chat.client.menus.js @@ -14,7 +14,7 @@ state: 'chat', roles: ['*'], target: '_blank', - position: 2 + position: 6 }); } }()); diff --git a/modules/core/client/app/trans-string-en.js b/modules/core/client/app/trans-string-en.js index f06a28d2..820d4340 100644 --- a/modules/core/client/app/trans-string-en.js +++ b/modules/core/client/app/trans-string-en.js @@ -32,6 +32,7 @@ }, //client topbar menu + MENU_ALBUMS: 'Albums', MENU_CHAT: 'Chat', MENU_TORRENTS: 'Torrents', MENU_TORRENTS_ADMIN: 'Manage Torrents', diff --git a/modules/core/client/app/trans-string-zh-tw.js b/modules/core/client/app/trans-string-zh-tw.js index 93598624..6063a610 100644 --- a/modules/core/client/app/trans-string-zh-tw.js +++ b/modules/core/client/app/trans-string-zh-tw.js @@ -32,7 +32,8 @@ }, //client topbar menu - MENU_CHAT: '聊天室', + MENU_ALBUMS: '專輯', + MENU_CHAT: '聊天', MENU_TORRENTS: '種子', MENU_TORRENTS_ADMIN: '種子管理', MENU_UPLOADER_ADMIN: '上傳許可權管理', diff --git a/modules/core/client/app/trans-string-zh.js b/modules/core/client/app/trans-string-zh.js index f3480efa..3a34cf96 100644 --- a/modules/core/client/app/trans-string-zh.js +++ b/modules/core/client/app/trans-string-zh.js @@ -32,7 +32,8 @@ }, //client topbar menu - MENU_CHAT: '聊天室', + MENU_ALBUMS: '专辑', + MENU_CHAT: '聊天', MENU_TORRENTS: '种子', MENU_TORRENTS_ADMIN: '种子管理', MENU_UPLOADER_ADMIN: '上传权限管理', diff --git a/modules/core/client/controllers/header.client.controller.js b/modules/core/client/controllers/header.client.controller.js index 447529c6..1ecac2d9 100644 --- a/modules/core/client/controllers/header.client.controller.js +++ b/modules/core/client/controllers/header.client.controller.js @@ -34,6 +34,9 @@ $scope.$on('$stateChangeSuccess', stateChangeSuccess); + /** + * document.ready() + */ $(document).ready(function () { $('#warning_popup').popup({ outline: false, @@ -47,9 +50,11 @@ }); }); + /** + * window.resize() + */ $(window).resize(function () { - console.log($(window).innerWidth()+15); - if ($(window).innerWidth() <= (767-15)) { + if (window.outerWidth <= 767) { $('div.navbar-mt ul.nav li.dropdown').off('mouseenter mouseleave'); $('div.navbar-mt ul.nav li.dropdown').off('click'); $('div.navbar-mt ul.nav li.dropdown ul.dropdown-menu').off('mouseenter mouseleave'); @@ -63,7 +68,7 @@ */ vm.bindHoverToMenuItem = function () { //set menu bar opened when hover - if ($(window).innerWidth() > (767-15)) { + if (window.outerWidth > 767) { $timeout(function () { $('div.navbar-mt ul.nav li.dropdown').off('mouseenter mouseleave').hover(function (evt) { if (!$(this).hasClass('open')) { @@ -97,6 +102,23 @@ } }; + $scope.$watch(function () { + return $('#nav-top-menu').width(); + }, function (newVal, oldVal) { + if (newVal) { + if (window.outerWidth > 767 && window.outerWidth < 992) { //sm screen + if (newVal > 540) { + $('a[ui-sref="chat"]').css('display', 'none'); + } + } else if (window.outerWidth > 991 && window.outerWidth < 1200) { //md screen + if (newVal > 580) { + $('a[ui-sref="chat"]').css('display', 'none'); + } + } else { + $('a[ui-sref="chat"]').css('display', 'block'); + } + } + }); /** * auth-user-changed */ diff --git a/modules/core/client/views/header.client.view.html b/modules/core/client/views/header.client.view.html index 7ff27125..94bcce57 100644 --- a/modules/core/client/views/header.client.view.html +++ b/modules/core/client/views/header.client.view.html @@ -10,7 +10,7 @@ {{vm.appConfig.name}}