Work on adding in a new ajax post type
This commit is contained in:
@@ -748,7 +748,7 @@ class OpenEndedInput(InputTypeBase):
|
||||
# pulled out for testing
|
||||
submitted_msg = ("Feedback not yet available. Reload to check again. "
|
||||
"Once the problem is graded, this message will be "
|
||||
"replaced with the grader's feedback")
|
||||
"replaced with the grader's feedback.")
|
||||
|
||||
@classmethod
|
||||
def get_attributes(cls):
|
||||
|
||||
@@ -1836,6 +1836,7 @@ class OpenEndedResponse(LoncapaResponse):
|
||||
"""
|
||||
|
||||
DEFAULT_QUEUE = 'open-ended'
|
||||
DEFAULT_MESSAGE_QUEUE = 'open-ended-message'
|
||||
response_tag = 'openendedresponse'
|
||||
allowed_inputfields = ['openendedinput']
|
||||
max_inputfields = 1
|
||||
|
||||
@@ -28,5 +28,12 @@
|
||||
% endif
|
||||
<div class="external-grader-message">
|
||||
${msg|n}
|
||||
% if status in ['correct','incorrect']:
|
||||
<section id="evaluation">
|
||||
Score Evaluation:
|
||||
<textarea rows="${rows}" cols="${cols}" name="feedback-on-feedback" class="feedback-on-feedback">Please enter some comments about the score/feedback you received here.</textarea>
|
||||
<input name="submit-message" class="submit-message" type="button" value="Submit your message"/>
|
||||
</section>
|
||||
% endif
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -380,6 +380,7 @@ class CapaModule(XModule):
|
||||
'problem_save': self.save_problem,
|
||||
'problem_show': self.get_answer,
|
||||
'score_update': self.update_score,
|
||||
'message_post' : self.message_post,
|
||||
}
|
||||
|
||||
if dispatch not in handlers:
|
||||
@@ -394,6 +395,19 @@ class CapaModule(XModule):
|
||||
})
|
||||
return json.dumps(d, cls=ComplexEncoder)
|
||||
|
||||
def feedback_post(self, get):
|
||||
"""
|
||||
Posts a message from a form to an appropriate location
|
||||
"""
|
||||
event_info = dict()
|
||||
event_info['state'] = self.lcp.get_state()
|
||||
event_info['problem_id'] = self.location.url()
|
||||
|
||||
answers = self.make_dict_of_responses(get)
|
||||
log.debug(answers)
|
||||
|
||||
|
||||
|
||||
def closed(self):
|
||||
''' Is the student still allowed to submit answers? '''
|
||||
if self.attempts == self.max_attempts:
|
||||
|
||||
@@ -25,6 +25,7 @@ class @Problem
|
||||
@$('section.action input.reset').click @reset
|
||||
@$('section.action input.show').click @show
|
||||
@$('section.action input.save').click @save
|
||||
@$('section.evaluation input.submit-message').click @message_post
|
||||
|
||||
# Collapsibles
|
||||
Collapsible.setCollapsibles(@el)
|
||||
@@ -197,6 +198,11 @@ class @Problem
|
||||
else
|
||||
@gentle_alert response.success
|
||||
|
||||
message_post: =>
|
||||
Logger.log 'message_post', @answers
|
||||
$.postWithPrefix "#{@url}/message_post", @answers, (response) =>
|
||||
@gentle_alert response.success
|
||||
|
||||
reset: =>
|
||||
Logger.log 'problem_reset', @answers
|
||||
$.postWithPrefix "#{@url}/problem_reset", id: @id, (response) =>
|
||||
|
||||
Reference in New Issue
Block a user