forked from e621ng/e621ng
[Posts] Add a set navbar button to remove the post from that said (#775)
This commit is contained in:
parent
21c486a475
commit
7318b2ddcb
@ -1,4 +1,5 @@
|
||||
import {SendQueue} from "./send_queue";
|
||||
import Page from "./utility/page";
|
||||
import LStorage from "./utility/storage";
|
||||
|
||||
let PostSet = {};
|
||||
@ -175,10 +176,22 @@ PostSet.update_sets_menu = function () {
|
||||
});
|
||||
};
|
||||
|
||||
PostSet.initialize_remove_from_set_links = function () {
|
||||
$("a.set-nav-remove-link").on("click", (event) => {
|
||||
event.preventDefault();
|
||||
const target = $(event.currentTarget);
|
||||
|
||||
const setID = target.data("setId");
|
||||
const postID = target.data("postId");
|
||||
|
||||
PostSet.remove_post(setID, postID);
|
||||
});
|
||||
};
|
||||
|
||||
$(function () {
|
||||
if ($("#c-posts").length && $("#a-show").length) {
|
||||
PostSet.initialize_add_to_set_link();
|
||||
}
|
||||
if (!Page.matches("posts", "show")) return;
|
||||
PostSet.initialize_add_to_set_link();
|
||||
PostSet.initialize_remove_from_set_links();
|
||||
});
|
||||
|
||||
export default PostSet;
|
||||
|
@ -26,6 +26,7 @@
|
||||
<% end -%>
|
||||
|
||||
<span class="nav-name">
|
||||
<a href="#" class="set-nav-remove-link" data-post-id="<%= post.id %>" data-set-id="<%= post_set.id %>" title="Remove from set"><i class="fas fa-times"></i></a>
|
||||
<%= link_to("Set: #{post_set.name}", post_set_path(post_set), title: "page #{post_set.page_number(post.id)}/#{post_set.post_count}") -%>
|
||||
</span>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user