From d183a79493409a23ae32aa6d0f210dd41ae50029 Mon Sep 17 00:00:00 2001 From: nilsding Date: Sat, 3 Jan 2015 19:43:51 +0100 Subject: [PATCH] fixed sweetalert for use with Turbolinks, changed wording --- .../javascripts/answerbox/comment/destroy.coffee | 7 +++---- .../javascripts/answerbox/comment/report.coffee | 6 +++--- app/assets/javascripts/answerbox/destroy.coffee | 6 +++--- app/assets/javascripts/answerbox/report.coffee | 6 +++--- app/assets/javascripts/application.js.erb.coffee | 6 ++++++ app/assets/javascripts/inbox.coffee | 12 ++++++------ app/assets/javascripts/moderation/comment.coffee | 6 +++--- app/assets/javascripts/moderation/destroy.coffee | 6 +++--- app/assets/stylesheets/application.css.scss | 3 +-- 9 files changed, 31 insertions(+), 27 deletions(-) diff --git a/app/assets/javascripts/answerbox/comment/destroy.coffee b/app/assets/javascripts/answerbox/comment/destroy.coffee index ac89bef3..02cdbea8 100644 --- a/app/assets/javascripts/answerbox/comment/destroy.coffee +++ b/app/assets/javascripts/answerbox/comment/destroy.coffee @@ -1,15 +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!" + title: "Really delete?" + text: "You will not be able to recover this comment." type: "warning" showCancelButton: true confirmButtonColor: "#DD6B55" - confirmButtonText: "Yes, delete it!" + confirmButtonText: "Delete" closeOnConfirm: false , -> - if confirm 'Are you sure?' btn = $(this) cid = btn[0].dataset.cId $.ajax diff --git a/app/assets/javascripts/answerbox/comment/report.coffee b/app/assets/javascripts/answerbox/comment/report.coffee index e21e7071..6aa245d4 100644 --- a/app/assets/javascripts/answerbox/comment/report.coffee +++ b/app/assets/javascripts/answerbox/comment/report.coffee @@ -1,12 +1,12 @@ $(document).on "click", "a[data-action=ab-comment-report]", (ev) -> ev.preventDefault() swal - title: "Report?" - text: "A moderator will check this and decide what happens!" + title: "Really report?" + text: "A moderator will review this comment and decide what happens." type: "warning" showCancelButton: true confirmButtonColor: "#DD6B55" - confirmButtonText: "Report!" + confirmButtonText: "Report" closeOnConfirm: false , -> btn = $(this) diff --git a/app/assets/javascripts/answerbox/destroy.coffee b/app/assets/javascripts/answerbox/destroy.coffee index afe379d2..ac3ad680 100644 --- a/app/assets/javascripts/answerbox/destroy.coffee +++ b/app/assets/javascripts/answerbox/destroy.coffee @@ -1,12 +1,12 @@ $(document).on "click", "a[data-action=ab-destroy]", (ev) -> ev.preventDefault() swal - title: "Are you sure?" - text: "If you delete this answer it will be moved back to your inbox!" + title: "Really delete?" + text: "The question will be moved back to your inbox." type: "warning" showCancelButton: true confirmButtonColor: "#DD6B55" - confirmButtonText: "Yes, delete it!" + confirmButtonText: "Delete" closeOnConfirm: false , -> btn = $(this) diff --git a/app/assets/javascripts/answerbox/report.coffee b/app/assets/javascripts/answerbox/report.coffee index 804aa1bd..6fd0fa6a 100644 --- a/app/assets/javascripts/answerbox/report.coffee +++ b/app/assets/javascripts/answerbox/report.coffee @@ -1,12 +1,12 @@ $(document).on "click", "a[data-action=ab-report]", (ev) -> ev.preventDefault() swal - title: "Report?" - text: "A moderator will check this and decide what happens!" + title: "Really report?" + text: "A moderator will review this comment and decide what happens." type: "warning" showCancelButton: true confirmButtonColor: "#DD6B55" - confirmButtonText: "Report!" + confirmButtonText: "Report" closeOnConfirm: false , -> btn = $(this) diff --git a/app/assets/javascripts/application.js.erb.coffee b/app/assets/javascripts/application.js.erb.coffee index 0b74905a..8a479028 100644 --- a/app/assets/javascripts/application.js.erb.coffee +++ b/app/assets/javascripts/application.js.erb.coffee @@ -25,3 +25,9 @@ window.showNotification = (text, success=true) -> $(document).on "click", "button#create-account", -> Turbolinks.visit "/sign_up" + +_ready = -> + sweetAlertInitialize() + +$(document).ready _ready +$(document).on 'page:load', _ready \ No newline at end of file diff --git a/app/assets/javascripts/inbox.coffee b/app/assets/javascripts/inbox.coffee index 9347891e..0e26742c 100644 --- a/app/assets/javascripts/inbox.coffee +++ b/app/assets/javascripts/inbox.coffee @@ -23,12 +23,12 @@ btn = ($ this) count = btn[0].dataset.ibCount swal - title: "Really delete #{count} questions??" - text: "You will not be able to recover them!" + title: "Really delete #{count} questions?" + text: "They will be gone forever." type: "warning" showCancelButton: true confirmButtonColor: "#DD6B55" - confirmButtonText: "Yes, delete all!" + confirmButtonText: "Delete" closeOnConfirm: false , -> btn.button "loading" @@ -93,12 +93,12 @@ $(document).on "click", "button[name=ib-answer]", -> $(document).on "click", "button[name=ib-destroy]", -> swal - title: "Are you sure?" - text: "You will not be able to recover this question!" + title: "Really delete?" + text: "This question will be gone forever." type: "warning" showCancelButton: true confirmButtonColor: "#DD6B55" - confirmButtonText: "Yes, delete it!" + confirmButtonText: "Delete" closeOnConfirm: false , -> btn = $(this) diff --git a/app/assets/javascripts/moderation/comment.coffee b/app/assets/javascripts/moderation/comment.coffee index dd8647b8..23134c18 100644 --- a/app/assets/javascripts/moderation/comment.coffee +++ b/app/assets/javascripts/moderation/comment.coffee @@ -69,12 +69,12 @@ $(document).on "input", "input[name=mod-comment-new]", (evt) -> $(document).on "click", "a[data-action=mod-comment-destroy]", (ev) -> ev.preventDefault() swal - title: "Are you sure?" - text: "You will not be able to recover this comment!" + title: "Really delete?" + text: "You will not be able to recover this comment." type: "warning" showCancelButton: true confirmButtonColor: "#DD6B55" - confirmButtonText: "Yes, delete it!" + confirmButtonText: "Delete" closeOnConfirm: false , -> btn = $(this) diff --git a/app/assets/javascripts/moderation/destroy.coffee b/app/assets/javascripts/moderation/destroy.coffee index 75feabc5..5eae4ef5 100644 --- a/app/assets/javascripts/moderation/destroy.coffee +++ b/app/assets/javascripts/moderation/destroy.coffee @@ -1,11 +1,11 @@ $(document).on "click", "button[name=mod-delete-report]", -> swal - title: "Are you sure?" - text: "You will not be able to recover this!" + title: "Really delete?" + text: "You will not be able to recover this report." type: "warning" showCancelButton: true confirmButtonColor: "#DD6B55" - confirmButtonText: "Yes, delete it!" + confirmButtonText: "Delete" closeOnConfirm: false , -> btn = $(this) diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index ef3390d7..e43fa907 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -2,9 +2,8 @@ *= require rails_bootstrap_forms *= require growl *= require jquery.guillotine - *= require_self *= require sweet-alert - *= require_tree . + *= require_self */ @import url(https://fonts.googleapis.com/css?family=Exo+2:400,700);