]> source.dussan.org Git - redmine.git/commitdiff
Auto-complete issues #id in the search form (#32052).
authorGo MAEDA <maeda@farend.jp>
Sat, 21 Sep 2019 07:52:16 +0000 (07:52 +0000)
committerGo MAEDA <maeda@farend.jp>
Sat, 21 Sep 2019 07:52:16 +0000 (07:52 +0000)
Patch by Mizuki ISHIKAWA.

git-svn-id: http://svn.redmine.org/redmine/trunk@18498 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/views/layouts/base.html.erb
app/views/search/index.html.erb
public/javascripts/application.js

index 1ed1032e9727184d2dfab06b5b64f3ca7203ace8..42819c1fbed4f183a8c96b7d7dce976e9a5b6b59 100644 (file)
         <label for='q'>
           <%= link_to l(:label_search), {:controller => 'search', :action => 'index', :id => @project, :scope => default_search_project_scope}, :accesskey => accesskey(:search) %>:
         </label>
-        <%= text_field_tag 'q', @question, :size => 20, :class => 'small', :accesskey => accesskey(:quick_search) %>
+        <%= text_field_tag 'q', @question, :size => 20, :class => 'small', :accesskey => accesskey(:quick_search),
+                            :data => {
+                                :auto_complete => true,
+                                :issues_url => auto_complete_issues_path(:q => '')
+                            } %>
         <% end %>
         <%= render_project_jump_box %>
     </div>
index ab11f5a4989e212d7437be5f075aaa6e4e752858..5160f04feacdc10c07598a06b2a86822173cc040 100644 (file)
@@ -3,7 +3,11 @@
 <%= form_tag({}, :method => :get, :id => 'search-form') do %>
 <div class="box">
 <%= label_tag "search-input", l(:description_search), :class => "hidden-for-sighted" %>
-<p><%= text_field_tag 'q', @question, :size => 60, :id => 'search-input' %>
+<p><%= text_field_tag 'q', @question, :size => 60, :id => 'search-input',
+                      :data => {
+                          :auto_complete => true,
+                          :issues_url => auto_complete_issues_path(:q => '')
+                      } %>
 <%= project_select_tag %>
 <%= hidden_field_tag 'all_words', '', :id => nil %>
 <label><%= check_box_tag 'all_words', 1, @all_words %> <%= l(:label_all_words) %></label>
index 0868f971a1a91af052015c58fd3bc38e7aa57386..e125e68b4613bf30ea7549d25c4bf93bbeca24f4 100644 (file)
@@ -1036,6 +1036,9 @@ function inlineAutoComplete(element) {
     const tribute = new Tribute({
       trigger: '#',
       values: function (text, cb) {
+        if (event.target.type === 'text' && $(element).attr('autocomplete') != 'off') {
+          $(element).attr('autocomplete', 'off');
+        }
         remoteSearch(issuesUrl + text, function (issues) {
           return cb(issues);
         });