starting to put all the content in content.coffee, so it doesn't

clutter the functionality
This commit is contained in:
Tyler Renelle 2012-07-07 22:29:34 -04:00
parent 2c042dd65b
commit 69c4c257d9
2 changed files with 82 additions and 72 deletions

73
src/app/content.coffee Normal file
View file

@ -0,0 +1,73 @@
module.exports = {
defaultTasks:
habits: [
{type: 'habit', text: '1h Productive Work', notes: '<u>Habits: Constantly Track</u><br/>For some habits, it only makes sense to <b>gain</b> points (like this one).', value: 0, up: true, down: false }
{type: 'habit', text: 'Eat Junk Food', notes: 'For others, it only makes sense to <b>lose</b> points', value: 0, up: false, down: true}
{type: 'habit', text: 'Take The Stairs', notes: 'For the rest, both + and - make sense (stairs = gain, elevator = lose)', value: 0, up: true, down: true}
]
dailys: [
{type: 'daily', text: '1h Personal Project', notes: '<u>Dailies: Complete Once a Day</u><br/>At the end of each day, non-completed Dailies dock you points.', value: 0, completed: false }
{type: 'daily', text: 'Exercise', notes: "If you are doing well, they turn green and are less valuable (experience, gold) and less damaging (HP). This means you can ease up on them for a bit.", value: 3, completed: false }
{type: 'daily', text: '45m Reading', notes: 'But if you are doing poorly, they turn red. The worse you do, the more valuable (exp, gold) and more damaging (HP) these goals become. This encourages you to focus on your shortcomings, the reds.', value: -10, completed: false }
]
todos: [
{type: 'todo', text: 'Call Mom', notes: "<u>Todos: Complete Eventually</u><br/>Non-completed Todos won't hurt you, but they will become more valuable over time. This will encourage you to wrap up stale Todos.", value: -3, completed: false }
]
rewards: [
{type: 'reward', text: '1 Episode of Game of Thrones', notes: '<u>Rewards: Treat Yourself!</u><br/>As you complete goals, you earn gold to buy rewards. Buy them liberally - rewards are integral in forming good habits.', value: 20 }
{type: 'reward', text: 'Cake', notes: 'But only buy if you have enough gold - you lose HP otherwise.', value: 10 }
]
tylerDefaultTasks:
habits: [
{type: 'habit', text: 'Stairs', notes: '', value: 0, up: true, down: true}
{type: 'habit', text: 'Diet', notes: '', value: 0, up: true, down: true}
{type: 'habit', text: 'Ticket (Workflowy, Pivotal)', notes: '', value: 0, up: true, down: false}
{type: 'habit', text: 'Temptation Control', notes: '* meditate for 1 minute, visualize<br/>* positive, specific, present self-talk<br/>* do first task', value: 0, up: true, down: false}
{type: 'habit', text: 'Propose, not ask', notes: '', value: 0, up: true, down: false}
{type: 'habit', text: 'Focus', notes: '', value: 0, up: false, down: true}
{type: 'habit', text: 'Facebook/RSS out of turn', notes: '', value: 0, up: false, down: true}
{type: 'habit', text: 'Negative Talk', notes: '', value: 0, up: false, down: true}
{type: 'habit', text: 'Exaggeration', notes: '', value: 0, up: false, down: true}
{type: 'habit', text: 'Insult Self', notes: '', value: 0, up: false, down: true}
{type: 'habit', text: 'Other', notes: '* Nail-biting<br/>* Posture<br/>* Visualize / Meditate to sleep<br/>* Smile/eye-gaze', value: 0, up: false, down: false}
]
dailys: [
{type: 'daily', text: 'Review Pivotal, Asana, Workflowy', notes: '', value: 0, completed: false }
{type: 'daily', text: 'TMJ Exercise', notes: '', value: 0, completed: false }
{type: 'daily', text: 'Anki (20m)', notes: '', value: 0, completed: false }
{type: 'daily', text: '30m Code Reading', notes: '', value: 0, completed: false }
{type: 'daily', text: 'Google News', notes: '', value: 0, completed: false }
{type: 'daily', text: 'Mint', notes: '', value: 0, completed: false }
{type: 'daily', text: 'Anki (new / review)', notes: '', value: 0, completed: false }
{type: 'daily', text: 'Check Meetup', notes: '', value: 0, completed: false }
{type: 'daily', text: 'Read it later', notes: '', value: 0, completed: false }
{type: 'daily', text: 'RSS (Drupal)', notes: '', value: 0, completed: false }
{type: 'daily', text: 'RSS (Other)', notes: '', value: 0, completed: false }
{type: 'daily', text: 'Lunch TODO', notes: '', value: 0, completed: false }
{type: 'daily', text: 'Exercise', notes: '', value: 0, completed: false }
{type: 'daily', text: 'Read (45m)', notes: '', value: 0, completed: false }
{type: 'daily', text: 'Night TODO', notes: '', value: 0, completed: false }
{type: 'daily', text: 'Brain Game', notes: '', value: 0, completed: false }
{type: 'daily', text: '1h Personal Project', notes: '', value: 0, completed: false }
]
todos: [
{type: 'todo', text: 'Print insurance request card', notes: '"travel" tag', value: 0, completed: false }
{type: 'todo', text: 'VPM', notes: '', value: 0, completed: false }
{type: 'todo', text: 'mail', notes: '', value: 0, completed: false }
{type: 'todo', text: 'krav', notes: '', value: 0, completed: false }
{type: 'todo', text: 'rubber cement', notes: '', value: 0, completed: false }
{type: 'todo', text: 'bike', notes: '', value: 0, completed: false }
{type: 'todo', text: 'clean ~/.ievms', notes: '', value: 0, completed: false }
{type: 'todo', text: 'http://www.php-debug.com/www/', notes: '', value: 0, completed: false }
{type: 'todo', text: 'make sure IRA is setup for auto distribution', notes: '', value: 0, completed: false }
]
rewards: [
{type: 'reward', text: 'TV Show', notes: '', value: 20 }
{type: 'reward', text: '1h Novel', notes: '', value: 10 }
{type: 'reward', text: 'Shop', notes: '', value: 10 }
{type: 'reward', text: 'Junk Food', notes: '', value: 10 }
{type: 'reward', text: '9gag', notes: '', value: 5 }
{type: 'reward', text: 'Coffee', notes: '', value: 5 }
]
}

View file

@ -2,6 +2,7 @@ derby = require('derby')
{get, view, ready} = derby.createApp module
derby.use require('derby-ui-boot')
derby.use(require('../../ui'))
content = require('./content')
## ROUTES ##
@ -30,23 +31,10 @@ getRoom = (page, model, userId) ->
model.refList "_todoList", "_user.tasks", "_user.todoIds"
model.refList "_rewardList", "_user.tasks", "_user.rewardIds"
unless model.get('_user.tasks')
model.push '_habitList', task for task in [
{type: 'habit', text: '1h Productive Work', notes: '<u>Habits: Constantly Track</u><br/>For some habits, it only makes sense to <b>gain</b> points (like this one).', value: 0, up: true, down: false}
{type: 'habit', text: 'Eat Junk Food', notes: 'For others, it only makes sense to <b>lose</b> points', value: 0, up: false, down: true}
{type: 'habit', text: 'Take The Stairs', notes: 'For the rest, both + and - make sense (stairs = gain, elevator = lose)', value: 0, up: true, down: true}
]
model.push '_dailyList', task for task in [
{type: 'daily', text: '1h Personal Project', notes: '<u>Dailies: Complete Once a Day</u><br/>At the end of each day, non-completed Dailies dock you points.', value: 0, completed: false }
{type: 'daily', text: 'Exercise', notes: 'If you are doing well, they turn green and are less valuable (experience, gold) and less damaging (HP). This means you can ease up on them for a bit.', value: 3, completed: false }
{type: 'daily', text: '45m Reading', notes: 'But if you are doing poorly, they turn red. The worse you do, the more valuable (exp, gold) and more damaging (HP) these goals become. This encourages you to focus on your shortcomings, the reds.', value: -10, completed: false }
]
model.push '_todoList', task for task in [
{type: 'todo', text: 'Call Mom', notes: "<u>Todos: Complete Eventually</u><br/>Non-completed Todos won't hurt you, but they will become more valuable over time. This will encourage you to wrap up stale Todos.", value: -3, completed: false }
]
model.push '_rewardList', task for task in [
{type: 'reward', text: '1 Episode of Game of Thrones', notes: '<u>Rewards: Treat Yourself!</u><br/>As you complete goals, you earn gold to buy rewards. Buy them liberally - rewards are integral in forming good habits.', value: 20 }
{type: 'reward', text: 'Cake', notes: 'But only buy if you have enough gold - you lose HP otherwise.', value: 10 }
]
model.push '_habitList', task for task in content.defaultTasks.habits
model.push '_dailyList', task for task in content.defaultTasks.dailys
model.push '_todoList', task for task in content.defaultTasks.todos
model.push '_rewardList', task for task in content.defaultTasks.rewards
# http://tibia.wikia.com/wiki/Formula
model.fn '_tnl', '_user.lvl', (lvl) -> 50 * Math.pow(lvl, 2) - 150 * lvl + 200
@ -220,65 +208,14 @@ ready (model) ->
# return false
exports.loadDebugDefaults = (e, el) ->
model.remove '_habitList', 0, 100, ->
model.push '_habitList', task for task in [
{type: 'habit', text: 'Stairs', notes: '', value: 0, up: true, down: true}
{type: 'habit', text: 'Diet', notes: '', value: 0, up: true, down: true}
{type: 'habit', text: 'Ticket (Workflowy, Pivotal)', notes: '', value: 0, up: true, down: false}
{type: 'habit', text: 'Temptation Control', notes: '* meditate for 1 minute, visualize<br/>* positive, specific, present self-talk<br/>* do first task', value: 0, up: true, down: false}
{type: 'habit', text: 'Propose, not ask', notes: '', value: 0, up: true, down: false}
{type: 'habit', text: 'Focus', notes: '', value: 0, up: false, down: true}
{type: 'habit', text: 'Facebook/RSS out of turn', notes: '', value: 0, up: false, down: true}
{type: 'habit', text: 'Negative Talk', notes: '', value: 0, up: false, down: true}
{type: 'habit', text: 'Exaggeration', notes: '', value: 0, up: false, down: true}
{type: 'habit', text: 'Insult Self', notes: '', value: 0, up: false, down: true}
{type: 'habit', text: 'Other', notes: '* Nail-biting<br/>* Posture<br/>* Visualize / Meditate to sleep<br/>* Smile/eye-gaze', value: 0, up: false, down: false}
]
model.push '_habitList', task for task in content.tylerDefaultTasks.habits
model.remove '_dailyList', 0, 100, ->
model.push '_dailyList', task for task in [
{type: 'daily', text: 'Review Pivotal, Asana, Workflowy', notes: '', value: 0, completed: false }
{type: 'daily', text: 'TMJ Exercise', notes: '', value: 0, completed: false }
{type: 'daily', text: 'Anki (20m)', notes: '', value: 0, completed: false }
{type: 'daily', text: '30m Code Reading', notes: '', value: 0, completed: false }
{type: 'daily', text: 'Google News', notes: '', value: 0, completed: false }
{type: 'daily', text: 'Mint', notes: '', value: 0, completed: false }
{type: 'daily', text: 'Anki (new / review)', notes: '', value: 0, completed: false }
{type: 'daily', text: 'Check Meetup', notes: '', value: 0, completed: false }
{type: 'daily', text: 'Read it later', notes: '', value: 0, completed: false }
{type: 'daily', text: 'RSS (Drupal)', notes: '', value: 0, completed: false }
{type: 'daily', text: 'RSS (Other)', notes: '', value: 0, completed: false }
{type: 'daily', text: 'Lunch TODO', notes: '', value: 0, completed: false }
{type: 'daily', text: 'Exercise', notes: '', value: 0, completed: false }
{type: 'daily', text: 'Read (45m)', notes: '', value: 0, completed: false }
{type: 'daily', text: 'Night TODO', notes: '', value: 0, completed: false }
{type: 'daily', text: 'Brain Game', notes: '', value: 0, completed: false }
{type: 'daily', text: '1h Personal Project', notes: '', value: 0, completed: false }
]
model.push '_dailyList', task for task in content.tylerDefaultTasks.dailys
model.remove '_todoList', 0, 100, ->
model.push '_todoList', task for task in [
{type: 'todo', text: 'Print insurance request card', notes: '"travel" tag', value: 0, completed: false }
{type: 'todo', text: 'VPM', notes: '', value: 0, completed: false }
{type: 'todo', text: 'mail', notes: '', value: 0, completed: false }
{type: 'todo', text: 'krav', notes: '', value: 0, completed: false }
{type: 'todo', text: 'rubber cement', notes: '', value: 0, completed: false }
{type: 'todo', text: 'bike', notes: '', value: 0, completed: false }
{type: 'todo', text: 'clean ~/.ievms', notes: '', value: 0, completed: false }
{type: 'todo', text: 'http://www.php-debug.com/www/', notes: '', value: 0, completed: false }
{type: 'todo', text: 'make sure IRA is setup for auto distribution', notes: '', value: 0, completed: false }
]
model.push '_todoList', task for task in content.tylerDefaultTasks.todos
model.remove '_rewardList', 0, 100, ->
model.push '_rewardList', task for task in [
{type: 'reward', text: 'TV Show', notes: '', value: 20 }
{type: 'reward', text: '1h Novel', notes: '', value: 10 }
{type: 'reward', text: 'Shop', notes: '', value: 10 }
{type: 'reward', text: 'Junk Food', notes: '', value: 10 }
{type: 'reward', text: '9gag', notes: '', value: 5 }
{type: 'reward', text: 'Coffee', notes: '', value: 5 }
]
model.push '_rewardList', task for task in content.tylerDefaultTasks.rewards
exports.addTask = (e, el, next) ->
type = $(el).attr('data-task-type')