allow manually unlocking party system

This commit is contained in:
Tyler Renelle 2013-03-15 18:39:39 -04:00
parent 14babdbf24
commit 545e5fc2a4
2 changed files with 12 additions and 4 deletions

View file

@ -71,8 +71,7 @@ module.exports.partySubscribe = partySubscribe = (page, model, params, next, cb)
module.exports.app = (appExports, model) ->
user = model.at('_user')
user.on 'set', 'flags.partyEnabled', (captures, args) ->
return unless captures == true
unlockPartiesNotification = ->
$('.main-avatar').popover('destroy') #remove previous popovers
html = """
<div class='party-system-popover'>
@ -89,6 +88,14 @@ module.exports.app = (appExports, model) ->
content: html
$('.main-avatar').popover 'show'
appExports.manuallyUnlockParties = ->
$("#settings-modal").modal("hide")
user.set('flags.partyEnabled', true)
unlockPartiesNotification()
user.on 'set', 'flags.partyEnabled', (captures, args) ->
unlockPartiesNotification() if captures == true
#TODO implement this when we have unsubscribe working properly
model.on 'set', '_user.party.invitation', (after, before) ->
if !before? and after? # they just got invited

View file

@ -18,8 +18,9 @@
</div>
<hr/>
<h4>Toggle Header</h4>
<button x-bind="click:toggleHeader">{#if _user.preferences.hideHeader}Show{else}Hide{/}</button>
<h4>Misc</h4>
<button x-bind="click:toggleHeader">{#if _user.preferences.hideHeader}Show Header{else}Hide Header{/}</button>
{#unless _user.flags.partyEnabled}&nbsp;<button x-bind="click:manuallyUnlockParties" data-dismiss='modal' rel=tooltip title="Parties are unlocked automatically for usability reasons, but you can override that here.">Enable Parties</button>{/}
{{#if _user.auth.local}}
<hr/>