[#692] enable jump to project box to take options (projects and html)

This commit is contained in:
jwollert 2011-09-29 17:16:51 +02:00 committed by Eric Davis
parent 977f74e11a
commit edce16c89a

View File

@ -224,17 +224,15 @@ module ApplicationHelper
end end
# Renders the project quick-jump box # Renders the project quick-jump box
def render_project_jump_box def render_project_jump_box(projects = [], html_options = {})
projects = User.current.memberships.collect(&:project).compact.uniq projects ||= User.current.memberships.collect(&:project).compact.uniq
if projects.any? if projects.any?
s = '<select onchange="if (this.value != \'\') { window.location = this.value; }">' + # option_tags = content_tag :option, l(:label_jump_to_a_project), :value => ""
"<option value=''>#{ l(:label_jump_to_a_project) }</option>" + option_tags = (content_tag :option, "", :value => "" )
'<option value="" disabled="disabled">---</option>' option_tags << project_tree_options_for_select(projects, :selected => @project) do |p|
s << project_tree_options_for_select(projects, :selected => @project) do |p| { :value => url_for(:controller => 'projects', :action => 'show', :id => p, :jump => current_menu_item) }
{ :value => url_for(:controller => 'projects', :action => 'show', :id => p, :jump => current_menu_item) } end
end select_tag "", option_tags, html_options.merge({ :onchange => "if (this.value != \'\') { window.location = this.value; }" })
s << '</select>'
s
end end
end end