mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-03 08:21:07 +00:00
parties: bunch of bug fixes. enable parties by default, just notify
them at lvl 3 if they haven't started using it. Show a bell-icon notification in user, reset dom properly after invitation
This commit is contained in:
parent
80fd4f192c
commit
76512eef46
2 changed files with 15 additions and 23 deletions
|
|
@ -71,38 +71,31 @@ module.exports.partySubscribe = partySubscribe = (page, model, params, next, cb)
|
|||
module.exports.app = (appExports, model) ->
|
||||
user = model.at('_user')
|
||||
|
||||
unlockPartiesNotification = ->
|
||||
$('.main-herobox').popover('destroy') #remove previous popovers
|
||||
user.on 'set', 'flags.partyEnabled', (captures, args) ->
|
||||
return if (captures != true) or user.get('party.current')
|
||||
$('.user-menu').popover('destroy') #remove previous popovers
|
||||
html = """
|
||||
<div class='party-system-popover'>
|
||||
<img src='/img/party-unlocked.png' style='float:right;padding:5px;' />
|
||||
Congratulations, you have unlocked the Party System! You can now group with your friends by adding their User Ids.
|
||||
<a href='#' onClick="$('.main-herobox').popover('hide');return false;">[Close]</a>
|
||||
Be social, join a party and play Habit with your friends! You'll be better at your habits with accountability partners. LFG anyone?
|
||||
<a href='#' onClick="$('.user-menu').popover('hide');return false;">[Close]</a>
|
||||
</div>
|
||||
"""
|
||||
$('.main-herobox').popover
|
||||
title: "Party System Unlocked"
|
||||
$('.user-menu').popover
|
||||
title: "Party System"
|
||||
placement: 'bottom'
|
||||
trigger: 'manual'
|
||||
html: true
|
||||
content: html
|
||||
$('.main-herobox').popover 'show'
|
||||
$('.user-menu').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
|
||||
# if they haven't unlocked parties yet, unlock it for them
|
||||
user.set('flags.partyEnabled',true) unless user.get('flags.partyEnabled')
|
||||
window.setTimeout (-> window.location.reload true), 1000
|
||||
#partySubscribe(null, model, null, null, null)
|
||||
partyQ = model.query('parties').withId(after)
|
||||
partyQ.fetch (err, party) ->
|
||||
return next(err) if err
|
||||
model.ref '_party', party
|
||||
browser.resetDom(model)
|
||||
|
||||
appExports.partyCreate = ->
|
||||
newParty = model.get("_newParty")
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@
|
|||
<hr/>
|
||||
<h4>Misc</h4>
|
||||
<button x-bind="click:toggleHeader" class="btn">{#if _user.preferences.hideHeader}Show Header{else}Hide Header{/}</button>
|
||||
{#unless _user.flags.partyEnabled} <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/>
|
||||
|
|
@ -140,10 +139,10 @@
|
|||
{{else}}
|
||||
<ul class="nav site-nav">
|
||||
<li class="flyout">
|
||||
<h1 class="task-action-btn tile solid user-reporter">{{username(_user.auth)}}</h1>
|
||||
<h1 class="task-action-btn tile solid user-reporter">{#if _user.party.invitation}<i class='icon-bell'></i> {/}{{username(_user.auth)}}</h1>
|
||||
<ul class="flyout-content nav stacked">
|
||||
<li><a class="task-action-btn tile solid" data-target="#settings-modal" data-toggle="modal">Settings</a></li>
|
||||
<li>{#if _user.flags.partyEnabled}<a class="task-action-btn tile solid" data-target="#party-modal" data-toggle="modal">Party</a>{/}</li>
|
||||
<li><a class="task-action-btn tile solid" data-target="#party-modal" data-toggle="modal">{#if _user.party.invitation}<i class='icon-bell'></i> {/}Party</a></li>
|
||||
<li><a class="task-action-btn tile solid" href="/logout">Logout</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
|
|
|||
Loading…
Reference in a new issue