Browse Source

Updated all scripts to use the parseErrorMessage() function for grabbing the error message out of the response.

tags/3.0.0
Teknikode 1 year ago
parent
commit
076d99a698

+ 3
- 3
Teknik/Areas/Admin/Controllers/AdminController.cs View File

@@ -63,7 +63,7 @@ namespace Teknik.Areas.Admin.Controllers
var results = db.Users.Where(u => u.Username.Contains(query)).ToList();
if (results != null)
{
foreach (Users.Models.User user in results)
foreach (User user in results)
{
try
{
@@ -84,7 +84,7 @@ namespace Teknik.Areas.Admin.Controllers
}
}

return PartialView("~/Areas/Admin/Views/Admin/UserResults.cshtml", models);
return Json(new { result = new { html = PartialView("~/Areas/Admin/Views/Admin/UserResults.cshtml", models) } });
}

[HttpPost]
@@ -102,7 +102,7 @@ namespace Teknik.Areas.Admin.Controllers
model.Downloads = foundUpload.Downloads;
model.DeleteKey = foundUpload.DeleteKey;

return PartialView("~/Areas/Admin/Views/Admin/UploadResult.cshtml", model);
return Json(new { result = new { html = PartialView("~/Areas/Admin/Views/Admin/UploadResult.cshtml", model) } });
}
return Json(new { error = new { message = "Upload does not exist" } });
}

+ 16
- 18
Teknik/Areas/Admin/Scripts/UploadSearch.js View File

@@ -1,4 +1,4 @@
$(document).ready(function () {
$(document).ready(function () {
$('#Query').on('input', function (e) {
query = $(this).val();

@@ -12,18 +12,16 @@
type: "POST",
url: searchResultsURL,
data: { url: query },
success: function (html) {
if (html) {
if (html.error) {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error.message + '</div>');
}
else {
$("#top_msg").css('display', 'none');
$("#top_msg").html('');
$("#results").html(html);
LinkUploadDelete($('.delete-upload-button'));
}
success: function (response) {
if (response.result) {
$("#top_msg").css('display', 'none');
$("#top_msg").html('');
$("#results").html(response.result.html);
LinkUploadDelete($('.delete-upload-button'));
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@@ -49,14 +47,14 @@ function LinkUploadDelete(selector) {
xhrFields: {
withCredentials: true
},
success: function (html) {
if (html.result) {
window.open(html.result.url, '_blank');
success: function (response) {
if (response.result) {
window.open(response.result.url, '_blank');
window.location.reload();
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error.message + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@@ -64,4 +62,4 @@ function LinkUploadDelete(selector) {
}
});
});
}
}

+ 7
- 9
Teknik/Areas/Admin/Scripts/UserSearch.js View File

@@ -5,15 +5,13 @@ $(document).ready(function () {
type: "POST",
url: userSearchResultsURL,
data: { query: query },
success: function (html) {
if (html) {
if (html.error) {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
}
else {
$("#results").html(html);
}
success: function (response) {
if (response.result) {
$("#results").html(response.result.html);
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});

+ 28
- 28
Teknik/Areas/Blog/Scripts/Blog.js View File

@@ -1,4 +1,4 @@
$(document).ready(function () {
$(document).ready(function () {
$("textarea.mdd_editor").MarkdownDeep({
help_location: helpURL,
disableTabHandling: false,
@@ -16,13 +16,13 @@
type: "POST",
url: addCommentURL,
data: { postID: postID, article: post },
success: function (html) {
if (html.result) {
success: function (response) {
if (response.result) {
window.location.reload();
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@@ -37,9 +37,9 @@
type: "POST",
url: getCommentArticleURL,
data: { commentID: commentID },
success: function (html) {
if (html.result) {
$("#edit_comment_post").val(html.result);
success: function (response) {
if (response.result) {
$("#edit_comment_post").val(response.result);
}
}
});
@@ -53,13 +53,13 @@
type: "POST",
url: editCommentURL,
data: { commentID: postID, article: post },
success: function (html) {
if (html.result) {
success: function (response) {
if (response.result) {
window.location.reload();
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@@ -73,9 +73,9 @@ function loadMorePosts(start, count) {
type: "POST",
url: getPostsURL,
data: { blogID: blog_id, count: count, startPostID: start },
success: function (html) {
if (html) {
$(".blog-main").append(html);
success: function (response) {
if (response) {
$(".blog-main").append(response);
linkPostDelete('.delete_post');
linkPostPublish('.publish_post');
linkPostUnpublish('.unpublish_post');
@@ -91,9 +91,9 @@ function loadMoreComments(start, count) {
type: "POST",
url: getCommentsURL,
data: { postID: post_id, count: count, startCommentID: start },
success: function (html) {
if (html) {
$(".post-comments").append(html);
success: function (response) {
if (response) {
$(".post-comments").append(response);
linkCommentDelete('.delete_comment');
$(window).bind('scroll', bindScrollComments);
}
@@ -125,13 +125,13 @@ function linkPostUnpublish(selector) {
type: "POST",
url: publishPostURL,
data: { postID: post_id, publish: false },
success: function (html) {
if (html.result) {
success: function (response) {
if (response.result) {
window.location.reload();
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@@ -146,13 +146,13 @@ function linkPostPublish(selector) {
type: "POST",
url: publishPostURL,
data: {postID: post_id, publish: true },
success: function (html) {
if (html.result) {
success: function (response) {
if (response.result) {
window.location.reload();
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@@ -169,13 +169,13 @@ function linkPostDelete(selector) {
type: "POST",
url: deletePostURL,
data: { postID: post_id },
success: function (html) {
if (html.result) {
success: function (response) {
if (response.result) {
window.location.reload();
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@@ -194,13 +194,13 @@ function linkCommentDelete(selector) {
type: "POST",
url: deleteCommentURL,
data: { commentID: post_id },
success: function (html) {
if (html.result) {
success: function (response) {
if (response.result) {
window.location.reload();
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});

+ 5
- 5
Teknik/Areas/Contact/Scripts/Contact.js View File

@@ -1,4 +1,4 @@
$(document).ready(function () {
$(document).ready(function () {
$("#contact_submit").click(function () {
var form = $('#contactForm');
$.validator.unobtrusive.parse(form);
@@ -7,8 +7,8 @@
type: "POST",
url: form.attr('action'),
data: form.serialize(),
success: function (html) {
if (html.result == 'true') {
success: function (response) {
if (response.result == 'true') {
$('#contactForm').each(function(){
this.reset();
});
@@ -17,11 +17,11 @@
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
}
return false;
});
});
});

+ 22
- 28
Teknik/Areas/Podcast/Scripts/Podcast.js View File

@@ -1,4 +1,4 @@
$(document).ready(function () {
$(document).ready(function () {
$("#podcast_submit").click(function () {
$.blockUI({ message: '<div class="text-center"><h3>Saving...</h3></div>' });
$('#newPodcast').modal('hide');
@@ -27,11 +27,8 @@
window.location.reload();
}
else {
var error = obj;
if (obj.error)
error = obj.error;
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(obj) + '</div>');
}
}
};
@@ -135,11 +132,8 @@
window.location.reload();
}
else {
var error = obj;
if (obj.error)
error = obj.error;
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(obj) + '</div>');
}
}
};
@@ -154,13 +148,13 @@
type: "POST",
url: addCommentURL,
data: { podcastId: postID, article: post },
success: function (html) {
if (html.result) {
success: function (response) {
if (response.result) {
window.location.reload();
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@@ -191,13 +185,13 @@
type: "POST",
url: editCommentURL,
data: { commentID: postID, article: post },
success: function (html) {
if (html.result) {
success: function (response) {
if (response.result) {
window.location.reload();
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@@ -263,13 +257,13 @@ function linkPodcastUnpublish(selector) {
type: "POST",
url: publishPodcastURL,
data: { podcastId: podcastId, publish: false },
success: function (html) {
if (html.result) {
success: function (response) {
if (response.result) {
window.location.reload();
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@@ -284,13 +278,13 @@ function linkPodcastPublish(selector) {
type: "POST",
url: publishPodcastURL,
data: { podcastId: podcastId, publish: true },
success: function (html) {
if (html.result) {
success: function (response) {
if (response.result) {
window.location.reload();
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@@ -307,13 +301,13 @@ function linkPodcastDelete(selector) {
type: "POST",
url: deletePodcastURL,
data: { podcastId: podcastId },
success: function (html) {
if (html.result) {
success: function (response) {
if (response.result) {
window.location.reload();
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@@ -348,17 +342,17 @@ function linkCommentDelete(selector) {
type: "POST",
url: deleteCommentURL,
data: { commentID: post_id },
success: function (html) {
if (html.result) {
success: function (response) {
if (response.result) {
window.location.reload();
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
}
});
});
}
}

+ 6
- 11
Teknik/Areas/Shortener/Scripts/Shortener.js View File

@@ -1,4 +1,4 @@
$(document).ready(function () {
$(document).ready(function () {
$('#url').focus();

$("#shortenSubmit").click(function () {
@@ -9,18 +9,13 @@
type: "POST",
url: $("#shortenerForm").attr('action'),
data: { url: url },
success: function (html) {
if (html.result) {
$('#url').val(html.result.shortUrl);
success: function (response) {
if (response.result) {
$('#url').val(response.result.shortUrl);
}
else {
var errorMsg = "Invalid Url";
if (html.error)
{
errorMsg = html.error;
}
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + errorMsg + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
$('#url').focus();
$('#url').select();
@@ -33,4 +28,4 @@
$("#top_msg").css('display', 'none', 'important');
$("#top_msg").html('');
});
});
});

+ 3
- 7
Teknik/Areas/Status/Scripts/Status.js View File

@@ -1,4 +1,4 @@
var cpuUsageChart;
var cpuUsageChart;
var memUsageChart;
var networkUsageChart;

@@ -346,12 +346,8 @@ $(document).ready(function () {
visitChart.redraw();
}
else {
var err = response;
if (response.error) {
err = response.error.message;
}
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + err + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@@ -368,4 +364,4 @@ $(document).ready(function () {
memUsageChart.setSize($('#mem-usage-chart').width(), $('#mem-usage-chart').height());
networkUsageChart.setSize($('#network-usage-chart').width(), $('#network-usage-chart').height());
})
});
});

+ 5
- 5
Teknik/Areas/Upload/Scripts/Upload.js View File

@@ -29,15 +29,15 @@ function linkShortenUrl(element, fileID, url) {
type: "POST",
url: shortenURL,
data: { url: url },
success: function (html) {
if (html.result) {
success: function (response) {
if (response.result) {
element.prop('disabled', true);
$('#upload-panel-' + fileID).find('#upload-link').attr('href', html.result.shortUrl);
$('#upload-panel-' + fileID).find('#upload-link').text(html.result.shortUrl);
$('#upload-panel-' + fileID).find('#upload-link').attr('href', response.result.shortUrl);
$('#upload-panel-' + fileID).find('#upload-link').text(response.result.shortUrl);
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});

+ 3
- 3
Teknik/Areas/User/Scripts/BlogSettings.js View File

@@ -12,15 +12,15 @@ $(document).ready(function () {
Title: blog_title,
Description: blog_desc,
}),
success: function (html) {
success: function (response) {
$.unblockUI();
if (html.result) {
if (response.result) {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-success alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>Settings Saved!</div>');
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(html) + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});

+ 6
- 6
Teknik/Areas/User/Scripts/CheckAuthCode.js View File

@@ -1,4 +1,4 @@
$(document).ready(function () {
$(document).ready(function () {
$("#authCheckStatus").css('display', 'none', 'important');
$('#Code').focus();

@@ -25,16 +25,16 @@
xhrFields: {
withCredentials: true
},
success: function (html) {
if (html.result) {
window.location = html.result;
success: function (response) {
if (response.result) {
window.location = response.result;
}
else {
$("#authCheckStatus").css('display', 'inline', 'important');
$("#authCheckStatus").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error + '</div>');
$("#authCheckStatus").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
return false;
});
});
});

+ 10
- 10
Teknik/Areas/User/Scripts/Profile.js View File

@@ -1,4 +1,4 @@
$(document).ready(function () {
$(document).ready(function () {
$('.delete-upload-button').click(function () {
var deleteUrl = $(this).attr('id');
var uploadID = $(this).data('upload-id');
@@ -17,14 +17,14 @@
xhrFields: {
withCredentials: true
},
success: function (html) {
if (html.result) {
window.open(html.result.url, '_blank');
success: function (response) {
if (response.result) {
window.open(response.result.url, '_blank');
window.location.reload();
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error.message + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@@ -45,17 +45,17 @@
xhrFields: {
withCredentials: true
},
success: function (html) {
if (html.result) {
window.location = html.result.url;
success: function (response) {
if (response.result) {
window.location = response.result.url;
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + html.error.message + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
}
});
});
});
});

+ 3
- 3
Teknik/Areas/User/Scripts/ProfileSettings.js View File

@@ -14,15 +14,15 @@ $(document).ready(function () {
Quote: quote,
About: about
}),
success: function (html) {
success: function (response) {
$.unblockUI();
if (html.result) {
if (response.result) {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-success alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>Settings Saved!</div>');
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(html) + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});

+ 6
- 6
Teknik/Areas/User/Scripts/ResetPass.js View File

@@ -8,14 +8,14 @@ $(document).ready(function () {
data: AddAntiForgeryToken({
username: username
}),
success: function (html) {
if (html.result) {
success: function (response) {
if (response.result) {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-success alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>The Password Reset Link has been sent to your recovery email.</div>');
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(html) + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@@ -33,14 +33,14 @@ $(document).ready(function () {
Password: password,
PasswordConfirm: confirmPassword
}),
success: function (html) {
if (html.result) {
success: function (response) {
if (response.result) {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-success alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>Password has successfully been reset.</div>');
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(html) + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});

+ 21
- 21
Teknik/Areas/User/Scripts/SecuritySettings.js View File

@@ -7,14 +7,14 @@ $(document).ready(function () {
type: "POST",
url: resendVerifyURL,
data: AddAntiForgeryToken({}),
success: function (html) {
if (html.result) {
success: function (response) {
if (response.result) {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-info alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>Recovery Email Verification Sent.</div>');
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(html) + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@@ -38,14 +38,14 @@ $(document).ready(function () {
data: AddAntiForgeryToken({
code: setCode
}),
success: function (html) {
if (html.result) {
success: function (response) {
if (response.result) {
$("#authSetupStatus").css('display', 'inline', 'important');
$("#authSetupStatus").html('<div class="alert alert-success alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>Success!</div>');
}
else {
$("#authSetupStatus").css('display', 'inline', 'important');
$("#authSetupStatus").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(html) + '</div>');
$("#authSetupStatus").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@@ -56,15 +56,15 @@ $(document).ready(function () {
type: "POST",
url: clearTrustedDevicesURL,
data: AddAntiForgeryToken({}),
success: function (html) {
if (html.result) {
success: function (response) {
if (response.result) {
$('#ClearDevices').html('Clear Trusted Devices (0)');
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-success alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>Successfully Cleared Trusted Devices</div>');
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(html) + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@@ -151,14 +151,14 @@ $(document).ready(function () {
TwoFactorEnabled: update_security_two_factor,
RecoveryEmail: recovery
}),
success: function (html) {
success: function (response) {
$.unblockUI();
if (html.result) {
if (html.result.checkAuth)
if (response.result) {
if (response.result.checkAuth)
{
$('#setupAuthenticatorLink').removeClass('hide');
$('#authSetupSecretKey').text(html.result.key);
$('#authQRCode').attr("src", html.result.qrUrl);
$('#authSetupSecretKey').text(response.result.key);
$('#authQRCode').attr("src", response.result.qrUrl);
$('#authenticatorSetup').modal('show');
}
else
@@ -169,7 +169,7 @@ $(document).ready(function () {
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(html) + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@@ -185,14 +185,14 @@ $(document).ready(function () {
data: AddAntiForgeryToken({
username: username
}),
success: function (html) {
if (html.result) {
success: function (response) {
if (response.result) {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-success alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>The Password Reset Link has been sent to your recovery email.</div>');
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(html) + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@@ -210,14 +210,14 @@ $(document).ready(function () {
Password: password,
PasswordConfirm: confirmPassword
}),
success: function (html) {
if (html.result) {
success: function (response) {
if (response.result) {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-success alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>Password has successfully been reset.</div>');
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(html) + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});

+ 3
- 3
Teknik/Areas/User/Scripts/Settings.js View File

@@ -6,13 +6,13 @@ $(document).ready(function () {
type: "POST",
url: deleteUserURL,
data: AddAntiForgeryToken({}),
success: function (html) {
if (html.result) {
success: function (response) {
if (response.result) {
window.location.replace(homeUrl);
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(html) + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});

+ 3
- 3
Teknik/Areas/User/Scripts/UploadSettings.js View File

@@ -12,15 +12,15 @@ $(document).ready(function () {
data: AddAntiForgeryToken({
Encrypt: upload_encrypt
}),
success: function (html) {
success: function (response) {
$.unblockUI();
if (html.result) {
if (response.result) {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-success alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>Settings Saved!</div>');
}
else {
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(html) + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});

+ 7
- 15
Teknik/Areas/Vault/Scripts/Vault.js View File

@@ -1,4 +1,4 @@
$(document).ready(function () {
$(document).ready(function () {
$("textarea.mdd_editor").MarkdownDeep({
help_location: helpURL,
disableTabHandling: false,
@@ -175,12 +175,8 @@
window.location = response.result.url;
}
else {
var err = response;
if (response.error) {
err = response.error.message;
}
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + err + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@@ -199,17 +195,13 @@
xhrFields: {
withCredentials: true
},
success: function (html) {
if (html.result) {
window.location = html.result.url;
success: function (response) {
if (response.result) {
window.location = response.result.url;
}
else {
var err = html;
if (html.error) {
err = html.error.message;
}
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + err + '</div>');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + parseErrorMessage(response) + '</div>');
}
}
});
@@ -257,4 +249,4 @@ function linkShowMore(element) {
btnBottom.find('.show-more-button').text(linkText);
};
});
}
}

Loading…
Cancel
Save