Patch #30071 » 0002-Mark-current-project-when-filtering-project-jump-box.patch
app/controllers/projects_controller.rb | ||
---|---|---|
70 | 70 |
else |
71 | 71 |
@projects = User.current.projects.to_a |
72 | 72 |
end |
73 | ||
74 |
if params[:current_project_id].present? |
|
75 |
@selected = Project.find(params[:current_project_id]) |
|
76 |
end |
|
73 | 77 |
} |
74 | 78 |
end |
75 | 79 |
end |
app/helpers/application_helper.rb | ||
---|---|---|
431 | 431 |
text = @project.name_was |
432 | 432 |
end |
433 | 433 |
text ||= l(:label_jump_to_a_project) |
434 |
url = autocomplete_projects_path(:format => 'js', :jump => current_menu_item) |
|
434 |
url = autocomplete_projects_path(:format => 'js', :jump => current_menu_item, :current_project_id => @project.try(:id))
|
|
435 | 435 | |
436 | 436 |
trigger = content_tag('span', text, :class => 'drdn-trigger') |
437 | 437 |
q = text_field_tag('q', '', :id => 'projects-quick-search', :class => 'autocomplete', :data => {:automcomplete_url => url}, :autocomplete => 'off') |
app/views/projects/autocomplete.js.erb | ||
---|---|---|
1 | 1 |
<% |
2 | 2 |
s = '' |
3 | 3 |
if @projects.any? |
4 |
s = render_projects_for_jump_box(@projects, params[:q]) |
|
4 |
s = render_projects_for_jump_box(@projects, params[:q], @selected)
|
|
5 | 5 |
elsif params[:q].present? |
6 | 6 |
s = content_tag('span', l(:label_no_data)) |
7 | 7 |
end |