Merge branch 'sweetalert'
This commit is contained in:
commit
f1c0bc5a4c
1
Gemfile
1
Gemfile
|
@ -20,6 +20,7 @@ gem 'bcrypt', '~> 3.1.7'
|
|||
gem 'haml'
|
||||
gem 'bootstrap-sass', '~> 3.2.0.1'
|
||||
gem 'bootswatch-rails'
|
||||
gem 'sweetalert-rails'
|
||||
gem 'will_paginate'
|
||||
gem 'will_paginate-bootstrap'
|
||||
gem 'http_accept_language'
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
$(document).on "click", "a[data-action=ab-comment-destroy]", (ev) ->
|
||||
ev.preventDefault()
|
||||
if confirm 'Are you sure?'
|
||||
btn = $(this)
|
||||
cid = btn[0].dataset.cId
|
||||
btn = $(this)
|
||||
cid = btn[0].dataset.cId
|
||||
swal
|
||||
title: "Really delete?"
|
||||
text: "You will not be able to recover this comment."
|
||||
type: "warning"
|
||||
showCancelButton: true
|
||||
confirmButtonColor: "#DD6B55"
|
||||
confirmButtonText: "Delete"
|
||||
closeOnConfirm: true
|
||||
, ->
|
||||
$.ajax
|
||||
url: '/ajax/destroy_comment'
|
||||
type: 'POST'
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
$(document).on "click", "a[data-action=ab-comment-report]", (ev) ->
|
||||
ev.preventDefault()
|
||||
if confirm 'Are you sure you want to report this comment?'
|
||||
btn = $(this)
|
||||
cid = btn[0].dataset.cId
|
||||
btn = $(this)
|
||||
cid = btn[0].dataset.cId
|
||||
swal
|
||||
title: "Really report?"
|
||||
text: "A moderator will review this comment and decide what happens."
|
||||
type: "warning"
|
||||
showCancelButton: true
|
||||
confirmButtonColor: "#DD6B55"
|
||||
confirmButtonText: "Report"
|
||||
closeOnConfirm: true
|
||||
, ->
|
||||
$.ajax
|
||||
url: '/ajax/report'
|
||||
type: 'POST'
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
$(document).on "click", "a[data-action=ab-destroy]", (ev) ->
|
||||
ev.preventDefault()
|
||||
if confirm 'Are you sure?'
|
||||
btn = $(this)
|
||||
aid = btn[0].dataset.aId
|
||||
btn = $(this)
|
||||
aid = btn[0].dataset.aId
|
||||
swal
|
||||
title: "Really delete?"
|
||||
text: "The question will be moved back to your inbox."
|
||||
type: "warning"
|
||||
showCancelButton: true
|
||||
confirmButtonColor: "#DD6B55"
|
||||
confirmButtonText: "Delete"
|
||||
closeOnConfirm: true
|
||||
, ->
|
||||
$.ajax
|
||||
url: '/ajax/destroy_answer' # TODO: find a way to use rake routes instead of hardcoding them here
|
||||
type: 'POST'
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
$(document).on "click", "a[data-action=ab-report]", (ev) ->
|
||||
ev.preventDefault()
|
||||
if confirm 'Are you sure you want to report this answer?'
|
||||
btn = $(this)
|
||||
aid = btn[0].dataset.aId
|
||||
btn = $(this)
|
||||
aid = btn[0].dataset.aId
|
||||
swal
|
||||
title: "Really report?"
|
||||
text: "A moderator will review this answer and decide what happens."
|
||||
type: "warning"
|
||||
showCancelButton: true
|
||||
confirmButtonColor: "#DD6B55"
|
||||
confirmButtonText: "Report"
|
||||
closeOnConfirm: true
|
||||
, ->
|
||||
$.ajax
|
||||
url: '/ajax/report' # TODO: find a way to use rake routes instead of hardcoding them here
|
||||
type: 'POST'
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#= require growl
|
||||
#= require cheet
|
||||
#= require jquery.guillotine
|
||||
#= require sweet-alert
|
||||
#= require_tree .
|
||||
|
||||
NProgress.configure
|
||||
|
@ -24,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
|
|
@ -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: "They will be gone forever."
|
||||
type: "warning"
|
||||
showCancelButton: true
|
||||
confirmButtonColor: "#DD6B55"
|
||||
confirmButtonText: "Delete"
|
||||
closeOnConfirm: true
|
||||
, ->
|
||||
btn.button "loading"
|
||||
succ = no
|
||||
$.ajax
|
||||
|
@ -85,8 +93,16 @@ $(document).on "click", "button[name=ib-answer]", ->
|
|||
|
||||
|
||||
$(document).on "click", "button[name=ib-destroy]", ->
|
||||
if confirm 'Are you sure?'
|
||||
btn = $(this)
|
||||
btn = $(this)
|
||||
swal
|
||||
title: "Really delete?"
|
||||
text: "This question will be gone forever."
|
||||
type: "warning"
|
||||
showCancelButton: true
|
||||
confirmButtonColor: "#DD6B55"
|
||||
confirmButtonText: "Delete"
|
||||
closeOnConfirm: true
|
||||
, ->
|
||||
btn.button "loading"
|
||||
iid = btn[0].dataset.ibId
|
||||
$("textarea[name=ib-answer][data-id=#{iid}]").attr "readonly", "readonly"
|
||||
|
|
|
@ -68,9 +68,17 @@ $(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?'
|
||||
btn = $(this)
|
||||
cid = btn[0].dataset.id
|
||||
btn = $(this)
|
||||
cid = btn[0].dataset.id
|
||||
swal
|
||||
title: "Really delete?"
|
||||
text: "You will not be able to recover this comment."
|
||||
type: "warning"
|
||||
showCancelButton: true
|
||||
confirmButtonColor: "#DD6B55"
|
||||
confirmButtonText: "Delete"
|
||||
closeOnConfirm: true
|
||||
, ->
|
||||
$.ajax
|
||||
url: '/ajax/mod/destroy_comment'
|
||||
type: 'POST'
|
||||
|
|
|
@ -1,7 +1,15 @@
|
|||
$(document).on "click", "button[name=mod-delete-report]", ->
|
||||
if confirm 'Are you sure?'
|
||||
btn = $(this)
|
||||
id = btn[0].dataset.id
|
||||
btn = $(this)
|
||||
id = btn[0].dataset.id
|
||||
swal
|
||||
title: "Really delete?"
|
||||
text: "You will not be able to recover this report."
|
||||
type: "warning"
|
||||
showCancelButton: true
|
||||
confirmButtonColor: "#DD6B55"
|
||||
confirmButtonText: "Delete"
|
||||
closeOnConfirm: true
|
||||
, ->
|
||||
$.ajax
|
||||
url: '/ajax/mod/destroy_report'
|
||||
type: 'POST'
|
||||
|
|
|
@ -50,7 +50,16 @@ $(document).on "click", "a[data-action=report-user]", (ev) ->
|
|||
ev.preventDefault()
|
||||
btn = $(this)
|
||||
target = btn[0].dataset.target
|
||||
if confirm "Are you sure you want to report #{target}?"
|
||||
|
||||
swal
|
||||
title: "Really report #{target}?"
|
||||
text: "A moderator will review this user and decide what happens."
|
||||
type: "warning"
|
||||
showCancelButton: true
|
||||
confirmButtonColor: "#DD6B55"
|
||||
confirmButtonText: "Report"
|
||||
closeOnConfirm: true
|
||||
, ->
|
||||
$.ajax
|
||||
url: '/ajax/report'
|
||||
type: 'POST'
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
*= require rails_bootstrap_forms
|
||||
*= require growl
|
||||
*= require jquery.guillotine
|
||||
*= require sweet-alert
|
||||
*= require_self
|
||||
*/
|
||||
|
||||
|
|
|
@ -69,4 +69,8 @@ body {
|
|||
|
||||
.j2-up {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.sweet-overlay {
|
||||
z-index: 1031;
|
||||
}
|
Loading…
Reference in New Issue