@@ -239,21 +239,22 module ApplicationHelper | |||
|
239 | 239 | return unless User.current.logged? |
|
240 | 240 | projects = User.current.memberships.collect(&:project).compact.select(&:active?).uniq |
|
241 | 241 | if projects.any? |
|
242 | s = '<select onchange="if (this.value != \'\') { window.location = this.value; }">' + | |
|
243 |
|
|
|
244 |
|
|
|
245 | s << project_tree_options_for_select(projects, :selected => @project) do |p| | |
|
246 | { :value => url_for(:controller => 'projects', :action => 'show', :id => p, :jump => current_menu_item) } | |
|
242 | options = | |
|
243 | ("<option value=''>#{ l(:label_jump_to_a_project) }</option>" + | |
|
244 | '<option value="" disabled="disabled">---</option>').html_safe | |
|
245 | ||
|
246 | options << project_tree_options_for_select(projects, :selected => @project) do |p| | |
|
247 | { :value => project_path(:id => p, :jump => current_menu_item) } | |
|
247 | 248 | end |
|
248 | s << '</select>' | |
|
249 | s.html_safe | |
|
249 | ||
|
250 | select_tag('project_quick_jump_box', options, :onchange => 'if (this.value != \'\') { window.location = this.value; }') | |
|
250 | 251 | end |
|
251 | 252 | end |
|
252 | 253 | |
|
253 | 254 | def project_tree_options_for_select(projects, options = {}) |
|
254 | 255 | s = '' |
|
255 | 256 | project_tree(projects) do |project, level| |
|
256 |
name_prefix = (level > 0 ? |
|
|
257 | name_prefix = (level > 0 ? ' ' * 2 * level + '» ' : '').html_safe | |
|
257 | 258 | tag_options = {:value => project.id} |
|
258 | 259 | if project == options[:selected] || (options[:selected].respond_to?(:include?) && options[:selected].include?(project)) |
|
259 | 260 | tag_options[:selected] = 'selected' |
General Comments 0
You need to be logged in to leave comments.
Login now