新建问题-主题-autocomplete-选中跳转

This commit is contained in:
ganyiang 2014-05-07 20:30:42 +08:00
parent 9b151567f1
commit 786481e144
4 changed files with 9 additions and 3 deletions

View File

@ -30,6 +30,7 @@ class AutoCompletesController < ApplicationController
@issues.compact!
end
render :layout => false
end
private

View File

@ -15,6 +15,7 @@
<% if @issue.safe_attribute? 'tracker_id' %>
<p><%= f.select :tracker_id, @issue.project.trackers.collect {|t| [t.name, t.id]}, {:required => true},
:onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')" %></p>
<% end %>

View File

@ -476,12 +476,16 @@ function observeAutocompleteField(fieldId, url, options) {
$(document).ready(function() {
$('#'+fieldId).autocomplete($.extend({
source: url,
select: function(e,ui){location.href("/issues/"+ui.item.value);},
minLength: 2,
search: function(){$('#'+fieldId).addClass('ajax-loading');},
response: function(){$('#'+fieldId).removeClass('ajax-loading');}
response: function(){$('#'+fieldId).removeClass('ajax-loading');
}
}, options));
$('#'+fieldId).addClass('autocomplete');
});
}
function observeSearchfield(fieldId, targetId, url) {