This commit is contained in:
albert
2013-02-28 15:06:22 -08:00
parent 2dbd7b180f
commit e3892e09c9
4 changed files with 26 additions and 3 deletions

View File

@@ -109,6 +109,8 @@
Danbooru.Post.update(post_id, {"post[is_rating_locked]": "1"});
} else if (s === 'lock-note') {
Danbooru.Post.update(post_id, {"post[is_note_locked]": "1"});
} else if (s === 'approve') {
Danbooru.Post.approve(post_id);
} else if (s === "apply-tag-script") {
var tag_script = Danbooru.Cookie.get("tag-script");
Danbooru.TagScript.run(post_id, tag_script);

View File

@@ -308,16 +308,33 @@
complete: function() {
Danbooru.Post.notice_update("dec");
},
success: function(data, status, xhr) {
success: function(data) {
Danbooru.Post.update_data(data);
},
error: function(data, status, xhr) {
error: function(data) {
Danbooru.notice("Error: " + data.reason);
$("#post_" + data.id).effect("shake", {"distance": 20}, "fast");
}
});
}
Danbooru.Post.approve = function(post_id) {
$.ajax({
type: "POST",
url: "/moderator/post/approval.json",
data: {"post_id": post_id},
dataType: "json",
success: function(data) {
if (!data.success) {
Danbooru.error("Error: " + data.reason);
} else {
var $post = $("#post_" + post_id);
$post.data("flags", $post.data("flags").replace(/pending/, ""));
$post.removeClass("post-status-pending");
}
}
});
}
Danbooru.Post.place_jlist_ads = function() {
var jlist = $("#jlist-rss-ads-for-show");

View File

@@ -0,0 +1 @@
{"success": <%= @post.errors.empty? %>, "reason": <%= raw @post.errors.full_messages.join("; ").to_json %>}

View File

@@ -14,6 +14,9 @@
<option value="vote-down">Vote down</option>
<option value="lock-rating">Lock rating</option>
<option value="lock-note">Lock notes</option>
<% if CurrentUser.is_janitor? %>
<option value="approve">Approve</option>
<% end %>
<option value="edit-tag-script">Edit tag script</option>
<option value="apply-tag-script">Apply tag script</option>
</select>