fixed sweetalert for use with Turbolinks, changed wording

This commit is contained in:
nilsding 2015-01-03 19:43:51 +01:00
parent f5a469bafa
commit d183a79493
9 changed files with 31 additions and 27 deletions

View file

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

View file

@ -1,12 +1,12 @@
$(document).on "click", "a[data-action=ab-comment-report]", (ev) -> $(document).on "click", "a[data-action=ab-comment-report]", (ev) ->
ev.preventDefault() ev.preventDefault()
swal swal
title: "Report?" title: "Really report?"
text: "A moderator will check this and decide what happens!" text: "A moderator will review this comment and decide what happens."
type: "warning" type: "warning"
showCancelButton: true showCancelButton: true
confirmButtonColor: "#DD6B55" confirmButtonColor: "#DD6B55"
confirmButtonText: "Report!" confirmButtonText: "Report"
closeOnConfirm: false closeOnConfirm: false
, -> , ->
btn = $(this) btn = $(this)

View file

@ -1,12 +1,12 @@
$(document).on "click", "a[data-action=ab-destroy]", (ev) -> $(document).on "click", "a[data-action=ab-destroy]", (ev) ->
ev.preventDefault() ev.preventDefault()
swal swal
title: "Are you sure?" title: "Really delete?"
text: "If you delete this answer it will be moved back to your inbox!" text: "The question will be moved back to your inbox."
type: "warning" type: "warning"
showCancelButton: true showCancelButton: true
confirmButtonColor: "#DD6B55" confirmButtonColor: "#DD6B55"
confirmButtonText: "Yes, delete it!" confirmButtonText: "Delete"
closeOnConfirm: false closeOnConfirm: false
, -> , ->
btn = $(this) btn = $(this)

View file

@ -1,12 +1,12 @@
$(document).on "click", "a[data-action=ab-report]", (ev) -> $(document).on "click", "a[data-action=ab-report]", (ev) ->
ev.preventDefault() ev.preventDefault()
swal swal
title: "Report?" title: "Really report?"
text: "A moderator will check this and decide what happens!" text: "A moderator will review this comment and decide what happens."
type: "warning" type: "warning"
showCancelButton: true showCancelButton: true
confirmButtonColor: "#DD6B55" confirmButtonColor: "#DD6B55"
confirmButtonText: "Report!" confirmButtonText: "Report"
closeOnConfirm: false closeOnConfirm: false
, -> , ->
btn = $(this) btn = $(this)

View file

@ -25,3 +25,9 @@ window.showNotification = (text, success=true) ->
$(document).on "click", "button#create-account", -> $(document).on "click", "button#create-account", ->
Turbolinks.visit "/sign_up" Turbolinks.visit "/sign_up"
_ready = ->
sweetAlertInitialize()
$(document).ready _ready
$(document).on 'page:load', _ready

View file

@ -23,12 +23,12 @@
btn = ($ this) btn = ($ this)
count = btn[0].dataset.ibCount count = btn[0].dataset.ibCount
swal swal
title: "Really delete #{count} questions??" title: "Really delete #{count} questions?"
text: "You will not be able to recover them!" text: "They will be gone forever."
type: "warning" type: "warning"
showCancelButton: true showCancelButton: true
confirmButtonColor: "#DD6B55" confirmButtonColor: "#DD6B55"
confirmButtonText: "Yes, delete all!" confirmButtonText: "Delete"
closeOnConfirm: false closeOnConfirm: false
, -> , ->
btn.button "loading" btn.button "loading"
@ -93,12 +93,12 @@ $(document).on "click", "button[name=ib-answer]", ->
$(document).on "click", "button[name=ib-destroy]", -> $(document).on "click", "button[name=ib-destroy]", ->
swal swal
title: "Are you sure?" title: "Really delete?"
text: "You will not be able to recover this question!" text: "This question will be gone forever."
type: "warning" type: "warning"
showCancelButton: true showCancelButton: true
confirmButtonColor: "#DD6B55" confirmButtonColor: "#DD6B55"
confirmButtonText: "Yes, delete it!" confirmButtonText: "Delete"
closeOnConfirm: false closeOnConfirm: false
, -> , ->
btn = $(this) btn = $(this)

View file

@ -69,12 +69,12 @@ $(document).on "input", "input[name=mod-comment-new]", (evt) ->
$(document).on "click", "a[data-action=mod-comment-destroy]", (ev) -> $(document).on "click", "a[data-action=mod-comment-destroy]", (ev) ->
ev.preventDefault() ev.preventDefault()
swal swal
title: "Are you sure?" title: "Really delete?"
text: "You will not be able to recover this comment!" text: "You will not be able to recover this comment."
type: "warning" type: "warning"
showCancelButton: true showCancelButton: true
confirmButtonColor: "#DD6B55" confirmButtonColor: "#DD6B55"
confirmButtonText: "Yes, delete it!" confirmButtonText: "Delete"
closeOnConfirm: false closeOnConfirm: false
, -> , ->
btn = $(this) btn = $(this)

View file

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

View file

@ -2,9 +2,8 @@
*= require rails_bootstrap_forms *= require rails_bootstrap_forms
*= require growl *= require growl
*= require jquery.guillotine *= require jquery.guillotine
*= require_self
*= require sweet-alert *= require sweet-alert
*= require_tree . *= require_self
*/ */
@import url(https://fonts.googleapis.com/css?family=Exo+2:400,700); @import url(https://fonts.googleapis.com/css?family=Exo+2:400,700);