This commit is contained in:
r888888888
2013-06-18 16:06:48 -07:00
parent dd8132c125
commit f16f530eea
7 changed files with 30 additions and 11 deletions

View File

@@ -4,7 +4,10 @@
Danbooru.Artist.initialize_all = function() {
if ($("#c-artists").length) {
Danbooru.Artist.initialize_check_name_link();
Danbooru.Artist.initialize_typeahead();
if (Danbooru.meta("enable-auto-complete") === "true") {
Danbooru.Artist.initialize_typeahead();
}
}
}

View File

@@ -5,7 +5,10 @@
Danbooru.Post.initialize_all = function() {
this.initialize_post_previews();
this.initialize_tag_autocomplete();
if (Danbooru.meta("enable-tag-autocomplete") === "true") {
this.initialize_tag_autocomplete();
}
if ($("#c-posts").length) {
if (Danbooru.meta("enable-js-navigation") === "true") {

View File

@@ -3,15 +3,17 @@
Danbooru.WikiPage.initialize_all = function() {
if ($("#c-wiki-pages").length) {
$("#quick_search_title,#wiki_page_title").typeahead({
name: "wiki_pages",
remote: "/wiki_pages.json?search[title]=*%QUERY*",
limit: 10,
valueKey: "title",
template: function(context) {
return "<p>" + context.title.replace(/_/g, " ") + "</a></p>";
}
});
if (Danbooru.meta("enable-tag-autocomplete") === "true") {
$("#quick_search_title,#wiki_page_title").typeahead({
name: "wiki_pages",
remote: "/wiki_pages.json?search[title]=*%QUERY*",
limit: 10,
valueKey: "title",
template: function(context) {
return "<p>" + context.title.replace(/_/g, " ") + "</a></p>";
}
});
}
}
}
})();

View File

@@ -197,6 +197,10 @@ class AnonymousUser
""
end
def enable_auto_complete
true
end
%w(member banned gold builder platinum contributor janitor moderator admin).each do |name|
define_method("is_#{name}?") do
false

View File

@@ -16,6 +16,7 @@
<% end %>
<meta name="enable-js-navigation" content="<%= CurrentUser.user.enable_post_navigation %>">
<meta name="default-image-size" content="<%= CurrentUser.user.default_image_size %>">
<meta name="enable-auto-complete" content="<%= CurrentUser.user.enable_auto_complete %>">
<%= auto_discovery_link_tag :atom, posts_path(:format => "atom", :tags => params[:tags]) %>
<%= stylesheet_link_tag "application", :media => "screen" %>
<%= javascript_include_tag "application" %>

View File

@@ -53,6 +53,7 @@
<%= f.input :new_post_navigation_layout, :as => :select, :label => "Pool links", :include_blank => false, :collection => [["Bottom", "true"], ["Top", "false"]], :hint => "When browsing pools, where do you want the navigation links to be placed?" %>
<%= f.input :enable_sequential_post_navigation, :as => :select, :label => "Enable slideshow mode", :hint => "Show prev/next links when viewing a post", :include_blank => false %>
<%= f.input :hide_deleted_posts, :as => :select, :label => "Deleted post filter", :hint => "Hide deleted posts at the database level", :include_blank => false, :collection => [["Yes", "true"], ["No", "false"]] %>
<%= f.input :enable_auto_complete, :as => :select, :collection => [["Yes", "true"], ["No", "false"]] %>
</fieldset>
<fieldset>

View File

@@ -0,0 +1,5 @@
class AddEnableAutoCompleteToUsers < ActiveRecord::Migration
def change
add_column :users, :enable_auto_complete, :boolean, :null => false, :default => :true
end
end