feat(albums): add top menu item of albums

This commit is contained in:
OldHawk
2018-05-22 23:42:05 +08:00
parent c3fd9399e2
commit ebafecd209
11 changed files with 55 additions and 11 deletions

View File

@@ -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
});
}
}());

View File

@@ -14,7 +14,7 @@
state: 'chat',
roles: ['*'],
target: '_blank',
position: 2
position: 6
});
}
}());

View File

@@ -32,6 +32,7 @@
},
//client topbar menu
MENU_ALBUMS: 'Albums',
MENU_CHAT: 'Chat',
MENU_TORRENTS: 'Torrents',
MENU_TORRENTS_ADMIN: 'Manage Torrents',

View File

@@ -32,7 +32,8 @@
},
//client topbar menu
MENU_CHAT: '聊天室',
MENU_ALBUMS: '專輯',
MENU_CHAT: '聊天',
MENU_TORRENTS: '種子',
MENU_TORRENTS_ADMIN: '種子管理',
MENU_UPLOADER_ADMIN: '上傳許可權管理',

View File

@@ -32,7 +32,8 @@
},
//client topbar menu
MENU_CHAT: '聊天室',
MENU_ALBUMS: '专辑',
MENU_CHAT: '聊天',
MENU_TORRENTS: '种子',
MENU_TORRENTS_ADMIN: '种子管理',
MENU_UPLOADER_ADMIN: '上传权限管理',

View File

@@ -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
*/

View File

@@ -10,7 +10,7 @@
<a ui-sref="home" class="navbar-brand"><span class="brand-title">{{vm.appConfig.name}}</span></a>
</div>
<nav class="navbar-collapse" uib-collapse="!vm.isCollapsed" role="navigation">
<ul class="nav navbar-nav" ng-if="vm.menu.shouldRender(vm.authentication.user);"
<ul class="nav navbar-nav" id="nav-top-menu" ng-if="vm.menu.shouldRender(vm.authentication.user);"
ng-hide="!vm.authentication.user && !vm.signConfig.showMenuHeaderForGuest">
<li ng-repeat="item in vm.menu.items | orderBy: 'position'" ng-if="item.shouldRender(vm.authentication.user);" ng-switch="item.type"
ng-class="{ dropdown: item.type === 'dropdown' }" ui-sref-active="active" class="{{item.class}}"

View File

@@ -13,7 +13,7 @@
title: 'MENU_FORUMS',
state: 'forums.list',
roles: ['*'],
position: 1
position: 5
});
}
}());

View File

@@ -12,7 +12,7 @@
title: 'MENU_REQUESTS',
state: 'requests.list',
roles: ['*'],
position: 6
position: 3
});
}
}());

View File

@@ -23,7 +23,7 @@
title: 'MENU_UPLOAD',
state: 'torrents.uploads',
roles: ['*'],
position: 3
position: 2
});
// menuService.addSubMenuItem('topbar', 'torrents', {

View File

@@ -12,7 +12,7 @@
title: 'MENU_VIP',
state: 'vip.list',
roles: ['*'],
position: 5
position: 4
});
}
}());