-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replaced Rails loop with JavaScript map to handle instructor merges #26
base: master
Are you sure you want to change the base?
Conversation
🉑 👍 🌞 |
result( function(event,item) { | ||
$('#id_' + i)[0].value = item.id; | ||
$('#ibox' + i)[0].disabled = true; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicks about the indentation and lane breaks here:
success
should be lined up withurl
.- Why is
autocomplete
on a separate line? It fits within 80 characters with the previous line. result
should be indented more.- Having three nested anonymous functions in the
success
handler is pretty confusing to read. I would create a new named function and just reference it here. - There is inconsistent spacing around function arguments. I would personally prefer no spaces before or after parentheses and a space after every comma.
I realize you weren't responsible for most of the things I pointed out, but I figured we might as well clean it up while we're at it. Everything else LGTM. |
$.ajax({ | ||
url: <%= raw coursesurveys_instructor_ids_path.inspect %>, | ||
success: function(data) { | ||
[0,1].map(function(i) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah...maybe this wasn't the best way of curing the problem. We might as well jQuery all the way.
Instead of using the ID selectors, a class applied to the inputs and the hidden fields might be a better idea. Say the fields currently id'd as iboxN
had the class instructor-name
. You could then write:
$('.instructor-name').each(function() {
// ... your code here, where this refers to each of the elements with the class 'instructor-name'
});
Followed advice from @seshness