From d0ecbbb4cf3b266f110bb46108c18a25ab1e1628 Mon Sep 17 00:00:00 2001 From: Vik Paruchuri Date: Wed, 10 Apr 2013 15:10:48 -0400 Subject: [PATCH] Fix hotkeys in peer and staff grading to use ctrl prefix --- .../js/src/peergrading/peer_grading_problem.coffee | 10 ++++++++-- .../coffee/src/staff_grading/staff_grading.coffee | 12 ++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/common/lib/xmodule/xmodule/js/src/peergrading/peer_grading_problem.coffee b/common/lib/xmodule/xmodule/js/src/peergrading/peer_grading_problem.coffee index f57227223c..b48ac9a919 100644 --- a/common/lib/xmodule/xmodule/js/src/peergrading/peer_grading_problem.coffee +++ b/common/lib/xmodule/xmodule/js/src/peergrading/peer_grading_problem.coffee @@ -161,6 +161,7 @@ class @PeerGradingProblem constructor: (backend) -> @prompt_wrapper = $('.prompt-wrapper') @backend = backend + @is_ctrl = false # get the location of the problem @@ -212,6 +213,7 @@ class @PeerGradingProblem @answer_unknown_checkbox = $('.answer-unknown-checkbox') $(window).keydown @keydown_handler + $(window).keyup @keyup_handler @collapse_question() @@ -338,13 +340,17 @@ class @PeerGradingProblem @grade = Rubric.get_total_score() keydown_handler: (event) => - if event.which == 13 && @submit_button.is(':visible') + if event.which == 17 && @is_ctrl==false + @is_ctrl=true + else if event.which == 13 && @submit_button.is(':visible') && @is_ctrl==true if @calibration @submit_calibration_essay() else @submit_grade() - + keyup_handler: (event) => + if event.which == 17 && @is_ctrl==true + @is_ctrl=false ########## diff --git a/lms/static/coffee/src/staff_grading/staff_grading.coffee b/lms/static/coffee/src/staff_grading/staff_grading.coffee index 6af9ecf5d1..ca200570de 100644 --- a/lms/static/coffee/src/staff_grading/staff_grading.coffee +++ b/lms/static/coffee/src/staff_grading/staff_grading.coffee @@ -185,6 +185,7 @@ class @StaffGrading $(window).keydown @keydown_handler + $(window).keyup @keyup_handler @question_header = $('.question-header') @question_header.click @collapse_question @collapse_question() @@ -206,6 +207,7 @@ class @StaffGrading @num_pending = 0 @score_lst = [] @grade = null + @is_ctrl = false @problems = null @@ -231,10 +233,16 @@ class @StaffGrading @state = state_graded @submit_button.show() - keydown_handler: (e) => - if e.which == 13 && !@list_view && Rubric.check_complete() + keydown_handler: (event) => + if event.which == 17 && @is_ctrl==false + @is_ctrl=true + else if @is_ctrl==true && event.which == 13 && !@list_view && Rubric.check_complete() @submit_and_get_next() + keyup_handler: (event) => + if event.which == 17 && @is_ctrl==true + @is_ctrl=false + set_button_text: (text) => @action_button.attr('value', text)