mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-03-16 04:09:59 +01:00
generating questions is great
This commit is contained in:
parent
912ccea445
commit
a4edb4147d
2 changed files with 20 additions and 2 deletions
|
@ -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) ->
|
$(document).on "keydown", "textarea[name=ib-answer]", (evt) ->
|
||||||
iid = $(this)[0].dataset.id
|
iid = $(this)[0].dataset.id
|
||||||
if evt.keyCode == 13 and evt.ctrlKey
|
if evt.keyCode == 13 and evt.ctrlKey
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
.container.j2-page
|
.container.j2-page
|
||||||
= render 'layouts/messages'
|
= render 'layouts/messages'
|
||||||
|
%button.btn.btn-default{type: :button, id: 'ib-generate-question'} Get new question
|
||||||
|
|
||||||
#entries
|
#entries
|
||||||
- @inbox.each do |i|
|
- @inbox.each do |i|
|
||||||
= render 'inbox/entry', i: i
|
= render 'inbox/entry', i: i
|
||||||
|
|
||||||
- if @inbox.empty?
|
- if @inbox.empty?
|
||||||
|
|
||||||
Nothing to see here.
|
Nothing to see here.
|
||||||
|
|
||||||
= render "shared/links"
|
= render "shared/links"
|
||||||
- @inbox.update_all(new: false)
|
- @inbox.update_all(new: false)
|
Loading…
Reference in a new issue