mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-04-14 19:47:03 +00:00
Bug fixes & money update
This commit is contained in:
parent
b4c755f295
commit
4bd3ccbdb5
4 changed files with 14 additions and 16 deletions
|
|
@ -1,7 +1,5 @@
|
|||
<a href="#/new">New Habit</a>
|
||||
|
||||
<!--<ul id="habits-table" />-->
|
||||
|
||||
<table id="layout">
|
||||
<tr>
|
||||
<td class="panel">
|
||||
|
|
@ -55,7 +53,7 @@
|
|||
<div class="block">
|
||||
<div class='content'>
|
||||
<h2 class='title'>Rewards
|
||||
<!-- TODO render 'shared/money' -->
|
||||
<div id="money"></div>
|
||||
</h2>
|
||||
<div class='inner'>
|
||||
<!-- TODO rewards code block (see old code) -->
|
||||
|
|
@ -69,7 +67,4 @@
|
|||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<br/>
|
||||
|
|
|
|||
|
|
@ -22,10 +22,10 @@ class HabitTracker.Views.Habits.HabitView extends Backbone.View
|
|||
tagName: "li"
|
||||
|
||||
# why is @model not available in this function? having to pass it in like this
|
||||
dynamicClass= (model) ->
|
||||
output = "habit habit-type-#{model.get('habit_type')}"
|
||||
if model.get("done") then output += " done"
|
||||
score = model.get("score")
|
||||
dynamicClass: () =>
|
||||
output = "habit habit-type-#{@model.get('habit_type')}"
|
||||
if @model.get("done") then output += " done"
|
||||
score = @model.get("score")
|
||||
switch
|
||||
when score<-8 then output += ' color-red'
|
||||
when score>=-8 and score<-5 then output += ' color-pink'
|
||||
|
|
@ -38,7 +38,7 @@ class HabitTracker.Views.Habits.HabitView extends Backbone.View
|
|||
|
||||
render: ->
|
||||
$(@el).attr('id', "habit_#{@model.get('id')}")
|
||||
$(@el).attr('class', dynamicClass(@model))
|
||||
$(@el).attr('class', @dynamicClass())
|
||||
$(@el).html(@template(@model.toJSON() ))
|
||||
|
||||
@$(".comment").qtip content:
|
||||
|
|
|
|||
|
|
@ -8,12 +8,14 @@ class HabitTracker.Views.Habits.IndexView extends Backbone.View
|
|||
@options.habits.bind('change', @render, this) #TODO this ruins tabs, revisit
|
||||
window.userStats.bind('updatedStats', @updateStats, this)
|
||||
|
||||
# TODO create a view & template, bind to existing element
|
||||
updateStats: () =>
|
||||
# TODO create a view & template, bind to existing element
|
||||
stats = window.userStats
|
||||
#.to_i.to_s
|
||||
$('#tnl').html( "(Level #{stats.get('lvl')}) #{Math.round(stats.get('exp'))} / #{stats.tnl()}" )
|
||||
$( "#progressbar" ).progressbar value: stats.get('exp')/stats.tnl() * 100
|
||||
@$('#tnl').html( "(Level #{stats.get('lvl')}) #{Math.round(stats.get('exp'))} / #{stats.tnl()}" )
|
||||
@$( "#progressbar" ).progressbar value: stats.get('exp')/stats.tnl() * 100
|
||||
|
||||
money = stats.get('money').toFixed(1).split('.')
|
||||
@$('#money').html("#{money[0]} <img src='assets/coin_single_gold.png'/> #{money[1]} <img src='assets/coin_single_silver.png'/>")
|
||||
|
||||
addAll: () =>
|
||||
@options.habits.each(@addOne)
|
||||
|
|
@ -29,4 +31,5 @@ class HabitTracker.Views.Habits.IndexView extends Backbone.View
|
|||
$(@el).html(@template(habits: @options.habits.toJSON() ))
|
||||
@addAll()
|
||||
@$("#habits-todos").tabs()
|
||||
@updateStats()
|
||||
return this
|
||||
|
|
@ -27,6 +27,6 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def as_json(options={})
|
||||
super(:only => [:email, :lvl, :exp] )
|
||||
super(:only => [:email, :lvl, :exp, :money] )
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue