added rails-assets-growl for notifications
This commit is contained in:
parent
6f03b75f00
commit
5b013314ed
2
Gemfile
2
Gemfile
|
@ -1,4 +1,5 @@
|
||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
source 'https://rails-assets.org'
|
||||||
|
|
||||||
gem 'rails', '4.1.7'
|
gem 'rails', '4.1.7'
|
||||||
|
|
||||||
|
@ -26,6 +27,7 @@ gem 'bootstrap_form'
|
||||||
gem 'font-kit-rails'
|
gem 'font-kit-rails'
|
||||||
gem 'nprogress-rails'
|
gem 'nprogress-rails'
|
||||||
gem 'font-awesome-rails', '~> 4.2.0.0'
|
gem 'font-awesome-rails', '~> 4.2.0.0'
|
||||||
|
gem 'rails-assets-growl'
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
gem 'spring'
|
gem 'spring'
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
|
remote: https://rails-assets.org/
|
||||||
specs:
|
specs:
|
||||||
actionmailer (4.1.7)
|
actionmailer (4.1.7)
|
||||||
actionpack (= 4.1.7)
|
actionpack (= 4.1.7)
|
||||||
|
@ -120,6 +121,9 @@ GEM
|
||||||
bundler (>= 1.3.0, < 2.0)
|
bundler (>= 1.3.0, < 2.0)
|
||||||
railties (= 4.1.7)
|
railties (= 4.1.7)
|
||||||
sprockets-rails (~> 2.0)
|
sprockets-rails (~> 2.0)
|
||||||
|
rails-assets-growl (1.2.0)
|
||||||
|
rails-assets-jquery
|
||||||
|
rails-assets-jquery (2.1.1)
|
||||||
railties (4.1.7)
|
railties (4.1.7)
|
||||||
actionpack (= 4.1.7)
|
actionpack (= 4.1.7)
|
||||||
activesupport (= 4.1.7)
|
activesupport (= 4.1.7)
|
||||||
|
@ -222,6 +226,7 @@ DEPENDENCIES
|
||||||
pg
|
pg
|
||||||
poltergeist
|
poltergeist
|
||||||
rails (= 4.1.7)
|
rails (= 4.1.7)
|
||||||
|
rails-assets-growl
|
||||||
rspec-rails (~> 3.0.0)
|
rspec-rails (~> 3.0.0)
|
||||||
sass-rails (~> 4.0.3)
|
sass-rails (~> 4.0.3)
|
||||||
sdoc (~> 0.4.1)
|
sdoc (~> 0.4.1)
|
||||||
|
|
|
@ -5,16 +5,20 @@
|
||||||
#= require bootstrap
|
#= require bootstrap
|
||||||
#= require nprogress
|
#= require nprogress
|
||||||
#= require nprogress-turbolinks
|
#= require nprogress-turbolinks
|
||||||
|
#= require growl
|
||||||
#= require_tree .
|
#= require_tree .
|
||||||
|
|
||||||
NProgress.configure
|
NProgress.configure
|
||||||
showSpinner: false
|
showSpinner: false
|
||||||
|
|
||||||
showSnackbar = (text) ->
|
showNotification = (text, success=true) ->
|
||||||
$.snackbar # allahu snackbar
|
args =
|
||||||
content: text
|
title: if success then "Success!" else "Uh-oh..."
|
||||||
style: "snackbar"
|
message: text
|
||||||
timeout: 5000
|
if success
|
||||||
|
$.growl.notice args
|
||||||
|
else
|
||||||
|
$.growl.error args
|
||||||
|
|
||||||
$(document).on "click", "button[name=qb-ask]", ->
|
$(document).on "click", "button[name=qb-ask]", ->
|
||||||
btn = $(this)
|
btn = $(this)
|
||||||
|
@ -38,13 +42,10 @@ $(document).on "click", "button[name=qb-ask]", ->
|
||||||
if promote
|
if promote
|
||||||
$("div#question-box").hide()
|
$("div#question-box").hide()
|
||||||
$("div#question-box-promote").show()
|
$("div#question-box-promote").show()
|
||||||
showSnackbar data.message
|
showNotification data.message, data.success
|
||||||
else
|
|
||||||
console.log data, status, jqxhr
|
|
||||||
showSnackbar "An error occurred, a developer should check the console for details"
|
|
||||||
error: (jqxhr, status, error) ->
|
error: (jqxhr, status, error) ->
|
||||||
console.log jqxhr, status, error
|
console.log jqxhr, status, error
|
||||||
showSnackbar "An error occurred, a developer should check the console for details"
|
showNotification "An error occurred, a developer should check the console for details", false
|
||||||
complete: (jqxhr, status) ->
|
complete: (jqxhr, status) ->
|
||||||
btn.button "reset"
|
btn.button "reset"
|
||||||
$("textarea[name=qb-question]").removeAttr "readonly"
|
$("textarea[name=qb-question]").removeAttr "readonly"
|
||||||
|
@ -63,13 +64,10 @@ $(document).on "click", "button[name=ib-answer]", ->
|
||||||
success: (data, status, jqxhr) ->
|
success: (data, status, jqxhr) ->
|
||||||
if data.success
|
if data.success
|
||||||
$("div.inbox-box[data-id=#{iid}]").slideUp()
|
$("div.inbox-box[data-id=#{iid}]").slideUp()
|
||||||
showSnackbar data.message
|
showNotification data.message, data.success
|
||||||
else
|
|
||||||
console.log data, status, jqxhr
|
|
||||||
showSnackbar "An error occurred, a developer should check the console for details"
|
|
||||||
error: (jqxhr, status, error) ->
|
error: (jqxhr, status, error) ->
|
||||||
console.log jqxhr, status, error
|
console.log jqxhr, status, error
|
||||||
showSnackbar "An error occurred, a developer should check the console for details"
|
showNotification "An error occurred, a developer should check the console for details", false
|
||||||
complete: (jqxhr, status) ->
|
complete: (jqxhr, status) ->
|
||||||
btn.button "reset"
|
btn.button "reset"
|
||||||
$("textarea[name=ib-answer][data-id=#{iid}]").removeAttr "readonly"
|
$("textarea[name=ib-answer][data-id=#{iid}]").removeAttr "readonly"
|
||||||
|
@ -87,10 +85,10 @@ $(document).on "click", "button[name=ab-destroy]", ->
|
||||||
success: (data, status, jqxhr) ->
|
success: (data, status, jqxhr) ->
|
||||||
if data.success
|
if data.success
|
||||||
$("div.answer-box[data-id=#{aid}]").slideUp()
|
$("div.answer-box[data-id=#{aid}]").slideUp()
|
||||||
showSnackbar data.message
|
showNotification data.message, data.success
|
||||||
error: (jqxhr, status, error) ->
|
error: (jqxhr, status, error) ->
|
||||||
console.log jqxhr, status, error
|
console.log jqxhr, status, error
|
||||||
showSnackbar "An error occurred, a developer should check the console for details"
|
showNotification "An error occurred, a developer should check the console for details", false
|
||||||
complete: (jqxhr, status) ->
|
complete: (jqxhr, status) ->
|
||||||
btn.button "reset"
|
btn.button "reset"
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
*= require rails_bootstrap_forms
|
*= require rails_bootstrap_forms
|
||||||
|
*= require growl
|
||||||
*= require_self
|
*= require_self
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue