Project

General

Profile

assigned_to_id autocomplete with text field?

Added by Eve Maple over 10 years ago

Just found some relations in application helper and the view

Function called in view

principals_options_for_select(@issue.assignable_users, @issue.assigned_to)

Functions in helper

  def principals_options_for_select(collection, selected=nil)
    s = ''
    if collection.include?(User.current)
      s << content_tag('option', "<< #{l(:label_me)} >>", :value => User.current.id)
    end
    groups = ''
    collection.sort.each do |element|
      selected_attribute = ' selected="selected"' if option_value_selected?(element, selected) || element.id.to_s == 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.html_safe
  end

The way we need is like related issue autocomplete and watcher autocomplete that we just type in a name and let me select or like the watcher div layer.
It's TOO MANY ppl in my "assigned to" list.