From 883bedcbf1ad141d48030e0d7f47ac44a725821a Mon Sep 17 00:00:00 2001 From: nilsding Date: Wed, 10 Dec 2014 20:54:12 +0100 Subject: [PATCH] C- for asking questions --- app/assets/javascripts/questionbox/all.coffee | 9 +++++---- app/assets/javascripts/questionbox/user.coffee | 12 ++++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/questionbox/all.coffee b/app/assets/javascripts/questionbox/all.coffee index 31d51ee0..9178123b 100644 --- a/app/assets/javascripts/questionbox/all.coffee +++ b/app/assets/javascripts/questionbox/all.coffee @@ -22,7 +22,8 @@ $(document).on "click", "button[name=qb-all-ask]", -> btn.button "reset" $("textarea[name=qb-all-question]").removeAttr "readonly" -# for that promotional thing -$(document).on "click", "button#new-question", -> - $("div#question-box").show() - $("div#question-box-promote").hide() + +# see GitHub issue #2 +($ document).on "keydown", "textarea[name=qb-all-question]", (evt) -> + if evt.keyCode == 13 and evt.ctrlKey + ($ "button[name=qb-all-ask]").trigger 'click' \ No newline at end of file diff --git a/app/assets/javascripts/questionbox/user.coffee b/app/assets/javascripts/questionbox/user.coffee index 77c8b113..32577b9d 100644 --- a/app/assets/javascripts/questionbox/user.coffee +++ b/app/assets/javascripts/questionbox/user.coffee @@ -27,3 +27,15 @@ $(document).on "click", "button[name=qb-ask]", -> complete: (jqxhr, status) -> btn.button "reset" $("textarea[name=qb-question]").removeAttr "readonly" + + +# for that promotional thing +$(document).on "click", "button#new-question", -> + $("div#question-box").show() + $("div#question-box-promote").hide() + + +# see GitHub issue #2 +($ document).on "keydown", "textarea[name=qb-question]", (evt) -> + if evt.keyCode == 13 and evt.ctrlKey + ($ "button[name=qb-ask]").trigger 'click' \ No newline at end of file