diff --git a/Bootstrap.Admin/Controllers/Api/NotificationsController.cs b/Bootstrap.Admin/Controllers/Api/NotificationsController.cs
index 878d8661..06124094 100644
--- a/Bootstrap.Admin/Controllers/Api/NotificationsController.cs
+++ b/Bootstrap.Admin/Controllers/Api/NotificationsController.cs
@@ -20,6 +20,8 @@ namespace Bootstrap.Admin.Controllers.Api
public Notifications Get()
{
var ret = new Notifications();
+ if (!User.IsInRole("Administrators")) return ret;
+
// New Users
var user = UserHelper.RetrieveNewUsers();
ret.Users = user.Take(6).ToList();
diff --git a/Bootstrap.Admin/wwwroot/js/common-scripts.js b/Bootstrap.Admin/wwwroot/js/common-scripts.js
index 7d70622e..a1491b56 100644
--- a/Bootstrap.Admin/wwwroot/js/common-scripts.js
+++ b/Bootstrap.Admin/wwwroot/js/common-scripts.js
@@ -2,7 +2,7 @@
var cascadeMenu = function (menus) {
var html = "";
$.each(menus, function (index, menu) {
- if (menu.Menus.length == 0) {
+ if (menu.Menus.length === 0) {
html += $.format('
', menu.Id, menu.Icon, menu.Name, menu.Category, menu.Order, menu.CategoryName);
}
else {
@@ -13,7 +13,7 @@
};
var cascadeSubMenu = function (menus) {
- var html = ""
+ var html = "";
$.each(menus, function (index, menu) {
html += $.format('', menu.Id, menu.Icon, menu.Name, menu.Category, menu.Order, menu.CategoryName);
});
@@ -50,7 +50,7 @@
$.extend({
pullNotification: function (nav) {
- if (nav.length == 0) return;
+ if (nav.length === 0) return;
var uri = "ws://" + window.location.host + $.formatUrl("WS");
var socket = new WebSocket(uri);
@@ -67,7 +67,7 @@
toastr.info(msg, "新用户注册");
break;
}
- };
+ }
if (result.length > 0) nav.reloadWidget();
};
}
@@ -81,11 +81,11 @@
swal: false,
method: 'GET',
callback: function (result) {
- $('#logoutNoti').text(result.NewUsersCount);
+ $('#logoutNoti').text(result.NewUsersCount === 0 ? "" : result.NewUsersCount);
that.resetWidget();
// tasks
$('#msgHeaderTask').text(result.TasksCount);
- $('#msgHeaderTaskBadge').text(result.TasksCount);
+ $('#msgHeaderTaskBadge').text(result.TasksCount === 0 ? "" : result.TasksCount);
var htmlUserTemplate = '{0}-{2}{1}%';
var html = result.Tasks.map(function (u) {
return $.format(htmlUserTemplate, u.TaskName, u.TaskProgress, u.AssignDisplayName, u.Id, $.formatUrl('Admin/Tasks'));
@@ -94,7 +94,7 @@
// new users
$('#msgHeaderUser').text(result.NewUsersCount);
- $('#msgHeaderUserBadge').text(result.NewUsersCount);
+ $('#msgHeaderUserBadge').text(result.NewUsersCount === 0 ? "" : result.NewUsersCount);
htmlUserTemplate = '{1}({0})
{3}';
html = result.Users.map(function (u) {
return $.format(htmlUserTemplate, u.UserName, u.DisplayName, u.Description, u.Period, $.formatUrl('Admin/Notifications'));
@@ -103,7 +103,7 @@
// apps
$('#msgHeaderApp').text(result.AppExceptionsCount);
- $('#msgHeaderAppBadge').text(result.AppExceptionsCount);
+ $('#msgHeaderAppBadge').text(result.AppExceptionsCount === 0 ? "" : result.AppExceptionsCount);
htmlUserTemplate = '{0}
{2}';
html = result.Apps.map(function (u) {
return $.format(htmlUserTemplate, u.ExceptionType, u.Message, u.Period, $.formatUrl('Admin/Exceptions'));
@@ -112,7 +112,7 @@
// dbs
$('#msgHeaderDb').text(result.DbExceptionsCount);
- $('#msgHeaderDbBadge').text(result.DbExceptionsCount);
+ $('#msgHeaderDbBadge').text(result.DbExceptionsCount === 0 ? "" : result.DbExceptionsCount);
htmlUserTemplate = '{0}
{2}';
html = result.Dbs.map(function (u) {
return $.format(htmlUserTemplate, u.ErrorPage, u.Message, u.Period, $.formatUrl('Admin/Exceptions'));
@@ -121,7 +121,7 @@
// messages
$('#msgHeaderMsg').text(result.MessagesCount);
- $('#msgHeaderMsgBadge').text(result.MessagesCount);
+ $('#msgHeaderMsgBadge').text(result.MessagesCount === 0 ? "" : result.MessagesCount);
htmlUserTemplate = '{2}{4}{3}';
html = result.Messages.map(function (u) {
return $.format(htmlUserTemplate, u.Id, u.FromIcon, u.FromDisplayName, u.Title, u.Period, u.Content, $.formatUrl('Admin/Messages'));
@@ -149,7 +149,7 @@ $(function () {
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
- }
+ };
var $sidebar = $("#sidebar");
var $main = $('#main-content');
@@ -180,7 +180,7 @@ $(function () {
}
$sidebar.on('click', 'a.dcjq-parent', function () {
- var o = ($(this).offset());
+ var o = $(this).offset();
diff = 110 - o.top;
if (diff > 0)
$sidebar.scrollTo("-=" + Math.abs(diff), 500);
@@ -189,14 +189,14 @@ $(function () {
});
$('.sidebar-toggle-box').on('click', function () {
- if ($sidebar.is(":visible") === true) {
+ if ($sidebar.is(":visible")) {
$main.addClass('closed').removeClass('open');
- $sidebar.parent().toggleClass('open')
- $(window).width() <= 768 ? setTimeout(function () { $sidebar.hide() }, 400) : $sidebar.hide();
+ $sidebar.parent().toggleClass('open');
+ $(window).width() <= 768 ? setTimeout(function () { $sidebar.hide(); }, 400) : $sidebar.hide();
} else {
- $sidebar.show()
- $sidebar.parent().toggleClass('open')
- $(window).width() <= 768 ? setTimeout(function () { $main.addClass('open').removeClass('closed') }, 400) : $main.addClass('open').removeClass('closed');
+ $sidebar.show();
+ $sidebar.parent().toggleClass('open');
+ $(window).width() <= 768 ? setTimeout(function () { $main.addClass('open').removeClass('closed'); }, 400) : $main.addClass('open').removeClass('closed');
}
});