Fixed the new clone name-autosuggester to work as advertised
[gitorious:mainline.git] / lib / gitorious_form_builder.rb
1 class GitoriousFormBuilder < ActionView::Helpers::FormBuilder
2   
3   # Creates a set of radio buttons for the current_user and a select tag
4   # for any groups he's a member of
5   def current_user_or_group(field, label_title, hint = nil, options = {})
6     result = [label(field, label_title), "<br />"]
7     result << "Me: " + radio_button("#{field}_type", "User", {:checked => true})
8     result << "Group: " + radio_button("#{field}_type", "Group")
9     result << select("#{field}_id", @template.current_user.groups.map{|g| [g.name, g.id] }, 
10                       {}, :id => "#{object_name}_#{field}_id_group_select")
11     if options[:hint]
12       result << content_tag(:p, options[:hint], :class => "hint")
13     end
14     result.join("\n")
15   end
16 end