]> source.dussan.org Git - redmine.git/commitdiff
Code cleanup.
authorEtienne Massip <etienne.massip@gmail.com>
Tue, 26 Jun 2012 17:36:29 +0000 (17:36 +0000)
committerEtienne Massip <etienne.massip@gmail.com>
Tue, 26 Jun 2012 17:36:29 +0000 (17:36 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9899 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/application_helper.rb

index d32c86b75b10c6d2a1627d2833a3911cf89e91e5..7772035d3e7bc02fd3d36a4883edf8086f2a8d83 100644 (file)
@@ -239,21 +239,22 @@ module ApplicationHelper
     return unless User.current.logged?
     projects = User.current.memberships.collect(&:project).compact.select(&:active?).uniq
     if projects.any?
-      s = '<select onchange="if (this.value != \'\') { window.location = this.value; }">' +
-            "<option value=''>#{ l(:label_jump_to_a_project) }</option>" +
-            '<option value="" disabled="disabled">---</option>'
-      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 =
+        ("<option value=''>#{ l(:label_jump_to_a_project) }</option>" +
+         '<option value="" disabled="disabled">---</option>').html_safe
+
+      options << project_tree_options_for_select(projects, :selected => @project) do |p|
+        { :value => project_path(:id => p, :jump => current_menu_item) }
       end
-      s << '</select>'
-      s.html_safe
+
+      select_tag('project_quick_jump_box', options, :onchange => 'if (this.value != \'\') { window.location = this.value; }')
     end
   end
 
   def project_tree_options_for_select(projects, options = {})
     s = ''
     project_tree(projects) do |project, level|
-      name_prefix = (level > 0 ? ('&nbsp;' * 2 * level + '&#187; ') : '').html_safe
+      name_prefix = (level > 0 ? '&nbsp;' * 2 * level + '&#187; ' : '').html_safe
       tag_options = {:value => project.id}
       if project == options[:selected] || (options[:selected].respond_to?(:include?) && options[:selected].include?(project))
         tag_options[:selected] = 'selected'