diff --git a/app/assets/javascripts/artists.js b/app/assets/javascripts/artists.js index fcb000e29..52f1155e0 100644 --- a/app/assets/javascripts/artists.js +++ b/app/assets/javascripts/artists.js @@ -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(); + } } } diff --git a/app/assets/javascripts/posts.js b/app/assets/javascripts/posts.js index 94aad366f..19fd11fec 100644 --- a/app/assets/javascripts/posts.js +++ b/app/assets/javascripts/posts.js @@ -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") { diff --git a/app/assets/javascripts/wiki_pages.js b/app/assets/javascripts/wiki_pages.js index 3494283d4..1a612728b 100644 --- a/app/assets/javascripts/wiki_pages.js +++ b/app/assets/javascripts/wiki_pages.js @@ -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 "

" + context.title.replace(/_/g, " ") + "

"; - } - }); + 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 "

" + context.title.replace(/_/g, " ") + "

"; + } + }); + } } } })(); diff --git a/app/logical/anonymous_user.rb b/app/logical/anonymous_user.rb index 2b21e916c..a9bb053a4 100644 --- a/app/logical/anonymous_user.rb +++ b/app/logical/anonymous_user.rb @@ -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 diff --git a/app/views/layouts/default.html.erb b/app/views/layouts/default.html.erb index 763d2682a..8e2225f14 100644 --- a/app/views/layouts/default.html.erb +++ b/app/views/layouts/default.html.erb @@ -16,6 +16,7 @@ <% end %> + <%= auto_discovery_link_tag :atom, posts_path(:format => "atom", :tags => params[:tags]) %> <%= stylesheet_link_tag "application", :media => "screen" %> <%= javascript_include_tag "application" %> diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 3635bfbbb..8e3c6b46f 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -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"]] %>
diff --git a/db/migrate/20130618230158_add_enable_auto_complete_to_users.rb b/db/migrate/20130618230158_add_enable_auto_complete_to_users.rb new file mode 100644 index 000000000..cff5cd9a7 --- /dev/null +++ b/db/migrate/20130618230158_add_enable_auto_complete_to_users.rb @@ -0,0 +1,5 @@ +class AddEnableAutoCompleteToUsers < ActiveRecord::Migration + def change + add_column :users, :enable_auto_complete, :boolean, :null => false, :default => :true + end +end