mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-14 16:02:14 +00:00
round, gold, silver, and users status
This commit is contained in:
parent
4e2d80fbab
commit
fbcfc041e5
2 changed files with 17 additions and 4 deletions
|
|
@ -57,6 +57,15 @@ view.fn 'taskClasses', (type, completed) ->
|
|||
classes = type
|
||||
classes += " completed" if completed
|
||||
return classes
|
||||
|
||||
view.fn "round", (num) ->
|
||||
Math.round num
|
||||
|
||||
view.fn "gold", (num) ->
|
||||
num.toFixed(1).split('.')[0]
|
||||
|
||||
view.fn "silver", (num) ->
|
||||
num.toFixed(1).split('.')[1]
|
||||
|
||||
## CONTROLLER FUNCTIONS ##
|
||||
|
||||
|
|
@ -86,7 +95,10 @@ ready (model) ->
|
|||
# Also, note that refList index arguments can either be an index
|
||||
# or the item's id property
|
||||
list.pass(ignore: domId).move {id}, to
|
||||
|
||||
|
||||
$("#tnl-bar" ).progressbar value: model.at('_user.exp')/model.at('_tnl') * 100
|
||||
$("#hp-bar" ).progressbar value: model.at('_user.hp')/50 * 100
|
||||
|
||||
exports.addTask = (e, el, next) ->
|
||||
type = $(el).attr('data-task-type')
|
||||
list = model.at "_#{type}List"
|
||||
|
|
|
|||
|
|
@ -63,14 +63,14 @@
|
|||
<tr>
|
||||
<td id="avatar">
|
||||
<img src="/img/avatar/{_user.lvl}.png" /><br/>
|
||||
<b><div id="lvl">{_user.lvl}</div></b>
|
||||
<b><div id="lvl">Lvl: {_user.lvl}</div></b>
|
||||
</td>
|
||||
<td id="bars">
|
||||
<div id="hp-bar" style="width:400px;">
|
||||
<span id="hp">{_user.hp}</span>
|
||||
<span id="hp">HP: {round(_user.hp)}</span>
|
||||
</div>
|
||||
<div id="tnl-bar" style="width:400px;">
|
||||
<span id="tnl">{_tnl}</span>
|
||||
<span id="tnl">Exp: {round(_user.exp)} / {_tnl}</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
@ -105,6 +105,7 @@
|
|||
</app:taskList>
|
||||
<app:newTask type=todo><input class=new value={_newTodo}></app:newTask>
|
||||
|
||||
{gold(_user.money)} <img src='/img/coin_single_gold.png'/> {silver(_user.money)} <img src='/img/coin_single_silver.png'/>
|
||||
<app:taskList title=Rewards type=reward>
|
||||
{#each _rewardList}<app:task />{/}
|
||||
</app:taskList>
|
||||
|
|
|
|||
Loading…
Reference in a new issue