Template.submit.helpers({
  prompts: function() {
    return Prompts.inOrder();
  },
  alreadySubmitted: function() {
    return Session.get('submitted');
  }
});

Template.submit.events({

  'submit form': function(e) {
    e.preventDefault();

    var responses = Prompts.allPromptIds().map(function(id) {
      return {
        promptId: id,
        response: $('#' + id).val()
      }
    });

    Submissions.insert({responses: responses});
    $('.response-input').val('');
    Session.set('submitted', true)
    Router.go('/thanks')
  },

  'keypress .input-field': function(e) {
    var isEnterKey = e.keyCode == 13;
    var focusIsNotOnSubmitButton = e.target.type != 'submit';

    if(isEnterKey && focusIsNotOnSubmitButton) {
      e.preventDefault();
      var input = e.target;
      var inputs = $(input).closest('form').find(':input');
      inputs.eq( inputs.index(input)+ 1 ).focus();
    }
  }
});

Template.submit.onRendered(function() {
  $('modal-trigger').leanModal();
});


@@ -592,98 +592,68 @@
 var 
-isEnterKey = e.keyCode == 13;%0A    var focusIsNotOnSubmitButton = e.target.type != 'submit'
+activeInput = e.target;%0A    var isEnterKey = e.keyCode == 13
 ;%0A%0A 
@@ -672,39 +672,12 @@
 rKey
- && focusIsNotOnSubmitButton
 ) %7B
+ 
 %0A   
@@ -718,43 +718,21 @@
 nput
- = e.target;%0A      var inputs = $(i
+s = $(activeI
 nput
@@ -795,17 +795,23 @@
 s.index(
-i
+activeI
 nput)+ 1
@@ -828,24 +828,175 @@
 ;%0A    %7D%0A  %7D%0A
+  // TODO: Consider posting when user hits Enter on final form element%0A  // TODO: Submit button should have same focus/blur behavior as hover/no-hover%0A
 %7D);%0A%0ATemplat

refactor for clarity