mirror of
https://github.com/redmine/redmine.git
synced 2025-11-14 01:06:00 +01:00
Adds a optgroup for groups in users/groups select tags.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6307 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -291,6 +291,20 @@ module ApplicationHelper
|
||||
end
|
||||
s
|
||||
end
|
||||
|
||||
# Returns a string for users/groups option tags
|
||||
def principals_options_for_select(collection, selected=nil)
|
||||
s = ''
|
||||
groups = ''
|
||||
collection.sort.each do |element|
|
||||
selected_attribute = ' selected="selected"' if option_value_selected?(element, selected)
|
||||
(element.is_a?(Group) ? groups : s) << %(<option value="#{element.id}"#{selected_attribute}>#{h element.name}</option>)
|
||||
end
|
||||
unless groups.empty?
|
||||
s << %(<optgroup label="#{h(l(:label_group_plural))}">#{groups}</optgroup>)
|
||||
end
|
||||
s
|
||||
end
|
||||
|
||||
# Truncates and returns the string as a single line
|
||||
def truncate_single_line(string, *args)
|
||||
|
||||
Reference in New Issue
Block a user