summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-12-16 08:42:45 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-12-16 08:42:45 +0000
commitff81353e8cfd099f83f70008d4a04aa3a4079ad6 (patch)
tree2db8cc73e8eed16c7b32d6ed3ebe0b6b12d0d528
parent68c7f4ef208524e0c9f866cebac4ba349b944b23 (diff)
downloadredmine-ff81353e8cfd099f83f70008d4a04aa3a4079ad6.tar.gz
redmine-ff81353e8cfd099f83f70008d4a04aa3a4079ad6.zip
Time entry form - limit issue autocomplete to already selected project (#24189).
Patch by Jens Kraemer. git-svn-id: http://svn.redmine.org/redmine/trunk@16082 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/views/timelog/_form.html.erb37
1 files changed, 32 insertions, 5 deletions
diff --git a/app/views/timelog/_form.html.erb b/app/views/timelog/_form.html.erb
index f5bc15100..712c7bde7 100644
--- a/app/views/timelog/_form.html.erb
+++ b/app/views/timelog/_form.html.erb
@@ -38,10 +38,37 @@
});
});
- observeAutocompleteField('time_entry_issue_id', '<%= escape_javascript auto_complete_issues_path(:project_id => @project, :scope => (@project ? nil : 'all'))%>', {
- select: function(event, ui) {
- $('#time_entry_issue').text('');
- $('#time_entry_issue_id').val(ui.item.value).change();
+ observeAutocompleteField('time_entry_issue_id',
+ function(request, callback) {
+ var url = '<%= j auto_complete_issues_path %>';
+ var data = {
+ term: request.term
+ };
+ var project_id;
+ <% if @project %>
+ project_id = '<%= @project.id %>';
+ <% else %>
+ project_id = $('#time_entry_project_id').val();
+ <% end %>
+ if(project_id){
+ data['project_id'] = project_id;
+ } else {
+ data['scope'] = 'all';
+ }
+
+ $.get(url, data, null, 'json')
+ .done(function(data){
+ callback(data);
+ })
+ .fail(function(jqXHR, status, error){
+ callback([]);
+ });
+ },
+ {
+ select: function(event, ui) {
+ $('#time_entry_issue').text('');
+ $('#time_entry_issue_id').val(ui.item.value).change();
+ }
}
- });
+ );
<% end %>