mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-01 23:40:25 +00:00
close "new party" <form> tag. #330, wah wah wah
This commit is contained in:
parent
031b4029c6
commit
03779c73ab
4 changed files with 24 additions and 22 deletions
|
|
@ -1,11 +1,20 @@
|
|||
_ = require 'underscore'
|
||||
|
||||
module.exports.restoreRefs = restoreRefs = (model) ->
|
||||
# tnl function
|
||||
model.fn '_tnl', '_user.stats.lvl', (lvl) ->
|
||||
# see https://github.com/lefnire/habitrpg/issues/4
|
||||
# also update in scoring.coffee. TODO create a function accessible in both locations
|
||||
(lvl*100)/5
|
||||
|
||||
#refLists
|
||||
_.each ['habit', 'daily', 'todo', 'reward'], (type) ->
|
||||
model.refList "_#{type}List", "_user.tasks", "_user.#{type}Ids"
|
||||
|
||||
module.exports.resetDom = (model) ->
|
||||
window.DERBY.app.dom.clear()
|
||||
restoreRefs(model)
|
||||
window.DERBY.app.view.render(model)
|
||||
model.fn '_tnl', '_user.stats.lvl', (lvl) -> (lvl*100)/5
|
||||
# _.each ['habit', 'daily', 'todo', 'reward'], (type) ->
|
||||
# model.refList "_#{type}List", "_user.tasks", "_user.{type}Ids"
|
||||
|
||||
module.exports.app = (appExports, model) ->
|
||||
loadJavaScripts(model)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
derby = require 'derby'
|
||||
{get, view, ready} = derby.createApp module
|
||||
derby.use require 'derby-ui-boot'
|
||||
derby.use require('../../ui')
|
||||
derby.use require('derby-auth/components');
|
||||
derby.use require '../../ui'
|
||||
derby.use require 'derby-auth/components'
|
||||
|
||||
# Custom requires
|
||||
character = require './character'
|
||||
|
|
@ -52,15 +52,7 @@ get '/', (page, model, next) ->
|
|||
character.updateUser(batch)
|
||||
batch.commit()
|
||||
|
||||
# refLists
|
||||
_.each ['habit', 'daily', 'todo', 'reward'], (type) ->
|
||||
model.refList "_#{type}List", "_user.tasks", "_user.#{type}Ids"
|
||||
|
||||
# tnl function
|
||||
model.fn '_tnl', '_user.stats.lvl', (lvl) ->
|
||||
# see https://github.com/lefnire/habitrpg/issues/4
|
||||
# also update in scoring.coffee. TODO create a function accessible in both locations
|
||||
(lvl*100)/5
|
||||
browser.restoreRefs model
|
||||
|
||||
party.partySubscribe model, -> page.render()
|
||||
|
||||
|
|
|
|||
|
|
@ -5,10 +5,11 @@ browser = require './browser'
|
|||
partyQ = null
|
||||
membersQ = null
|
||||
|
||||
partyUnsubscribe = (model) ->
|
||||
partyUnsubscribe = (model, cb) ->
|
||||
if window?
|
||||
subs = model._subs()
|
||||
model.unsubscribe.apply(model, subs)
|
||||
cb() if cb?
|
||||
|
||||
module.exports.partySubscribe = partySubscribe = (model, cb) ->
|
||||
|
||||
|
|
@ -143,11 +144,11 @@ module.exports.app = (appExports, model) ->
|
|||
model.del "parties.#{id}"
|
||||
model.set '_party', null
|
||||
model.set '_partyMembers', null
|
||||
partyUnsubscribe model
|
||||
selfQ = model.query('users').withId(model.get('_userId') or model.session.userId)
|
||||
selfQ.subscribe (err, u) ->
|
||||
model.ref '_user', u.at(0)
|
||||
browser.resetDom model
|
||||
partyUnsubscribe model, ->
|
||||
selfQ = model.query('users').withId(model.get('_userId') or model.session.userId)
|
||||
selfQ.subscribe (err, u) ->
|
||||
model.ref '_user', u.at(0)
|
||||
browser.resetDom model
|
||||
#setTimeout (-> window.location.reload true), 1
|
||||
|
||||
#exports.partyDisband = ->
|
||||
|
|
|
|||
|
|
@ -75,10 +75,10 @@ do a find for the string after "→"
|
|||
<div class='alert alert-danger'>{_view.partyError}</div>
|
||||
{/}
|
||||
<div class=control-group>
|
||||
<input type="text" class="input-medium" placeholder="Party Name" value="{_newParty}">
|
||||
<input type="text" class="input-medium" placeholder="Party Name" value="{_newParty}" />
|
||||
<input type="submit" class="btn" value="Create" />
|
||||
</div>
|
||||
<form>
|
||||
</form>
|
||||
{/}
|
||||
</app:myModal>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue