Add wiki page edit shortcut
This commit is contained in:
@@ -6,6 +6,10 @@
|
|||||||
if (Danbooru.meta("enable-auto-complete") === "true") {
|
if (Danbooru.meta("enable-auto-complete") === "true") {
|
||||||
this.initialize_autocomplete();
|
this.initialize_autocomplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Danbooru.meta("enable-js-navigation") === "true") {
|
||||||
|
this.initialize_shortcuts();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,6 +48,15 @@
|
|||||||
$(field).data("uiAutocomplete")._renderItem = render_wiki_page;
|
$(field).data("uiAutocomplete")._renderItem = render_wiki_page;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Danbooru.WikiPage.initialize_shortcuts = function() {
|
||||||
|
if ($("#a-show").length) {
|
||||||
|
$(document).bind("keypress", "e", function(e) {
|
||||||
|
$("#wiki-page-edit-link")[0].click();
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<% unless @wiki_page.new_record? %>
|
<% unless @wiki_page.new_record? %>
|
||||||
<li><%= link_to "History", wiki_page_versions_path(:search => {:wiki_page_id => @wiki_page.id}) %></li>
|
<li><%= link_to "History", wiki_page_versions_path(:search => {:wiki_page_id => @wiki_page.id}) %></li>
|
||||||
<% if CurrentUser.is_member? %>
|
<% if CurrentUser.is_member? %>
|
||||||
<li><%= link_to "Edit", edit_wiki_page_path(@wiki_page) %></li>
|
<li><%= link_to "Edit", edit_wiki_page_path(@wiki_page), :id => "wiki-page-edit-link" %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if CurrentUser.is_janitor? %>
|
<% if CurrentUser.is_janitor? %>
|
||||||
<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><%= 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>
|
||||||
|
|||||||
Reference in New Issue
Block a user