added disable attribute if there are no questions in the inbox
This commit is contained in:
parent
1ba34c59d0
commit
7a18790241
|
@ -19,22 +19,25 @@
|
|||
if confirm 'Are you sure?'
|
||||
btn = ($ this)
|
||||
btn.button "loading"
|
||||
succ = no
|
||||
$.ajax
|
||||
url: '/ajax/delete_all_inbox'
|
||||
type: 'POST'
|
||||
dataType: 'json'
|
||||
success: (data, status, jqxhr) ->
|
||||
if data.success
|
||||
succ = yes
|
||||
entries = ($ "div#entries")
|
||||
entries.slideUp 400, ->
|
||||
entries.html("Nothing to see here.")
|
||||
entries.fadeIn()
|
||||
btn.attr("disabled", "disabled")
|
||||
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"
|
||||
if succ
|
||||
btn.attr "disabled", "disabled" # this doesn't really work like I wanted it to…
|
||||
|
||||
|
||||
$(document).on "keydown", "textarea[name=ib-answer]", (evt) ->
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
.panel-heading
|
||||
%h3 Actions
|
||||
.panel-body
|
||||
%button.btn.btn-block.btn-danger{type: :button, id: 'ib-delete-all'} Delete all questions
|
||||
%button.btn.btn-block.btn-danger{type: :button, id: 'ib-delete-all', disabled: (@inbox.empty? ? 'disabled' : nil)} Delete all questions
|
||||
.col-md-9.col-xs-12.col-sm-9
|
||||
= render 'layouts/messages'
|
||||
#entries
|
||||
|
|
Loading…
Reference in New Issue