add ban to post mode menu
This commit is contained in:
@@ -164,6 +164,8 @@
|
|||||||
Danbooru.Post.update(post_id, {"post[is_note_locked]": "1"});
|
Danbooru.Post.update(post_id, {"post[is_note_locked]": "1"});
|
||||||
} else if (s === 'approve') {
|
} else if (s === 'approve') {
|
||||||
Danbooru.Post.approve(post_id);
|
Danbooru.Post.approve(post_id);
|
||||||
|
} else if (s === 'ban') {
|
||||||
|
Danbooru.Post.ban(post_id);
|
||||||
} else if (s === "tag-script") {
|
} else if (s === "tag-script") {
|
||||||
var current_script_id = Danbooru.Cookie.get("current_tag_script_id");
|
var current_script_id = Danbooru.Cookie.get("current_tag_script_id");
|
||||||
var tag_script = Danbooru.Cookie.get("tag-script-" + current_script_id);
|
var tag_script = Danbooru.Cookie.get("tag-script-" + current_script_id);
|
||||||
|
|||||||
@@ -502,7 +502,22 @@
|
|||||||
error: function(data) {
|
error: function(data) {
|
||||||
Danbooru.Post.notice_update("dec");
|
Danbooru.Post.notice_update("dec");
|
||||||
Danbooru.error('There was an error updating <a href="/posts/' + post_id + '">post #' + post_id + '</a>');
|
Danbooru.error('There was an error updating <a href="/posts/' + post_id + '">post #' + post_id + '</a>');
|
||||||
$("#post_" + post_id).effect("shake", {distance: 5, times: 1}, 100);
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Danbooru.Post.ban = function(post_id) {
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/moderator/post/posts/" + post_id + "/ban.js",
|
||||||
|
data: {
|
||||||
|
commit: "Ban"
|
||||||
|
},
|
||||||
|
success: function(data) {
|
||||||
|
$("#post_" + post_id).remove();
|
||||||
|
},
|
||||||
|
error: function(data) {
|
||||||
|
Danbooru.error('There was an error updating <a href="/posts/' + post_id + '">post #' + post_id + '</a>');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,10 @@ body.mode-translation {
|
|||||||
background-color: #5CD;
|
background-color: #5CD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body.mode-ban {
|
||||||
|
background-color: #F33;
|
||||||
|
}
|
||||||
|
|
||||||
#page, #top, #page-footer {
|
#page, #top, #page-footer {
|
||||||
background-color: white;
|
background-color: white;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,14 @@ module Moderator
|
|||||||
if params[:commit] == "Ban"
|
if params[:commit] == "Ban"
|
||||||
@post.ban!
|
@post.ban!
|
||||||
end
|
end
|
||||||
redirect_to(post_path(@post), :notice => "Post was banned")
|
|
||||||
|
respond_to do |fmt|
|
||||||
|
fmt.html do
|
||||||
|
redirect_to(post_path(@post), :notice => "Post was banned")
|
||||||
|
end
|
||||||
|
|
||||||
|
fmt.js
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def unban
|
def unban
|
||||||
|
|||||||
0
app/views/moderator/post/posts/ban.js.erb
Normal file
0
app/views/moderator/post/posts/ban.js.erb
Normal file
@@ -20,6 +20,9 @@
|
|||||||
<% if CurrentUser.can_approve_posts? %>
|
<% if CurrentUser.can_approve_posts? %>
|
||||||
<option value="approve">Approve</option>
|
<option value="approve">Approve</option>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% if CurrentUser.is_admin? %>
|
||||||
|
<option value="ban">Ban</option>
|
||||||
|
<% end %>
|
||||||
</select>
|
</select>
|
||||||
</form>
|
</form>
|
||||||
<input id="tag-script-field" placeholder="Enter tag script" style="display: none; margin-top: 0.5em;"></input>
|
<input id="tag-script-field" placeholder="Enter tag script" style="display: none; margin-top: 0.5em;"></input>
|
||||||
|
|||||||
Reference in New Issue
Block a user