Code cleanup.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9899 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
eb8f455c13
commit
56cf381357
|
@ -239,21 +239,22 @@ module ApplicationHelper
|
||||||
return unless User.current.logged?
|
return unless User.current.logged?
|
||||||
projects = User.current.memberships.collect(&:project).compact.select(&:active?).uniq
|
projects = User.current.memberships.collect(&:project).compact.select(&:active?).uniq
|
||||||
if projects.any?
|
if projects.any?
|
||||||
s = '<select onchange="if (this.value != \'\') { window.location = this.value; }">' +
|
options =
|
||||||
"<option value=''>#{ l(:label_jump_to_a_project) }</option>" +
|
("<option value=''>#{ l(:label_jump_to_a_project) }</option>" +
|
||||||
'<option value="" disabled="disabled">---</option>'
|
'<option value="" disabled="disabled">---</option>').html_safe
|
||||||
s << project_tree_options_for_select(projects, :selected => @project) do |p|
|
|
||||||
{ :value => url_for(:controller => 'projects', :action => 'show', :id => p, :jump => current_menu_item) }
|
options << project_tree_options_for_select(projects, :selected => @project) do |p|
|
||||||
|
{ :value => project_path(:id => p, :jump => current_menu_item) }
|
||||||
end
|
end
|
||||||
s << '</select>'
|
|
||||||
s.html_safe
|
select_tag('project_quick_jump_box', options, :onchange => 'if (this.value != \'\') { window.location = this.value; }')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def project_tree_options_for_select(projects, options = {})
|
def project_tree_options_for_select(projects, options = {})
|
||||||
s = ''
|
s = ''
|
||||||
project_tree(projects) do |project, level|
|
project_tree(projects) do |project, level|
|
||||||
name_prefix = (level > 0 ? (' ' * 2 * level + '» ') : '').html_safe
|
name_prefix = (level > 0 ? ' ' * 2 * level + '» ' : '').html_safe
|
||||||
tag_options = {:value => project.id}
|
tag_options = {:value => project.id}
|
||||||
if project == options[:selected] || (options[:selected].respond_to?(:include?) && options[:selected].include?(project))
|
if project == options[:selected] || (options[:selected].respond_to?(:include?) && options[:selected].include?(project))
|
||||||
tag_options[:selected] = 'selected'
|
tag_options[:selected] = 'selected'
|
||||||
|
|
Loading…
Reference in New Issue