15 |
15 |
<% end %>
|
16 |
16 |
|
17 |
17 |
<% if @issue.safe_attribute? 'assigned_to_id' %>
|
18 |
|
<p><%= f.select :assigned_to_id, principals_options_for_select(@issue.assignable_users, @issue.assigned_to), :include_blank => true, :required => @issue.required_attribute?('assigned_to_id') %></p>
|
|
18 |
<p><label><%= l(:field_assigned_to) %></label> <%= text_field_tag :issue_assigned_to_autocomplete, @issue.assigned_to ? @issue.assigned_to.name : '' %><%= f.hidden_field :assigned_to_id %></p>
|
19 |
19 |
<% end %>
|
20 |
20 |
|
21 |
21 |
<% if @issue.safe_attribute?('category_id') && @issue.project.issue_categories.any? %>
|
... | ... | |
81 |
81 |
<% end %>
|
82 |
82 |
|
83 |
83 |
<% include_calendar_headers_tags %>
|
|
84 |
<% if @issue.safe_attribute? 'assigned_to_id' %>
|
|
85 |
<%= javascript_tag do %>
|
|
86 |
var assignner_list = <%= raw @issue.assignable_users.map {|u| {:id => u.id, :label => u.name, :css => u.class.to_s.downcase}}.to_json %>;
|
|
87 |
observeAutocompleteField('issue_assigned_to_autocomplete', '', {
|
|
88 |
source: assignner_list,
|
|
89 |
minLength: 0,
|
|
90 |
select: function(event, ui) {$('#issue_assigned_to_id').val(ui.item.id);},
|
|
91 |
change: function(event, ui) {
|
|
92 |
var assigners = $.grep(assignner_list, function(item, i){return(item.label.toLowerCase()==$('#issue_assigned_to_autocomplete').val().toLowerCase());});
|
|
93 |
|
|
94 |
if(assigners.length==1){
|
|
95 |
$('#issue_assigned_to_autocomplete').val(assigners[0].label);
|
|
96 |
$('#issue_assigned_to_id').val(assigners[0].id);
|
|
97 |
}else{
|
|
98 |
$('#issue_assigned_to_autocomplete, #issue_assigned_to_id').val('');
|
|
99 |
}
|
|
100 |
},
|
|
101 |
create: function(){
|
|
102 |
$(this).data('ui-autocomplete')._renderItem = function(ul, item){
|
|
103 |
ul.css({'background':'#eee'});
|
|
104 |
return $('<li style="white-space:nowrap">')
|
|
105 |
.append('<div><i class="icon icon-'+item.css+'"></i>'+item.label+'</div>')
|
|
106 |
.appendTo(ul);
|
|
107 |
};
|
|
108 |
}
|
|
109 |
});
|
|
110 |
$('#issue_assigned_to_autocomplete').focus(function(){
|
|
111 |
$(this).data("uiAutocomplete").search($(this).val());
|
|
112 |
});
|
|
113 |
<% end %>
|
|
114 |
<% end %>
|