mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-01 15:31:16 +00:00
show kickstarter notification
This commit is contained in:
parent
46c3933936
commit
860b89cdb1
2 changed files with 21 additions and 7 deletions
|
|
@ -68,9 +68,13 @@ get '/:uid?', (page, model, {uid}, next) ->
|
|||
# see https://github.com/lefnire/habitrpg/issues/4
|
||||
# also update in scoring.coffee. TODO create a function accessible in both locations
|
||||
(lvl*100)/5
|
||||
|
||||
# Render Page
|
||||
page.render()
|
||||
|
||||
# ========== KickStarter Campaign Notifiation ==========
|
||||
if (model.get('_user.auth.local') || model.get('_user.auth.facebook')) && !model.get('_user.notifications.kickstarter')
|
||||
model.set('_user.notifications.kickstarter', 'show')
|
||||
|
||||
# Render Page
|
||||
page.render()
|
||||
|
||||
# ========== CONTROLLER FUNCTIONS ==========
|
||||
|
||||
|
|
@ -286,12 +290,14 @@ ready (model) ->
|
|||
model.set('_user.stats.lvl', 1)
|
||||
model.set('_user.balance', 2) if model.get('_user.balance') < 2 #only if they haven't manually bought tokens
|
||||
|
||||
exports.closeKickstarterNofitication = (e, el) ->
|
||||
model.set('_user.notifications.kickstarter', 'hide')
|
||||
|
||||
# ========== CRON ==========
|
||||
|
||||
|
||||
# FIXME seems can't call scoring.cron() instantly, have to call after some time (2s here)
|
||||
# Doesn't do anything otherwise. Don't know why... model not initialized enough yet?
|
||||
setTimeout scoring.cron, 1000 # Run once on refresh
|
||||
# Doesn't do anything otherwise. Don't know why... model not initialized enough yet?
|
||||
setTimeout scoring.cron, 2000 # Run once on refresh
|
||||
setInterval scoring.cron, 3600000 # Then run once every hour
|
||||
|
||||
require('../server/private').app(exports, model)
|
||||
require('../server/private').app(exports, model)
|
||||
|
|
@ -11,6 +11,14 @@
|
|||
|
||||
<ui:connectionAlert>
|
||||
<div id="head">
|
||||
|
||||
{#if equal(_user.notifications.kickstarter,'show')}
|
||||
<div class='alert alert-success'>
|
||||
<a x-bind="click:closeKickstarterNofitication" class='pull-right'>×</a>
|
||||
Want Habit on iPhone & Android? See the <strong><a href="http://kck.st/XoA3Yg">Kickstarter Campaign</a></strong>! Also funds new features and bug-squashing.
|
||||
</div>
|
||||
{/}
|
||||
|
||||
<div class='pull-right'>
|
||||
{#unless _loggedIn}
|
||||
<a class="btn btn-small btn-info" href="#login-modal" data-toggle="modal">Login / Register</a>
|
||||
|
|
|
|||
Loading…
Reference in a new issue