def select2_tag(name, ws_url, options={})
width=options[:width]||'250px'
- html_id=options[:html_id]||name
+ html_id=options[:html_id]||sanitize_to_id(name).gsub('.', '_')
html_class=options[:html_class]||''
min_length=options[:min_length]
if user
# the login is a string so it have to be surrounded by quote to be taken in account by select2
options[:selected_id]="'" + user.login + "'"
- options[:selected_text]=user.name
+ options[:selected_text]=user.name + ' (' + user.login + ')'
end
select2_tag(name, ws_url, options)
select_tag name, select_options, html_options
when PropertyType::TYPE_USER_LOGIN
- text_field_tag name, value, {:size => options[:size] || 50}.update(html_options)
+ user = User.find_active_by_login(value)
+ user_select_tag name, {:size => options[:size] || 50, :selected_user => user, :allow_empty => true, :include_choices => [ ['', message('none')] ] }.update(html_options)
else
hidden_field_tag id, html_options
options = {:id => id}
options[:size] = (defined? size) ? size : nil
%>
-<%= property_input_field(name, PropertyType::TYPE_USER_LOGIN, value, PropertiesHelper::SCREEN_SETTINGS, options) %>
\ No newline at end of file
+<%= property_input_field(name, PropertyType::TYPE_USER_LOGIN, value, PropertiesHelper::SCREEN_SETTINGS, options) %>