#37: search user by keyup instead of 'press enter'

This commit is contained in:
Vokhmin Alexey V 2013-03-21 22:14:07 +04:00
parent c43c87cf04
commit 922ab778f4
3 changed files with 11 additions and 17 deletions

View File

@ -115,24 +115,16 @@ $(document).ready(function() {
return false;
};
$('#search_user').live('submit', function() {
var id = $(this).attr('id');
if(id.indexOf('user') != -1) { // FIXME
var which = 'users';
}
else if (id.indexOf('labels') != -1) {
var which = 'labels';
}
$.ajax({
var isSearchUser = null;
$('#search_user').on('keyup', function() {
if (isSearchUser != null) { isSearchUser.abort(); }
isSearchUser = $.ajax({
type: 'GET',
url: $(this).attr("action"),
url: $('#search_user_path').attr('path'),
data: $(this).serialize(),
success: function(data){
$('#manage_issue_'+ which +'_list').html(data);
},
error: function(data){
alert('error') // TODO remove
}
$('#manage_issue_users_list').html(data);
}
});
return false;
});

View File

@ -1949,7 +1949,7 @@ article .activity .top {
font-weight: bold;
.title { display: inline-block; }
}
form {
.search-container {
padding: 10px 15px 10px 10px;
border-bottom: 1px solid #D6D6D6;
input {

View File

@ -2,9 +2,11 @@
.header
.title= t('layout.issues.assign_someone')
%span.icon-remove-circle
= form_tag search_collaborators_project_issues_path(@project, :id => @issue.id), :id => 'search_user', :method => :get do
.search-container
#search_user_path{:path => search_collaborators_project_issues_path(@project, :id => @issue.id)}
= tracker_search_field(:search_user, t('layout.issues.search_user'))
- unless [:new, :create].include?(action_name.to_sym)
= form_for :issue, :url => [@project, @issue], :method => :put, :html => { :class => 'edit_assignee issue'} do |f|
= hidden_field_tag "user-default_assignee", nil, :name => 'issue[assignee_id]'