replaced alerts with sweetAlert

This commit is contained in:
Andreas N 2015-01-03 17:36:55 +01:00
parent ac9738d058
commit 9d3b8cced4
8 changed files with 75 additions and 7 deletions

View File

@ -298,6 +298,8 @@ GEM
colorize (>= 0.7.0)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
sweetalert-rails (0.3.3)
railties (>= 3.1.0)
thin (1.6.3)
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0)
@ -387,6 +389,7 @@ DEPENDENCIES
simplecov
sinatra
spring
sweetalert-rails
thin
turbolinks
twitter

View File

@ -1,5 +1,14 @@
$(document).on "click", "a[data-action=ab-comment-destroy]", (ev) ->
ev.preventDefault()
swal
title: "Are you sure?"
text: "You will not be able to recover this!"
type: "warning"
showCancelButton: true
confirmButtonColor: "#DD6B55"
confirmButtonText: "Yes, delete it!"
closeOnConfirm: false
, ->
if confirm 'Are you sure?'
btn = $(this)
cid = btn[0].dataset.cId

View File

@ -1,6 +1,14 @@
$(document).on "click", "a[data-action=ab-comment-report]", (ev) ->
ev.preventDefault()
if confirm 'Are you sure you want to report this comment?'
swal
title: "Report?"
text: "A moderator will check this and decide what happens!"
type: "warning"
showCancelButton: true
confirmButtonColor: "#DD6B55"
confirmButtonText: "Report!"
closeOnConfirm: false
, ->
btn = $(this)
cid = btn[0].dataset.cId
$.ajax

View File

@ -1,6 +1,14 @@
$(document).on "click", "a[data-action=ab-destroy]", (ev) ->
ev.preventDefault()
if confirm 'Are you sure?'
swal
title: "Are you sure?"
text: "You will not be able to recover this!"
type: "warning"
showCancelButton: true
confirmButtonColor: "#DD6B55"
confirmButtonText: "Yes, delete it!"
closeOnConfirm: false
, ->
btn = $(this)
aid = btn[0].dataset.aId
$.ajax

View File

@ -1,6 +1,14 @@
$(document).on "click", "a[data-action=ab-report]", (ev) ->
ev.preventDefault()
if confirm 'Are you sure you want to report this answer?'
swal
title: "Report?"
text: "A moderator will check this and decide what happens!"
type: "warning"
showCancelButton: true
confirmButtonColor: "#DD6B55"
confirmButtonText: "Report!"
closeOnConfirm: false
, ->
btn = $(this)
aid = btn[0].dataset.aId
$.ajax

View File

@ -22,7 +22,15 @@
($ document).on "click", "button#ib-delete-all", ->
btn = ($ this)
count = btn[0].dataset.ibCount
if confirm "Really delete #{count} questions?"
swal
title: "Really delete #{count} questions??"
text: "You will not be able to recover them!"
type: "warning"
showCancelButton: true
confirmButtonColor: "#DD6B55"
confirmButtonText: "Yes, delete all!"
closeOnConfirm: false
, ->
btn.button "loading"
succ = no
$.ajax
@ -84,7 +92,15 @@ $(document).on "click", "button[name=ib-answer]", ->
$(document).on "click", "button[name=ib-destroy]", ->
if confirm 'Are you sure?'
swal
title: "Are you sure?"
text: "You will not be able to recover this question!"
type: "warning"
showCancelButton: true
confirmButtonColor: "#DD6B55"
confirmButtonText: "Yes, delete it!"
closeOnConfirm: false
, ->
btn = $(this)
btn.button "loading"
iid = btn[0].dataset.ibId

View File

@ -68,7 +68,15 @@ $(document).on "input", "input[name=mod-comment-new]", (evt) ->
# destroy
$(document).on "click", "a[data-action=mod-comment-destroy]", (ev) ->
ev.preventDefault()
if confirm 'Are you sure?'
swal
title: "Are you sure?"
text: "You will not be able to recover this comment!"
type: "warning"
showCancelButton: true
confirmButtonColor: "#DD6B55"
confirmButtonText: "Yes, delete it!"
closeOnConfirm: false
, ->
btn = $(this)
cid = btn[0].dataset.id
$.ajax

View File

@ -1,5 +1,13 @@
$(document).on "click", "button[name=mod-delete-report]", ->
if confirm 'Are you sure?'
swal
title: "Are you sure?"
text: "You will not be able to recover this!"
type: "warning"
showCancelButton: true
confirmButtonColor: "#DD6B55"
confirmButtonText: "Yes, delete it!"
closeOnConfirm: false
, ->
btn = $(this)
id = btn[0].dataset.id
$.ajax