mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-31 23:11:15 +00:00
rename _view.* to _* - don't know why I did that whole _view.* thing
in the first place, but whatevs
This commit is contained in:
parent
c55118a5bc
commit
6522badaa6
10 changed files with 33 additions and 33 deletions
|
|
@ -8,7 +8,7 @@ moment = require 'moment'
|
|||
###
|
||||
loadJavaScripts = (model) ->
|
||||
|
||||
unless model.get('_view.mobileDevice')
|
||||
unless model.get('_mobileDevice')
|
||||
require '../../public/vendor/jquery-ui/ui/jquery.ui.core'
|
||||
require '../../public/vendor/jquery-ui/ui/jquery.ui.widget'
|
||||
require '../../public/vendor/jquery-ui/ui/jquery.ui.mouse'
|
||||
|
|
@ -22,7 +22,7 @@ loadJavaScripts = (model) ->
|
|||
Setup jQuery UI Sortable
|
||||
###
|
||||
setupSortable = (model) ->
|
||||
unless (model.get('_view.mobileDevice') == true) #don't do sortable on mobile
|
||||
unless (model.get('_mobileDevice') == true) #don't do sortable on mobile
|
||||
_.each ['habit', 'daily', 'todo', 'reward'], (type) ->
|
||||
$("ul.#{type}s").sortable
|
||||
dropOnEmpty: false
|
||||
|
|
@ -177,7 +177,7 @@ loadExternalScripts = (model) ->
|
|||
|
||||
# JS files not needed right away (google charts) or entirely optional (analytics)
|
||||
# Each file getsload asyncronously via $.getScript, so it doesn't bog page-load
|
||||
unless model.get('_view.mobileDevice')
|
||||
unless model.get('_mobileDevice')
|
||||
|
||||
$.getScript("//s7.addthis.com/js/250/addthis_widget.js#pubid=lefnire")
|
||||
|
||||
|
|
@ -191,14 +191,14 @@ loadExternalScripts = (model) ->
|
|||
|
||||
module.exports.app = (appExports, model, app) ->
|
||||
loadJavaScripts(model)
|
||||
setupGrowlNotifications(model) unless model.get('_view.mobileDevice')
|
||||
setupGrowlNotifications(model) unless model.get('_mobileDevice')
|
||||
|
||||
app.on 'render', (ctx) ->
|
||||
#restoreRefs(model)
|
||||
setupSortable(model)
|
||||
setupTooltips(model)
|
||||
setupTour(model)
|
||||
initStickyHeader(model) unless model.get('_view.mobileDevice')
|
||||
initStickyHeader(model) unless model.get('_mobileDevice')
|
||||
loadExternalScripts(model)
|
||||
$('.datepicker').datepicker({autoclose:true, todayBtn:true})
|
||||
.on 'changeDate', (ev) ->
|
||||
|
|
|
|||
|
|
@ -65,6 +65,6 @@ ready (model) ->
|
|||
require('./profile').app(exports, model)
|
||||
require('./pets').app(exports, model)
|
||||
require('../server/private').app(exports, model)
|
||||
require('./debug').app(exports, model) if model.get('_view.nodeEnv') != 'production'
|
||||
require('./debug').app(exports, model) if model.get('_nodeEnv') != 'production'
|
||||
require('./browser').app(exports, model, app)
|
||||
|
||||
|
|
|
|||
|
|
@ -113,11 +113,11 @@ module.exports.app = (appExports, model) ->
|
|||
|
||||
|
||||
appExports.activateRewardsTab = ->
|
||||
model.set '_view.activeTabRewards', true
|
||||
model.set '_view.activeTabPets', false
|
||||
model.set '_activeTabRewards', true
|
||||
model.set '_activeTabPets', false
|
||||
appExports.activatePetsTab = ->
|
||||
model.set '_view.activeTabPets', true
|
||||
model.set '_view.activeTabRewards', false
|
||||
model.set '_activeTabPets', true
|
||||
model.set '_activeTabRewards', false
|
||||
|
||||
model.on 'set', '_user.flags.itemsEnabled', (captures, args) ->
|
||||
return unless captures is true
|
||||
|
|
@ -160,12 +160,12 @@ module.exports.updateStore = updateStore = (model) ->
|
|||
_.each ['weapon', 'armor', 'shield', 'head'], (type) ->
|
||||
i = parseInt(obj?.items?[type] || 0) + 1
|
||||
nextItem = if (i == _.size items[type]) then {hide:true} else items[type][i]
|
||||
model.set "_view.items.#{type}", nextItem
|
||||
model.set "_items.#{type}", nextItem
|
||||
|
||||
model.set '_view.items.potion', items.potion
|
||||
model.set '_view.items.reroll', items.reroll
|
||||
model.set '_view.items.pets', items.pets
|
||||
model.set '_view.items.hatchingPotions', items.hatchingPotions
|
||||
model.set '_items.potion', items.potion
|
||||
model.set '_items.reroll', items.reroll
|
||||
model.set '_items.pets', items.pets
|
||||
model.set '_items.hatchingPotions', items.hatchingPotions
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -113,10 +113,10 @@ module.exports.app = (appExports, model) ->
|
|||
throw err if err
|
||||
u = res.at(0).get()
|
||||
if !u?
|
||||
model.set "_view.partyError", "User with id #{id} not found."
|
||||
model.set "_partyError", "User with id #{id} not found."
|
||||
return
|
||||
else if u.party.current? or u.party.invitation?
|
||||
model.set "_view.partyError", "User already in a party or pending invitation."
|
||||
model.set "_partyError", "User already in a party or pending invitation."
|
||||
return
|
||||
else
|
||||
p = model.at '_party'
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ module.exports.view = (req, res, next) ->
|
|||
model = req.getModel()
|
||||
_view = model.get('_view') || {}
|
||||
## Set _mobileDevice to true or false so view can exclude portions from mobile device
|
||||
_view.mobileDevice = /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(req.header 'User-Agent')
|
||||
_view.nodeEnv = process.env.NODE_ENV
|
||||
_mobileDevice = /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(req.header 'User-Agent')
|
||||
_nodeEnv = process.env.NODE_ENV
|
||||
model.set '_view', _view
|
||||
next()
|
||||
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@
|
|||
<h4>Welcome to the market!</h4>
|
||||
<small>Dying to get that particular pet you're after, but don't want to wait for it to drop? Buy it here!</small>
|
||||
<h4>Eggs</h4>
|
||||
{#with _view.items.pets as :egg}
|
||||
{#with _items.pets as :egg}
|
||||
<table>
|
||||
<tr>
|
||||
{#with :egg[0]}<app:pets:egg />{/}
|
||||
|
|
@ -251,7 +251,7 @@
|
|||
</table>
|
||||
{/}
|
||||
<h4>Hatching Potions</h4>
|
||||
{#with _view.items.hatchingPotions as :hatchingPotion}
|
||||
{#with _items.hatchingPotions as :hatchingPotion}
|
||||
<table>
|
||||
<tr>
|
||||
{#with :hatchingPotion[0]}<app:pets:hatchingPotion />{/}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
</div>
|
||||
|
||||
<div class='span3'>
|
||||
{{#if equal(_view.nodeEnv, 'development')}}
|
||||
{{#if equal(_nodeEnv, 'development')}}
|
||||
<h4>Cheat</h4>
|
||||
<ul class='unstyled'>
|
||||
<li><button class='btn' x-bind="click:emulateNextDay">Emulate Next Day</button></li>
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@
|
|||
</noscript>
|
||||
{{/}}
|
||||
|
||||
{{#if equal(_view.nodeEnv,"production")}}
|
||||
{{#if equal(_nodeEnv,"production")}}
|
||||
<!-- Google Analytics -->
|
||||
<script type="text/javascript">
|
||||
var _gaq = _gaq || [];
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
{/}
|
||||
</table>
|
||||
<form class=form-inline x-bind="submit: partyInvite">
|
||||
{#if _view.partyError}
|
||||
<div class='alert alert-danger'>{_view.partyError}</div>
|
||||
{#if _partyError}
|
||||
<div class='alert alert-danger'>{_partyError}</div>
|
||||
{/}
|
||||
<div class='control-group'>
|
||||
<input type="text" class="input-medium" placeholder="User Id" value="{_newPartyMember}">
|
||||
|
|
@ -30,8 +30,8 @@
|
|||
<p>You are not in a party. You can either create one and invite friends, or if you want to join an existing party, have them enter:</p>
|
||||
<pre class=prettyprint>{_user.id}</pre>
|
||||
<form class=form-inline x-bind="submit: partyCreate">
|
||||
{#if _view.partyError}
|
||||
<div class='alert alert-danger'>{_view.partyError}</div>
|
||||
{#if _partyError}
|
||||
<div class='alert alert-danger'>{_partyError}</div>
|
||||
{/}
|
||||
<div class=control-group>
|
||||
<input type="text" class="input-medium" placeholder="Party Name" value="{_newParty}" />
|
||||
|
|
|
|||
|
|
@ -25,12 +25,12 @@
|
|||
|
||||
<!-- Static Rewards -->
|
||||
<ul class='items' style="{#unless _user.flags.itemsEnabled}display:none{/}">
|
||||
{#with _view.items.weapon as :item}<app:rewards:item />{/}
|
||||
{#with _view.items.armor as :item}<app:rewards:item />{/}
|
||||
{#with _view.items.head as :item}<app:rewards:item />{/}
|
||||
{#with _view.items.shield as :item}<app:rewards:item />{/}
|
||||
{#with _view.items.potion as :item}<app:rewards:item />{/}
|
||||
{#with _view.items.reroll as :item}<app:rewards:item reroll=true />{/}
|
||||
{#with _items.weapon as :item}<app:rewards:item />{/}
|
||||
{#with _items.armor as :item}<app:rewards:item />{/}
|
||||
{#with _items.head as :item}<app:rewards:item />{/}
|
||||
{#with _items.shield as :item}<app:rewards:item />{/}
|
||||
{#with _items.potion as :item}<app:rewards:item />{/}
|
||||
{#with _items.reroll as :item}<app:rewards:item reroll=true />{/}
|
||||
</ul>
|
||||
|
||||
<app:tasks:ads>
|
||||
|
|
|
|||
Loading…
Reference in a new issue