added a count

This commit is contained in:
nilsding 2014-12-21 15:36:57 +01:00
parent aa9bd028db
commit 2169a86615
2 changed files with 5 additions and 3 deletions

View File

@ -16,8 +16,9 @@
($ document).on "click", "button#ib-delete-all", -> ($ document).on "click", "button#ib-delete-all", ->
if confirm 'Are you sure?' btn = ($ this)
btn = ($ this) count = btn[0].dataset.ibCount
if confirm "Really delete #{count} questions?"
btn.button "loading" btn.button "loading"
succ = no succ = no
$.ajax $.ajax
@ -38,6 +39,7 @@
btn.button "reset" btn.button "reset"
if succ if succ
btn.attr "disabled", "disabled" # this doesn't really work like I wanted it to… btn.attr "disabled", "disabled" # this doesn't really work like I wanted it to…
btn[0].dataset.ibCount = 0
$(document).on "keydown", "textarea[name=ib-answer]", (evt) -> $(document).on "keydown", "textarea[name=ib-answer]", (evt) ->

View File

@ -10,7 +10,7 @@
.panel-heading .panel-heading
%h3.panel-title Actions %h3.panel-title Actions
.panel-body .panel-body
%button.btn.btn-block.btn-danger{type: :button, id: 'ib-delete-all', disabled: (@inbox.empty? ? 'disabled' : nil)} Delete all questions %button.btn.btn-block.btn-danger{type: :button, id: 'ib-delete-all', disabled: (@inbox.empty? ? 'disabled' : nil), data: { ib_count: @inbox.count }} Delete all questions
.col-md-9.col-xs-12.col-sm-9 .col-md-9.col-xs-12.col-sm-9
= render 'layouts/messages' = render 'layouts/messages'
#entries #entries