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