diff --git a/app/javascript/src/javascripts/autocomplete.js.erb b/app/javascript/src/javascripts/autocomplete.js.erb
index a7fa76055..2b7db8cff 100644
--- a/app/javascript/src/javascripts/autocomplete.js.erb
+++ b/app/javascript/src/javascripts/autocomplete.js.erb
@@ -31,6 +31,7 @@ Autocomplete.initialize_all = function() {
this.initialize_mention_autocomplete($(".autocomplete-mentions textarea"));
this.initialize_artist_autocomplete($('[data-autocomplete="artist"]'));
this.initialize_pool_autocomplete($('[data-autocomplete="pool"]'));
+ this.initialize_user_autocomplete($('[data-autocomplete="user"]'));
this.initialize_wiki_autocomplete($('[data-autocomplete="wiki-page"]'));
}
}
@@ -145,7 +146,7 @@ Autocomplete.initialize_tag_autocomplete = function() {
case "flagger":
case "upvote":
case "downvote":
- Autocomplete.user_source(term, resp, metatag);
+ Autocomplete.user_source(term, resp, metatag + ":");
break;
case "pool":
case "ordpool":
@@ -216,6 +217,17 @@ Autocomplete.initialize_pool_autocomplete = function($fields) {
});
};
+Autocomplete.initialize_user_autocomplete = function($fields) {
+ $fields.autocomplete({
+ search: function() {
+ $(this).data("ui-autocomplete").menu.bindings = $();
+ },
+ source: function(req, resp) {
+ Autocomplete.user_source(req.term, resp, "");
+ },
+ });
+};
+
Autocomplete.initialize_wiki_autocomplete = function($fields) {
$fields.autocomplete({
search: function() {
@@ -423,7 +435,7 @@ Autocomplete.static_metatag_source = function(term, resp, metatag) {
resp(matches);
}
-Autocomplete.user_source = function(term, resp, metatag) {
+Autocomplete.user_source = function(term, resp, prefix) {
return $.ajax({
url: "/users.json",
data: {
@@ -434,21 +446,10 @@ Autocomplete.user_source = function(term, resp, metatag) {
},
method: "get",
success: function(data) {
- var prefix = "";
- var display_name = null;
-
- if (metatag === "@") {
- prefix = "@";
- display_name = function(name) {return name;};
- } else {
- prefix = metatag + ":";
- display_name = function(name) {return name.replace(/_/g, " ");};
- }
-
resp($.map(data, function(user) {
return {
type: "user",
- label: display_name(user.name),
+ label: user.name.replace(/_/, " "),
value: prefix + user.name,
level: user.level_string
};
diff --git a/app/views/artist_versions/search.html.erb b/app/views/artist_versions/search.html.erb
index e1de40803..e89c10fca 100644
--- a/app/views/artist_versions/search.html.erb
+++ b/app/views/artist_versions/search.html.erb
@@ -4,7 +4,7 @@
<%= form_tag(artist_versions_path, :method => :get, :class => "simple_form") do %>
- <%= search_field "updater_name", :label => "User" %>
+ <%= search_field "updater_name", :label => "User", :data => { autocomplete: "user" } %>
<%= search_field "name", :label => "Name", :data => { autocomplete: "artist" } %>
<%= submit_tag "Search" %>
<% end %>
diff --git a/app/views/artists/_search.html.erb b/app/views/artists/_search.html.erb
index 469ab689f..e7b0fa5f2 100644
--- a/app/views/artists/_search.html.erb
+++ b/app/views/artists/_search.html.erb
@@ -1,7 +1,7 @@
<%= simple_form_for(:search, url: artists_path, method: :get, defaults: { required: false }, html: { class: "inline-form" }) do |f| %>
<%= f.input :any_name_matches, label: "Name", hint: "Use * for wildcard", input_html: { value: params[:search][:any_name_matches], data: { autocomplete: "artist" }} %>
<%= f.input :url_matches, label: "URL", as: "string", input_html: { value: params[:search][:url_matches] } %>
- <%= f.input :creator_name, label: "Creator", input_html: { value: params[:search][:creator_name] } %>
+ <%= f.input :creator_name, label: "Creator", input_html: { value: params[:search][:creator_name], data: { autocomplete: "user" } } %>
<%= f.input :is_active, label: "Active?", collection: [["Yes", true], ["No", false]], include_blank: true, selected: params[:search][:is_active] %>
<%= f.input :is_banned, label: "Banned?", collection: [["Yes", true], ["No", false]], include_blank: true, selected: params[:search][:is_banned] %>
<%= f.input :has_tag, label: "Has tag?", collection: [["Yes", true], ["No", false]], include_blank: true, selected: params[:search][:has_tag] %>
diff --git a/app/views/bans/_form.html.erb b/app/views/bans/_form.html.erb
index 85059b889..5bd4d952b 100644
--- a/app/views/bans/_form.html.erb
+++ b/app/views/bans/_form.html.erb
@@ -1,7 +1,7 @@
<%= simple_form_for(ban) do |f| %>
<%= error_messages_for("ban") %>
- <%= f.input :user_name, :as => :string %>
+ <%= f.input :user_name, :as => :string, :input_html => { data: { autocomplete: "user" } } %>
<%= f.input :duration, :hint => "in days" %>
<%= f.input :reason %>
<%= f.button :submit, :value => "Ban" %>
diff --git a/app/views/bans/_search.html.erb b/app/views/bans/_search.html.erb
index 8d7068d70..98aacc985 100644
--- a/app/views/bans/_search.html.erb
+++ b/app/views/bans/_search.html.erb
@@ -1,6 +1,6 @@
<%= simple_form_for(:search, method: :get, url: bans_path, defaults: { required: false }, html: { class: "inline-form" }) do |f| %>
- <%= f.input :user_name, label: "User", input_html: { value: params[:search][:user_name] } %>
- <%= f.input :banner_name, label: "Banner", input_html: { value: params[:search][:banner_name] } %>
+ <%= f.input :user_name, label: "User", input_html: { value: params[:search][:user_name], data: { autocomplete: "user" } } %>
+ <%= f.input :banner_name, label: "Banner", input_html: { value: params[:search][:banner_name], data: { autocomplete: "user" } } %>
<%= f.input :reason_matches, label: "Reason", hint: "Use * for wildcard", input_html: { value: params[:search][:reason_matches] } %>
<%= f.input :expired, label: "Expired?", collection: [["Yes", true], ["No", false]], include_blank: true, selected: params[:search][:expired] %>
<%= f.input :order, include_blank: false, collection: [%w[Created id_desc], %w[Expiration expires_at_desc]], selected: params[:search][:order] %>
diff --git a/app/views/bulk_update_requests/_search.html.erb b/app/views/bulk_update_requests/_search.html.erb
index 4deb72490..768c39c3e 100644
--- a/app/views/bulk_update_requests/_search.html.erb
+++ b/app/views/bulk_update_requests/_search.html.erb
@@ -1,6 +1,6 @@
<%= simple_form_for(:search, url: bulk_update_requests_path, method: :get, defaults: { required: false }, html: { class: "inline-form" }) do |f| %>
- <%= f.input :user_name, label: "Creator", input_html: { value: params[:search][:user_name] } %>
- <%= f.input :approver_name, label: "Approver", input_html: { value: params[:search][:approver_name] } %>
+ <%= f.input :user_name, label: "Creator", input_html: { value: params[:search][:user_name], data: { autocomplete: "user" } } %>
+ <%= f.input :approver_name, label: "Approver", input_html: { value: params[:search][:approver_name], data: { autocomplete: "user" } } %>
<%= f.input :title_matches, label: "Title", input_html: { value: params[:search][:title_matches] } %>
<%= f.input :script_matches, label: "Script", input_html: { value: params[:search][:script_matches] } %>
<%= f.input :status, label: "Status", collection: %w[pending approved rejected], include_blank: true, selected: params[:search][:status] %>
diff --git a/app/views/comments/search.html.erb b/app/views/comments/search.html.erb
index fbb8697e9..359cccfcf 100644
--- a/app/views/comments/search.html.erb
+++ b/app/views/comments/search.html.erb
@@ -4,7 +4,7 @@
<%= simple_form_for(:search, :method => :get, url: comments_path, defaults: { required: false }, html: { class: "inline-form" }) do |f| %>
<%= hidden_field_tag "group_by", "comment", :id => "group_by_full" %>
- <%= f.input :creator_name, label: "Commenter" %>
+ <%= f.input :creator_name, label: "Commenter", input_html: { data: { autocomplete: "user" } } %>
<%= f.input :body_matches, label: "Body" %>
<%= f.input :post_tags_match, label: "Tags", input_html: { data: { autocomplete: "tag-query" } } %>
<%= f.input :is_deleted, label: "Deleted?", collection: [["Yes", true], ["No", false]] %>
diff --git a/app/views/dmails/_form.html.erb b/app/views/dmails/_form.html.erb
index a89229859..fedec319c 100644
--- a/app/views/dmails/_form.html.erb
+++ b/app/views/dmails/_form.html.erb
@@ -1,5 +1,5 @@
<%= simple_form_for(dmail) do |f| %>
- <%= f.input :to_name, :label => "To" %>
+ <%= f.input :to_name, :label => "To", :input_html => { data: { autocomplete: "user" } } %>
<%= f.input :title, :as => :string %>
<%= dtext_field "dmail", "body" %>
<%= f.button :submit, "Send", :data => { :disable_with => "Sending..." } %>
diff --git a/app/views/dmails/_search.html.erb b/app/views/dmails/_search.html.erb
index 969745d0a..4dc61e470 100644
--- a/app/views/dmails/_search.html.erb
+++ b/app/views/dmails/_search.html.erb
@@ -2,7 +2,7 @@
<%= f.hidden_field :folder, value: params[:folder] %>
<%= f.input :title_matches, label: "Title", hint: "Use * for wildcard", input_html: { value: params[:search][:title_matches] } %>
<%= f.input :message_matches, label: "Message", hint: "Use * for wildcard", input_html: { value: params[:search][:messages_matches] } %>
- <%= f.input :to_name, label: "To", input_html: { value: params[:search][:to_name] } %>
- <%= f.input :from_name, label: "From", input_html: { value: params[:search][:from_name] } %>
+ <%= f.input :to_name, label: "To", input_html: { value: params[:search][:to_name], data: { autocomplete: "user" } } %>
+ <%= f.input :from_name, label: "From", input_html: { value: params[:search][:from_name], data: { autocomplete: "user" } } %>
<%= f.submit "Search" %>
<% end %>
diff --git a/app/views/forum_posts/search.html.erb b/app/views/forum_posts/search.html.erb
index 09bdf8e02..21ccd9a5a 100644
--- a/app/views/forum_posts/search.html.erb
+++ b/app/views/forum_posts/search.html.erb
@@ -4,7 +4,7 @@
<%= form_tag(forum_posts_path, :method => :get, :class => "simple_form") do %>
<%= search_field "topic_title_matches", :label => "Title" %>
<%= search_field "body_matches", :label => "Body" %>
- <%= search_field "creator_name", :label => "Author" %>
+ <%= search_field "creator_name", :label => "Author", :data => { autocomplete: "user" } %>
<%= select "search", "topic_category_id", ForumTopic::CATEGORIES.invert.to_a, :include_blank => true %>
diff --git a/app/views/janitor_trials/new.html.erb b/app/views/janitor_trials/new.html.erb
index 603aa360c..d18017484 100644
--- a/app/views/janitor_trials/new.html.erb
+++ b/app/views/janitor_trials/new.html.erb
@@ -5,7 +5,7 @@
<%= error_messages_for :janitor_trial %>
<%= simple_form_for(@janitor_trial) do |f| %>
- <%= f.input :user_name %>
+ <%= f.input :user_name, input_html: { data: { autocomplete: "user" } } %>
<%= f.button :submit, "Submit" %>
<%= f.button :submit, "Test" %>
<% end %>
diff --git a/app/views/mod_actions/_search.html.erb b/app/views/mod_actions/_search.html.erb
index 7464d3e7e..00b8c6a2b 100644
--- a/app/views/mod_actions/_search.html.erb
+++ b/app/views/mod_actions/_search.html.erb
@@ -1,5 +1,5 @@
<%= simple_form_for(:search, method: :get, url: mod_actions_path, defaults: { required: false }, html: { class: "inline-form" }) do |f| %>
- <%= f.input :creator_name, label: "Creator", input_html: { value: params[:search][:creator_name] } %>
+ <%= f.input :creator_name, label: "Creator", input_html: { value: params[:search][:creator_name], data: { autocomplete: "user" } } %>
<%= f.input :description_matches, label: "Description" %>
<%= f.input :category, label: "Category", collection: ModAction.categories.map {|k,v| [k.capitalize.tr("_"," "), v]}, include_blank: true,selected: params[:search][:category] %>
<%= f.submit "Search" %>
diff --git a/app/views/moderator/bulk_reverts/new.html.erb b/app/views/moderator/bulk_reverts/new.html.erb
index f0b703187..1efa2d70b 100644
--- a/app/views/moderator/bulk_reverts/new.html.erb
+++ b/app/views/moderator/bulk_reverts/new.html.erb
@@ -7,7 +7,7 @@
<%= form_tag(moderator_bulk_revert_path, :class => "simple_form") do %>
- <%= text_field :constraints, :user_name, :value => @constraints[:user_name] %>
+ <%= text_field :constraints, :user_name, :value => @constraints[:user_name], :data => { autocomplete: "user" } %>
diff --git a/app/views/moderator/dashboards/_search_ip_addr.html.erb b/app/views/moderator/dashboards/_search_ip_addr.html.erb
index ca2b6e906..826e3b046 100644
--- a/app/views/moderator/dashboards/_search_ip_addr.html.erb
+++ b/app/views/moderator/dashboards/_search_ip_addr.html.erb
@@ -11,7 +11,7 @@
<%= form_tag(moderator_ip_addrs_path, :method => :get, :class => "simple_form") do %>
- <%= text_field_tag "search[user_name]", params[:user_names] %>
+ <%= text_field_tag "search[user_name]", params[:user_names], data: { autocomplete: "user" } %>
Separate with commas
diff --git a/app/views/notes/search.html.erb b/app/views/notes/search.html.erb
index 147cd51a3..efd414409 100644
--- a/app/views/notes/search.html.erb
+++ b/app/views/notes/search.html.erb
@@ -6,7 +6,7 @@
<%= f.hidden_field :group_by, value: "note" %>
<%= f.input :body_matches, label: "Body" %>
- <%= f.input :creator_name, label: "Author" %>
+ <%= f.input :creator_name, label: "Author", input_html: { data: { autocomplete: "user" } } %>
<%= f.input :post_tags_match, label: "Tags", input_html: { data: { autocomplete: "tag-query" } } %>
<%= f.submit "Search" %>
<% end %>
diff --git a/app/views/pools/_search.html.erb b/app/views/pools/_search.html.erb
index d5a8401f2..b5a11bc1d 100644
--- a/app/views/pools/_search.html.erb
+++ b/app/views/pools/_search.html.erb
@@ -23,7 +23,7 @@
|
- <%= text_field "search", "creator_name", :value => params[:search][:creator_name] %>
+ <%= text_field "search", "creator_name", :value => params[:search][:creator_name], :data => { autocomplete: "pool" } %>
|
diff --git a/app/views/post_appeals/_search.html.erb b/app/views/post_appeals/_search.html.erb
index e197f1d3b..a923564cd 100644
--- a/app/views/post_appeals/_search.html.erb
+++ b/app/views/post_appeals/_search.html.erb
@@ -2,7 +2,7 @@
<%= f.input :reason_matches, label: "Reason", hint: "Use * for wildcard searches", input_html: { value: params[:search][:reason_matches] } %>
<%= f.input :post_tags_match, label: "Tags", input_html: { value: params[:search][:post_tags_match], data: { autocomplete: "tag-query" } } %>
<%= f.input :post_id, label: "Post ID", input_html: { value: params[:search][:post_id] } %>
- <%= f.input :creator_name, label: "Creator", input_html: { value: params[:search][:creator_name] } %>
+ <%= f.input :creator_name, label: "Creator", input_html: { value: params[:search][:creator_name], data: { autocomplete: "user" } } %>
<%= f.input :is_resolved, label: "Resolved?", collection: [["Yes", true], ["No", false]], include_blank: true, selected: params[:search][:is_resolved] %>
<%= f.submit "Search" %>
<% end %>
diff --git a/app/views/post_approvals/index.html.erb b/app/views/post_approvals/index.html.erb
index 1c7d2e13b..ce0073786 100644
--- a/app/views/post_approvals/index.html.erb
+++ b/app/views/post_approvals/index.html.erb
@@ -4,7 +4,7 @@
<%= render "posts/partials/common/inline_blacklist" %>
<%= simple_form_for(:search, url: post_approvals_path, method: :get, defaults: { required: false }, html: { class: "inline-form" }) do |f| %>
- <%= f.input :user_name, label: "Approver", input_html: { value: params[:search][:user_name] } %>
+ <%= f.input :user_name, label: "Approver", input_html: { value: params[:search][:user_name], data: { autocomplete: "user" } } %>
<%= f.input :post_tags_match, label: "Tags", input_html: { value: params[:search][:post_tags_match], data: { autocomplete: "tag-query" } } %>
<%= f.submit "Search" %>
<% end %>
diff --git a/app/views/post_flags/_search.html.erb b/app/views/post_flags/_search.html.erb
index 003466650..c1fee8ae7 100644
--- a/app/views/post_flags/_search.html.erb
+++ b/app/views/post_flags/_search.html.erb
@@ -3,7 +3,7 @@
<%= f.input :post_tags_match, label: "Tags", input_html: { value: params[:search][:post_tags_match], data: { autocomplete: "tag-query" } } %>
<%= f.input :post_id, label: "Post ID", input_html: { value: params[:search][:post_id] } %>
<% if CurrentUser.is_moderator? %>
- <%= f.input :creator_name, label: "Creator", input_html: { value: params[:search][:creator_name] } %>
+ <%= f.input :creator_name, label: "Creator", input_html: { value: params[:search][:creator_name], data: { autocomplete: "user" } } %>
<% end %>
<%= f.input :is_resolved, label: "Resolved?", collection: [["Yes", true], ["No", false]], include_blank: true, selected: params[:search][:is_resolved] %>
<%= f.input :category, label: "Category", collection: ["normal", "unapproved", "rejected", "deleted", "banned", "duplicate"], include_blank: true, selected: params[:search][:category] %>
diff --git a/app/views/post_replacements/index.html.erb b/app/views/post_replacements/index.html.erb
index d42dc5ff1..6dc27a4c2 100644
--- a/app/views/post_replacements/index.html.erb
+++ b/app/views/post_replacements/index.html.erb
@@ -5,7 +5,7 @@
<%= render "posts/partials/common/inline_blacklist" %>
<%= simple_form_for(:search, url: post_replacements_path, method: :get, defaults: { required: false }, html: { class: "inline-form" }) do |f| %>
- <%= f.input :creator_name, label: "Replacer", input_html: { value: params[:search][:creator_name] } %>
+ <%= f.input :creator_name, label: "Replacer", input_html: { value: params[:search][:creator_name], data: { autocomplete: "user" } } %>
<%= f.input :post_tags_match, label: "Tags", input_html: { value: params[:search][:post_tags_match], data: { autocomplete: "tag-query" } } %>
<%= f.submit "Search" %>
<% end %>
diff --git a/app/views/post_versions/search.html.erb b/app/views/post_versions/search.html.erb
index 2b4890cd9..42df861be 100644
--- a/app/views/post_versions/search.html.erb
+++ b/app/views/post_versions/search.html.erb
@@ -4,7 +4,7 @@
<%= form_tag(post_versions_path, :method => :get, :class => "simple_form") do %>
- <%= search_field "updater_name", :label => "User" %>
+ <%= search_field "updater_name", :label => "User", :data => { autocomplete: "user" } %>
<%= search_field "post_id", :label => "Post" %>
<%= submit_tag "Search" %>
<% end %>
diff --git a/app/views/user_feedbacks/new.html.erb b/app/views/user_feedbacks/new.html.erb
index 1b35d402e..d37437c3b 100644
--- a/app/views/user_feedbacks/new.html.erb
+++ b/app/views/user_feedbacks/new.html.erb
@@ -14,7 +14,7 @@
<%= error_messages_for "user_feedback" %>
<%= simple_form_for(@user_feedback) do |f| %>
- <%= f.input :user_name, :label => "User" %>
+ <%= f.input :user_name, :label => "User", :input_html => { data: { autocomplete: "user" } } %>
<%= f.input :category, :collection => ["positive", "neutral", "negative"], :include_blank => false %>
<%= dtext_field "user_feedback", "body" %>
<%= f.button :submit, "Submit" %>
diff --git a/app/views/user_feedbacks/search.html.erb b/app/views/user_feedbacks/search.html.erb
index e5354ae09..ec3e0d6a3 100644
--- a/app/views/user_feedbacks/search.html.erb
+++ b/app/views/user_feedbacks/search.html.erb
@@ -3,10 +3,8 @@
Search User Feedbacks
<%= form_tag(user_feedbacks_path, :method => :get, :class => "simple_form") do %>
- <%= search_field "user_name", :label => "User" %>
-
- <%= search_field "creator_name", :label => "Creator" %>
-
+ <%= search_field "user_name", :label => "User", :data => { autocomplete: "user" } %>
+ <%= search_field "creator_name", :label => "Creator", :data => { autocomplete: "user" } %>
<%= search_field "body_matches", :label => "Message" %>