make it so if you hit enter in jqUI dialog it submits form
fixes: #10247 test plan: hit Start A New Course on dashboard Name the course and hit enter should do the same as hitting the submit button Change-Id: I76a45edb723ddc33d1bd0708551e35744b1db0b7 Reviewed-on: https://gerrit.instructure.com/13650 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Ryan Florence <ryanf@instructure.com>
This commit is contained in:
parent
69a9090057
commit
57e366161d
|
@ -18,6 +18,11 @@ define [
|
|||
if $button.is('.dialog_closer')
|
||||
$button.click preventDefault -> $dialog.dialog('close')
|
||||
|
||||
# make it so if you hit enter in the dialog, you submit the form
|
||||
if $button.prop('type') is 'submit' && $button[0].form
|
||||
$dialog.keypress (e) ->
|
||||
$($button[0].form).submit() if e.keyCode is $.ui.keyCode.ENTER
|
||||
|
||||
return {
|
||||
text: $button.text()
|
||||
"data-text-while-loading": $button.data("textWhileLoading")
|
||||
|
|
|
@ -44,8 +44,11 @@
|
|||
<input type="hidden" name="enroll_me" value="true">
|
||||
|
||||
<div class="button-container">
|
||||
<button type="button" class="button dialog_closer"><%= t 'cancel', "Cancel" %></button>
|
||||
<button class="button btn-primary" type="submit"><%= t 'create_course', 'Create course' %></button>
|
||||
|
||||
<button type="button"
|
||||
data-text-while-loading="<%= t 'cancel', "Cancel" %>"
|
||||
class="button dialog_closer"><%= t 'cancel', "Cancel" %></button>
|
||||
<button class="button btn-primary"
|
||||
data-text-while-loading="<%= t 'creating_course', 'Creating course...' %>"
|
||||
type="submit"><%= t 'create_course', 'Create course' %></button>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in New Issue