Notification changes to .coffees

This commit is contained in:
Philip How 2013-02-27 22:46:21 +00:00
parent c68b337403
commit 3982b754d0
2 changed files with 7 additions and 5 deletions

View file

@ -180,7 +180,7 @@ setupGrowlNotifications = (model) ->
return if user.get('stats.lvl') == 0 return if user.get('stats.lvl') == 0
$.bootstrapGrowl html, $.bootstrapGrowl html,
ele: '#notification-area', ele: '#notification-area',
type: type # (null, 'info', 'error', 'success') type: type # (null, 'info', 'error', 'success', 'gp', 'xp', 'hp', 'lvl')
top_offset: 20 top_offset: 20
align: 'right' # ('left', 'right', or 'center') align: 'right' # ('left', 'right', or 'center')
width: 250 # (integer, or 'auto') width: 250 # (integer, or 'auto')
@ -193,7 +193,7 @@ setupGrowlNotifications = (model) ->
num = captures - args num = captures - args
rounded = Math.abs(num.toFixed(1)) rounded = Math.abs(num.toFixed(1))
if num < 0 if num < 0
statsNotification "<i class='icon-heart'></i>HP -#{rounded}", 'error' # lost hp from purchase statsNotification "<i class='icon-heart'></i> -#{rounded} HP", 'hp' # lost hp from purchase
user.on 'set', 'stats.gp', (captures, args) -> user.on 'set', 'stats.gp', (captures, args) ->
num = captures - args num = captures - args
@ -201,12 +201,13 @@ setupGrowlNotifications = (model) ->
# made purchase # made purchase
if num < 0 if num < 0
# FIXME use 'warning' when unchecking an accidently completed daily/todo, and notify of exp too # FIXME use 'warning' when unchecking an accidently completed daily/todo, and notify of exp too
statsNotification "<i class='icon-star'></i>GP -#{rounded}", 'success' statsNotification "<i class='icon-star'></i> -#{rounded} GP", 'gp'
# gained gp (and thereby exp) # gained gp (and thereby exp)
else if num > 0 else if num > 0
num = Math.abs(num) num = Math.abs(num)
statsNotification "<i class='icon-star'></i>Exp,GP +#{rounded}", 'success' statsNotification "<i class='icon-star'></i> +#{rounded} XP", 'xp'
statsNotification "<i class='icon-gp'></i> +#{rounded} GP", 'gp'
user.on 'set', 'stats.lvl', (captures, args) -> user.on 'set', 'stats.lvl', (captures, args) ->
if captures > args if captures > args
statsNotification('<i class="icon-chevron-up"></i> Level Up!', 'info') statsNotification('<i class="icon-chevron-up"></i> Level Up!', 'lvl')

View file

@ -6,6 +6,7 @@
@import "./avatar.styl"; @import "./avatar.styl";
@import "./customizer.styl"; @import "./customizer.styl";
@import "./items.styl"; @import "./items.styl";
@import "./alerts.styl";
@import "../../public/vendor/bootstrap-datepicker/css/datepicker.css"; @import "../../public/vendor/bootstrap-datepicker/css/datepicker.css";