From c85450db04629e56e280e440aaaa118dd8a13f41 Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Fri, 13 Dec 2013 17:50:43 -0700 Subject: [PATCH] classes: add task attributes for point allocations --- src/models/task.js | 1 + src/models/user.js | 4 ---- views/shared/header/header.jade | 2 +- views/shared/tasks/task.jade | 10 ++++++---- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/models/task.js b/src/models/task.js index fc6a27bf91..e160a09971 100644 --- a/src/models/task.js +++ b/src/models/task.js @@ -20,6 +20,7 @@ var TaskSchema = { tags: {type: Schema.Types.Mixed, 'default': {}}, //{ "4ddf03d9-54bd-41a3-b011-ca1f1d2e9371" : true }, value: {type: Number, 'default': 0}, // redness priority: {type: Number, 'default': '1'}, + attribute: {type: String, 'default': "str", enum: ['str','con','int','per']}, challenge: { id: {type: 'String', ref:'Challenge'}, broken: String, // CHALLENGE_DELETED, TASK_DELETED, UNSUBSCRIBED, CHALLENGE_CLOSED diff --git a/src/models/user.js b/src/models/user.js index a89d5c6977..65627cc4a8 100644 --- a/src/models/user.js +++ b/src/models/user.js @@ -317,10 +317,6 @@ UserSchema.pre('save', function(next) { 'Anonymous'; } - // FIXME handle this on level-up instead, and come up with how we're going to handle retroactively - // Actually, can this be used as an attr default? (schema {type: ..., 'default': function(){}}) - this.stats.points = this.stats.lvl - (this.stats.con + this.stats.str + this.stats.per + this.stats.int); - var petCount = shared.countPets(_.reduce(this.items.pets,function(m,v){ //HOTFIX - Remove when solution is found, the first argument passed to reduce is a function if(_.isFunction(v)) return m; diff --git a/views/shared/header/header.jade b/views/shared/header/header.jade index 7ea8f6315f..46f00c431a 100644 --- a/views/shared/header/header.jade +++ b/views/shared/header/header.jade @@ -25,7 +25,7 @@ a(ng-click='toggleChart("exp")', tooltip='Progress') i.icon-signal .meter.mana(title='Mana', ng-if='user.flags.classSelected') - .bar(style='width: {{percent(user.stats.mp, user.stats.int+10)}}%;') + .bar(style='width: {{percent(user.stats.mp, user._statsComputed.int+10)}}%;') span.meter-text i.icon-fire | {{user.stats.mp || 0 | number:0}} / {{user.stats.int+10}} diff --git a/views/shared/tasks/task.jade b/views/shared/tasks/task.jade index 3c865586f4..6ac63356ae 100644 --- a/views/shared/tasks/task.jade +++ b/views/shared/tasks/task.jade @@ -164,10 +164,12 @@ li(bindonce='list', ng-repeat='task in obj[list.type+"s"]', class='task {{Shared legend.option-title Attributes .task-controls.tile-group - button.task-action-btn.tile(type='button') Physical - button.task-action-btn.tile(type='button') Mental - button.task-action-btn.tile(type='button') Social - button.task-action-btn.tile(type='button') Other + button.task-action-btn.tile(type='button', ng-class='{active: task.attribute=="str"}', ng-click='task.attribute="str"') Physical + button.task-action-btn.tile(type='button', ng-class='{active: task.attribute=="int"}', ng-click='task.attribute="int"') Mental + button.task-action-btn.tile(type='button', ng-class='{active: task.attribute=="con"}', ng-click='task.attribute="con"') Social + button.task-action-btn.tile(type='button', ng-class='{active: task.attribute=="per"}', ng-click='task.attribute="per"') + | Other  + i.icon-question-sign(popover='Eg, professional persuites, hobbies, financial, etc.', popover-trigger='mouseenter', popover-placement='top') button.task-action-btn.tile.spacious(type='submit') Save & Close