Created
April 29, 2010 17:44
-
-
Save tcocca/383943 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
page << <<-JS | |
var manager = $('office_manager_attr').value; | |
var office_admin = $('office_office_admin_attr').value; | |
var managers_arr = Array(); | |
var office_admins_arr = Array(); | |
managers_arr.push(new Option('', '')); | |
office_admins_arr.push(new Option('', '')); | |
JS | |
@agents.each do |agent| | |
page << <<-JS | |
managers_arr.push(new Option('#{agent.full_name}', 'Agent_#{agent.id}')); | |
office_admins_arr.push(new Option('#{agent.full_name}', 'Agent_#{agent.id}')); | |
JS | |
end | |
@employees.each do |employee| | |
page << <<-JS | |
managers_arr.push(new Option('#{employee.full_name}', 'Employee#{employee.id}')); | |
office_admins_arr.push(new Option('#{employee.full_name}', 'Employee#{employee.id}')); | |
JS | |
end | |
page << <<-JS | |
var managers = $('office_manager_attr'); | |
var office_admins = $('office_office_admin_attr'); | |
managers.options.length = 0; | |
office_admins.options.length = 0; | |
for (i = 0; i < managers_arr.length; i++) { | |
managers.options[i] = managers_arr[i]; | |
office_admins.options[i] = office_admins_arr[i]; | |
} | |
$('office_manager_attr').value = manager; | |
$('office_office_admin_attr').value = office_admin; | |
RedBox.close(); | |
JS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment