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

View File

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

View File

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