generating questions is great
This commit is contained in:
parent
912ccea445
commit
a4edb4147d
|
@ -1,3 +1,19 @@
|
|||
($ document).on "click", "button#ib-generate-question", ->
|
||||
btn = ($ this)
|
||||
btn.button "loading"
|
||||
$.ajax
|
||||
url: '/ajax/generate_question'
|
||||
type: 'POST'
|
||||
dataType: 'json'
|
||||
success: (data, status, jqxhr) ->
|
||||
if data.success
|
||||
($ "div#entries").prepend(data.render) # TODO: slideDown or something
|
||||
error: (jqxhr, status, error) ->
|
||||
console.log jqxhr, status, error
|
||||
showNotification "An error occurred, a developer should check the console for details", false
|
||||
complete: (jqxhr, status) ->
|
||||
btn.button "reset"
|
||||
|
||||
$(document).on "keydown", "textarea[name=ib-answer]", (evt) ->
|
||||
iid = $(this)[0].dataset.id
|
||||
if evt.keyCode == 13 and evt.ctrlKey
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
.container.j2-page
|
||||
= render 'layouts/messages'
|
||||
%button.btn.btn-default{type: :button, id: 'ib-generate-question'} Get new question
|
||||
|
||||
#entries
|
||||
- @inbox.each do |i|
|
||||
= render 'inbox/entry', i: i
|
||||
|
|
Loading…
Reference in New Issue