2016-11-16 23:47:01 +08:00
|
|
|
|
$(function () {
|
2016-10-20 17:55:29 +08:00
|
|
|
|
$('#nav-accordion').dcAccordion({
|
|
|
|
|
eventType: 'click',
|
|
|
|
|
autoClose: true,
|
|
|
|
|
saveState: true,
|
|
|
|
|
disableLink: true,
|
|
|
|
|
speed: 'slow',
|
|
|
|
|
showCount: false,
|
|
|
|
|
autoExpand: true,
|
|
|
|
|
// cookie: 'dcjq-accordion-1',
|
|
|
|
|
classExpand: 'dcjq-current-parent'
|
|
|
|
|
});
|
|
|
|
|
|
2016-11-16 23:47:01 +08:00
|
|
|
|
// breadcrumb
|
|
|
|
|
var breadcrumb = $('.sidebar-menu > li > a.active > span').text();
|
|
|
|
|
if (breadcrumb === "") $('.breadcrumb > li + li').hide();
|
|
|
|
|
else $('.breadcrumb > li + li').text(breadcrumb);
|
|
|
|
|
|
|
|
|
|
$(".go-top").click(function (e) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
$('#main-content, .content-body, body').animate({
|
|
|
|
|
scrollTop: 0
|
|
|
|
|
}, 200);
|
|
|
|
|
});
|
|
|
|
|
|
2016-11-18 11:58:54 +08:00
|
|
|
|
$('#websiteFooter').text($('#footer').val());
|
2016-11-16 23:47:01 +08:00
|
|
|
|
|
2016-10-20 17:55:29 +08:00
|
|
|
|
$('#sidebar .sub-menu > a').click(function () {
|
|
|
|
|
var o = ($(this).offset());
|
|
|
|
|
diff = 300 - o.top;
|
|
|
|
|
if (diff > 0)
|
|
|
|
|
$("#sidebar").scrollTo("-=" + Math.abs(diff), 500);
|
|
|
|
|
else
|
|
|
|
|
$("#sidebar").scrollTo("+=" + Math.abs(diff), 500);
|
|
|
|
|
});
|
|
|
|
|
|
2016-11-07 17:26:17 +08:00
|
|
|
|
$('.sidebar-toggle-box').click(function () {
|
2016-11-09 20:29:52 +08:00
|
|
|
|
if ($('#sidebar').is(":visible") === true) {
|
|
|
|
|
$(".sidebar").addClass("sidebar-closed");
|
2016-10-20 17:55:29 +08:00
|
|
|
|
} else {
|
2016-11-09 20:29:52 +08:00
|
|
|
|
$(".sidebar").removeClass("sidebar-closed");
|
|
|
|
|
$("#sidebar").show();
|
2016-10-20 17:55:29 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// custom scrollbar
|
2016-11-14 12:25:44 +08:00
|
|
|
|
if (!$.browser.versions.ios) $("#sidebar").niceScroll({ styler: "fb", cursorcolor: "#e8403f", cursorwidth: '3', cursorborderradius: '10px', background: '#404040', spacebarenabled: false, cursorborder: '', scrollspeed: 60 });
|
2016-11-18 10:18:41 +08:00
|
|
|
|
|
|
|
|
|
// load widget data
|
2016-11-18 14:42:51 +08:00
|
|
|
|
bd({
|
|
|
|
|
url: '../api/Notifications/',
|
|
|
|
|
swal: false,
|
|
|
|
|
method: 'GET',
|
|
|
|
|
callback: function (result) {
|
|
|
|
|
$('#logoutNoti').text(result.NewUsersCount);
|
|
|
|
|
|
|
|
|
|
// new users
|
|
|
|
|
$('#msgHeaderUser').text(result.NewUsersCount);
|
|
|
|
|
$('#msgHeaderUserBadge').text(result.NewUsersCount);
|
|
|
|
|
var htmlUserTemplate = '<li><a href="../Admin/Notifications"><span class="label label-success"><i class="fa fa-plus"></i></span><div title="{2}">{1}({0})</div><span class="small italic">{3}</span></a></li>';
|
|
|
|
|
var html = result.Users.map(function (u) {
|
|
|
|
|
return $.format(htmlUserTemplate, u.UserName, u.DisplayName, u.Description, u.Period);
|
|
|
|
|
}).join('');
|
|
|
|
|
$(html).insertAfter($('#msgHeaderUserContent'));
|
|
|
|
|
|
|
|
|
|
// apps
|
|
|
|
|
$('#msgHeaderApp').text(result.AppExceptionsCount);
|
|
|
|
|
$('#msgHeaderAppBadge').text(result.AppExceptionsCount);
|
|
|
|
|
htmlUserTemplate = '<li><a href="../Admin/Exceptions"><span class="label label-warning"><i class="fa fa-bug"></i></span><div title="{1}">{0}</div><span class="small italic">{2}</span></a></li>';
|
|
|
|
|
html = result.Apps.map(function (u) {
|
|
|
|
|
return $.format(htmlUserTemplate, u.ExceptionType, u.Message, u.Period);
|
|
|
|
|
}).join('');
|
|
|
|
|
$(html).insertAfter($('#msgHeaderAppContent'));
|
|
|
|
|
|
|
|
|
|
// dbs
|
|
|
|
|
$('#msgHeaderDb').text(result.DbExceptionsCount);
|
|
|
|
|
$('#msgHeaderDbBadge').text(result.DbExceptionsCount);
|
|
|
|
|
htmlUserTemplate = '<li><a href="../Admin/Exceptions"><span class="label label-danger"><i class="fa fa-bolt"></i></span><div title="{1}">{0}</div><span class="small italic">{2}</span></a></li>';
|
|
|
|
|
html = result.Dbs.map(function (u) {
|
|
|
|
|
return $.format(htmlUserTemplate, u.ErrorPage, u.Message, u.Period);
|
|
|
|
|
}).join('');
|
|
|
|
|
$(html).insertAfter($('#msgHeaderDbContent'));
|
|
|
|
|
|
|
|
|
|
// messages
|
|
|
|
|
$('#msgHeaderMsg').text(result.MessagesCount);
|
|
|
|
|
$('#msgHeaderMsgBadge').text(result.MessagesCount);
|
|
|
|
|
htmlUserTemplate = '<li><a href="../Admin/Messages?id={0}"><span class="photo"><img alt="avatar" src="{1}"></span><span class="subject"><span class="from">{2}</span><span class="time">{4}</span></span><span class="message" title="{5}">{3}</span></a></li>';
|
|
|
|
|
html = result.Messages.map(function (u) {
|
|
|
|
|
return $.format(htmlUserTemplate, u.ID, u.FromIcon, u.FromDisplayName, u.Title, u.Period, u.Content);
|
|
|
|
|
}).join('');
|
|
|
|
|
$(html).insertAfter($('#msgHeaderMsgContent'));
|
|
|
|
|
console.log(result);
|
|
|
|
|
}
|
2016-11-18 10:18:41 +08:00
|
|
|
|
});
|
2016-11-16 23:47:01 +08:00
|
|
|
|
});
|