-
Notifications
You must be signed in to change notification settings - Fork 231
Improve extensions + submissions autocomplete #1532
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
Merged
Merged
Changes from 12 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
f887b72
Apply cg2v@057493b
damianhxy dbb10cd
Apply cg2v@752a44f
damianhxy 2951f7f
Prevent XSS
damianhxy 82cac3a
Remove html_safe
damianhxy 9b57e09
Handle differences in base 64 encoding
damianhxy 0aeb7c0
Add semicolon
damianhxy 2f2c3f5
Remove extraneous help-blocks
damianhxy 5c21af0
Update form style
damianhxy 13c9b5d
Standardize submissions autocomplete
damianhxy fe002bd
Fix gradebook xss
damianhxy d4faa37
Extract backend autocomplete logic
damianhxy dff8809
Extract frontend autocomplete logic
damianhxy 664ea22
Prevent email XSS
damianhxy f2b13f1
Refactor autocomplete partial
damianhxy 7e7cf42
Escape HTML in flash
damianhxy 0697434
Fix roster csv
damianhxy e50d016
urlsafe_encode64 -> strict_encode64
damianhxy 97ae382
Remove sanitize
damianhxy e8b9e51
Add informative comments
damianhxy cae2974
Rename common to components
damianhxy 122da01
Shift method to Course model
damianhxy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<script type="application/javascript"> | ||
/* requires @usersEncoded and @users to be set, i.e. via retrieve_autocompletion_data! */ | ||
jQuery(function() { | ||
/* match user name/email with cud_id */ | ||
/* escape_javascript prevents issues with backslashes in names, etc. */ | ||
userData = { | ||
<% @usersEncoded.each do |k,v| %> | ||
"<%= j k %>": "<%= v %>", | ||
<% end %> | ||
}; | ||
|
||
/* user autocomplete */ | ||
$studentAutocompleteField = $('#student_autocomplete'); | ||
$hiddenCUDField = $('<%= hiddenCUDField %>'); | ||
$studentAutocompleteField.autocomplete({ | ||
data: { | ||
<% @users.each do |k,v| %> | ||
"<%= j k %>": null, | ||
<% end %> | ||
} | ||
}); | ||
|
||
/* track changes in student autocomplete field */ | ||
$studentAutocompleteField.on('change', function() { | ||
// urlsafe_encode64 uses '-' instead of '+' and '_' instead of '/' | ||
// so we have to replace the corresponding characters | ||
encoded = window.btoa($studentAutocompleteField.val()) | ||
encoded = encoded.replace("+", "-") | ||
encoded = encoded.replace("/", "_") | ||
$hiddenCUDField.val(userData[encoded]); | ||
}) | ||
}); | ||
</script> |
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.