Skip to content
This repository has been archived by the owner on Nov 8, 2017. It is now read-only.

Commit

Permalink
set focus on new page and allow submit with enter
Browse files Browse the repository at this point in the history
  • Loading branch information
richorama committed Feb 2, 2017
1 parent dfa6caf commit 024ed92
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion index.html
Expand Up @@ -201,6 +201,18 @@
app_router.new(val);
});

$("#newPageForm").submit(function(e){
e.preventDefault();
var val = $("#newPageName").val();
if (!val){
return;
}
$("#newPageModal").modal("hide");
$("#newPageName").val("");
app_router.new(val);
return false;
});


});

Expand Down Expand Up @@ -259,6 +271,7 @@

function newPage(){
$("#newPageModal").modal('show')
$("#newPageName").focus();
}

function switchPanel(panel){
Expand Down Expand Up @@ -682,6 +695,7 @@ <h2>{{page}} version history</h2>
</script>

<div class="modal fade" id="newPageModal">
<form id="newPageForm">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
Expand All @@ -696,10 +710,11 @@ <h4 class="modal-title">Please enter a name for the page</h4>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-default" id="newPageModalOK">OK</button>
<input type="button" class="btn btn-default" id="newPageModalOK" value="OK"/>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</form>
</div><!-- /.modal -->

<script id="nopermission-template" type="text/x-handlebars-template">
Expand Down

0 comments on commit 024ed92

Please sign in to comment.