hotkeys: add E to edit, shift+D to delete to artists, pools, wiki, forum.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
Danbooru.Artist.initialize_all = function() {
|
||||
if ($("#c-artists").length) {
|
||||
Danbooru.Artist.initialize_check_name();
|
||||
Danbooru.Artist.initialize_shortcuts();
|
||||
|
||||
if (Danbooru.meta("enable-auto-complete") === "true") {
|
||||
Danbooru.Artist.initialize_autocomplete();
|
||||
@@ -31,6 +32,18 @@
|
||||
});
|
||||
}
|
||||
|
||||
Danbooru.Artist.initialize_shortcuts = function() {
|
||||
if ($("#c-artists #a-show").length) {
|
||||
Danbooru.keydown("e", "edit", function(e) {
|
||||
$("#artist-edit a")[0].click();
|
||||
});
|
||||
|
||||
Danbooru.keydown("shift+d", "delete", function(e) {
|
||||
$("#artist-delete a")[0].click();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Danbooru.Artist.initialize_autocomplete = function() {
|
||||
var $fields = $("#search_name,#quick_search_name");
|
||||
|
||||
|
||||
@@ -2,8 +2,22 @@
|
||||
Danbooru.ForumPost = {};
|
||||
|
||||
Danbooru.ForumPost.initialize_all = function() {
|
||||
if ($("#c-forum-topics").length && $("#a-show").length) {;
|
||||
if ($("#c-forum-topics #a-show").length) {;
|
||||
this.initialize_edit_links();
|
||||
|
||||
Danbooru.keydown("e", "edit", function(e) {
|
||||
$(".edit_forum_topic_link")[0].click();
|
||||
});
|
||||
|
||||
Danbooru.keydown("shift+d", "delete", function(e) {
|
||||
$("#forum-topic-delete a")[0].click();
|
||||
});
|
||||
}
|
||||
|
||||
if ($("#c-forum-topics").length) {
|
||||
Danbooru.keydown("shift+r", "mark_all_as_read", function(e) {
|
||||
$("#secondary-links-mark-all-as-read a").click();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
Danbooru.Pool.initialize_all = function() {
|
||||
if ($("#c-pools").length) {
|
||||
this.initialize_shortcuts();
|
||||
if (Danbooru.meta("enable-auto-complete") === "true") {
|
||||
this.initialize_autocomplete_for("#search_name_matches,#quick_search_name_matches");
|
||||
}
|
||||
@@ -70,6 +71,18 @@
|
||||
});
|
||||
}
|
||||
|
||||
Danbooru.Pool.initialize_shortcuts = function() {
|
||||
if ($("#c-pools #a-show").length) {
|
||||
Danbooru.keydown("e", "edit", function(e) {
|
||||
$("#pool-edit a")[0].click();
|
||||
});
|
||||
|
||||
Danbooru.keydown("shift+d", "delete", function(e) {
|
||||
$("#pool-delete a")[0].click();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Danbooru.Pool.initialize_simple_edit = function() {
|
||||
$("#sortable").sortable({
|
||||
placeholder: "ui-state-placeholder"
|
||||
|
||||
@@ -50,8 +50,11 @@
|
||||
Danbooru.WikiPage.initialize_shortcuts = function() {
|
||||
if ($("#a-show").length) {
|
||||
Danbooru.keydown("e", "edit", function(e) {
|
||||
$("#wiki-page-edit-link")[0].click();
|
||||
e.preventDefault();
|
||||
$("#wiki-page-edit a")[0].click();
|
||||
});
|
||||
|
||||
Danbooru.keydown("shift+d", "delete", function(e) {
|
||||
$("#wiki-page-delete a")[0].click();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
<li><%= link_to "Posts (#{Post.fast_count(@artist.name)})", posts_path(:tags => @artist.name) %></li>
|
||||
<li><%= link_to "Show", artist_path(@artist) %></li>
|
||||
<% if CurrentUser.is_member? %>
|
||||
<li><%= link_to "Edit", edit_artist_path(@artist) %></li>
|
||||
<li id="artist-edit"><%= link_to "Edit", edit_artist_path(@artist) %></li>
|
||||
<% end %>
|
||||
<li><%= link_to "History", artist_versions_path(:search => {:artist_id => @artist.id}) %></li>
|
||||
<% if @artist.deletable_by?(CurrentUser.user) %>
|
||||
<% if @artist.is_active? %>
|
||||
<li><%= link_to "Delete", artist_path(@artist), :method => :delete, :data => {:confirm => "Are you sure you want to delete this artist?"} %></li>
|
||||
<li id="artist-delete"><%= link_to "Delete", artist_path(@artist), :method => :delete, :data => {:confirm => "Are you sure you want to delete this artist?"} %></li>
|
||||
<% else %>
|
||||
<li><%= link_to "Undelete", undelete_artist_path(@artist), :method => :post, :data => {:confirm => "Are you sure you want to undelete this artist?"} %></li>
|
||||
<% end %>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<li><%= link_to "New", new_forum_topic_path %></li>
|
||||
<li><%= link_to "Request alias", new_tag_alias_request_path %></li>
|
||||
<li><%= link_to "Request implication", new_tag_implication_request_path %></li>
|
||||
<li><%= link_to "Mark all as read", mark_all_as_read_forum_topics_path, :method => :post %></li>
|
||||
<li id="forum-topic-mark-all-as-read"><%= link_to "Mark all as read", mark_all_as_read_forum_topics_path, :method => :post %></li>
|
||||
<% end %>
|
||||
|
||||
<li><%= link_to "Search", search_forum_posts_path %></li>
|
||||
@@ -26,7 +26,7 @@
|
||||
<% if @forum_topic.is_deleted? %>
|
||||
<li><%= link_to "Undelete", undelete_forum_topic_path(@forum_topic), :method => :post %></li>
|
||||
<% else %>
|
||||
<li><%= link_to "Delete", forum_topic_path(@forum_topic), :method => :delete, :data => {:confirm => "Are you sure you want to delete this forum topic?"} %></li>
|
||||
<li id="forum-topic-delete"><%= link_to "Delete", forum_topic_path(@forum_topic), :method => :delete, :data => {:confirm => "Are you sure you want to delete this forum topic?"} %></li>
|
||||
<% end %>
|
||||
<% if @forum_topic.is_locked? %>
|
||||
<li><%= link_to "Unlock", forum_topic_path(@forum_topic, :forum_topic => {:is_locked => false}), :method => :put %></li>
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
<li><%= link_to "Show", pool_path(@pool) %></li>
|
||||
<li><%= link_to "Posts", posts_path(:tags => "pool:#{@pool.id}") %></li>
|
||||
<% if CurrentUser.is_member? %>
|
||||
<li><%= link_to "Edit", edit_pool_path(@pool) %></li>
|
||||
<li id="pool-edit"><%= link_to "Edit", edit_pool_path(@pool) %></li>
|
||||
<% end %>
|
||||
<% if @pool.deletable_by?(CurrentUser.user) %>
|
||||
<% if @pool.is_deleted? %>
|
||||
<li><%= link_to "Undelete", undelete_pool_path(@pool), :method => :post, :remote => true %></li>
|
||||
<li id="pool-delete"><%= link_to "Undelete", undelete_pool_path(@pool), :method => :post, :remote => true %></li>
|
||||
<% else %>
|
||||
<li><%= link_to "Delete", pool_path(@pool), :method => :delete, :data => {:confirm => "Are you sure you want to delete this pool?"}, :remote => true %></li>
|
||||
<li id="pool-delete"><%= link_to "Delete", pool_path(@pool), :method => :delete, :data => {:confirm => "Are you sure you want to delete this pool?"}, :remote => true %></li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if PoolArchive.enabled? %>
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
<% unless @wiki_page.new_record? %>
|
||||
<li><%= link_to "History", wiki_page_versions_path(:search => {:wiki_page_id => @wiki_page.id}) %></li>
|
||||
<% if CurrentUser.is_member? %>
|
||||
<li><%= link_to "Edit", edit_wiki_page_path(@wiki_page), :id => "wiki-page-edit-link" %></li>
|
||||
<li id="wiki-page-edit"><%= link_to "Edit", edit_wiki_page_path(@wiki_page) %></li>
|
||||
<% end %>
|
||||
<% if CurrentUser.is_builder? && !@wiki_page.is_deleted? %>
|
||||
<li><%= link_to "Delete", wiki_page_path(@wiki_page), :remote => true, :method => :delete, :data => {:confirm => "Are you sure you want to delete this wiki page?"} %></li>
|
||||
<li id="wiki-page-delete"><%= link_to "Delete", wiki_page_path(@wiki_page), :remote => true, :method => :delete, :data => {:confirm => "Are you sure you want to delete this wiki page?"} %></li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user