comparison app/helpers/projects_helper.rb @ 1464:261b3d9a4903 redmine-2.4

Update to Redmine 2.4 branch rev 12663
author Chris Cannam
date Tue, 14 Jan 2014 14:37:42 +0000
parents 433d4f72a19b
children 51364c0cd58f e248c7af89ec
comparison
equal deleted inserted replaced
1296:038ba2d95de8 1464:261b3d9a4903
1 # encoding: utf-8 1 # encoding: utf-8
2 # 2 #
3 # Redmine - project management software 3 # Redmine - project management software
4 # Copyright (C) 2006-2012 Jean-Philippe Lang 4 # Copyright (C) 2006-2013 Jean-Philippe Lang
5 # 5 #
6 # This program is free software; you can redistribute it and/or 6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License 7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2 8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version. 9 # of the License, or (at your option) any later version.
44 if parent_id 44 if parent_id
45 selected = (parent_id.blank? ? nil : Project.find(parent_id)) 45 selected = (parent_id.blank? ? nil : Project.find(parent_id))
46 end 46 end
47 47
48 options = '' 48 options = ''
49 options << "<option value=''></option>" if project.allowed_parents.include?(nil) 49 options << "<option value=''>&nbsp;</option>" if project.allowed_parents.include?(nil)
50 options << project_tree_options_for_select(project.allowed_parents.compact, :selected => selected) 50 options << project_tree_options_for_select(project.allowed_parents.compact, :selected => selected)
51 content_tag('select', options.html_safe, :name => 'project[parent_id]', :id => 'project_parent_id') 51 content_tag('select', options.html_safe, :name => 'project[parent_id]', :id => 'project_parent_id')
52 end 52 end
53 53
54 # Renders the projects index 54 # Renders the projects index
67 grouped = Hash.new {|h,k| h[k] = []} 67 grouped = Hash.new {|h,k| h[k] = []}
68 versions.each do |version| 68 versions.each do |version|
69 grouped[version.project.name] << [version.name, version.id] 69 grouped[version.project.name] << [version.name, version.id]
70 end 70 end
71 71
72 selected = selected.is_a?(Version) ? selected.id : selected
72 if grouped.keys.size > 1 73 if grouped.keys.size > 1
73 grouped_options_for_select(grouped, selected && selected.id) 74 grouped_options_for_select(grouped, selected)
74 else 75 else
75 options_for_select((grouped.values.first || []), selected && selected.id) 76 options_for_select((grouped.values.first || []), selected)
76 end 77 end
77 end 78 end
78 79
79 def format_version_sharing(sharing) 80 def format_version_sharing(sharing)
80 sharing = 'none' unless Version::VERSION_SHARINGS.include?(sharing) 81 sharing = 'none' unless Version::VERSION_SHARINGS.include?(sharing)