mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-05-20 20:58:51 +00:00
rewrite2: tasks-lists added
This commit is contained in:
parent
176a5a3583
commit
99af649ea1
9 changed files with 390 additions and 334 deletions
140
assets/js/controllers/tasksCtrl.coffee
Normal file
140
assets/js/controllers/tasksCtrl.coffee
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
"use strict"
|
||||
habitrpg.controller "TasksCtrl", ($scope, $rootScope, $location, filterFilter, User, Algos, Helpers, Notification) ->
|
||||
|
||||
$scope.taskLists = [
|
||||
{header: 'Habits', type: 'habit', inputValue:'_newHabit', placeHolder: 'New Habit', list: User.user.habits, main:true, editable:true}
|
||||
{header: 'Dailies', type: 'daily', inputValue:'_newDaily', placeHolder: 'New Daily', list: User.user.dailys, main:true, editable:true}
|
||||
{header: 'Todos', type: 'todo', inputValue:'_newTodo', placeHolder: 'New Todo', list: User.user.todos, main:true, editable:true}
|
||||
{header: 'Reward', type: 'reward', inputValue:'_newReward', placeHolder: 'New Reward', list: User.user.rewards, main:true, editable:true}
|
||||
]
|
||||
|
||||
$scope.score = (task, direction) ->
|
||||
|
||||
#save current stats to compute the difference after scoring.
|
||||
statsDiff = {}
|
||||
oldStats = _.clone(User.user.stats)
|
||||
Algos.score User.user, task, direction
|
||||
|
||||
#compute the stats change.
|
||||
_.each oldStats, (value, key) ->
|
||||
newValue = User.user.stats[key]
|
||||
statsDiff[key] = newValue - value if newValue isnt value
|
||||
|
||||
|
||||
#notify user if there are changes in stats.
|
||||
if Object.keys(statsDiff).length > 0
|
||||
Notification.push
|
||||
type: "stats"
|
||||
stats: statsDiff
|
||||
|
||||
if task.type is "reward" and _.isEmpty(statsDiff)
|
||||
Notification.push
|
||||
type: "text"
|
||||
text: "Not enough GP."
|
||||
|
||||
User.log
|
||||
op: "score"
|
||||
data: task
|
||||
dir: direction
|
||||
|
||||
|
||||
$scope.notDue = (task) ->
|
||||
if task.type is "daily"
|
||||
not window.habitrpgShared.helpers.shouldDo(moment(), task.repeat)
|
||||
else
|
||||
false
|
||||
|
||||
$scope.getClass = (value) ->
|
||||
out = ""
|
||||
if value < -20
|
||||
out += " color-worst"
|
||||
else if value < -10
|
||||
out += " color-worse"
|
||||
else if value < -1
|
||||
out += " color-bad"
|
||||
else if value < 1
|
||||
out += " color-neutral"
|
||||
else if value < 5
|
||||
out += " color-good"
|
||||
else if value < 10
|
||||
out += " color-better"
|
||||
else
|
||||
out += " color-best"
|
||||
out
|
||||
|
||||
$scope.addTask = ->
|
||||
return unless $scope.newTask.length
|
||||
defaults =
|
||||
text: $scope.newTask
|
||||
type: $scope.taskType()
|
||||
value: (if $scope.taskType() is "reward" then 20 else 0)
|
||||
|
||||
extra = {}
|
||||
switch $scope.taskType()
|
||||
when "habit"
|
||||
extra =
|
||||
up: true
|
||||
down: true
|
||||
when "daily", "todo"
|
||||
extra = completed: false
|
||||
newTask = _.defaults(extra, defaults)
|
||||
newTask.id = Helpers.uuid()
|
||||
User.user[newTask.type + "s"].unshift newTask
|
||||
$scope.showedTasks.unshift newTask
|
||||
User.log
|
||||
op: "addTask"
|
||||
data: newTask
|
||||
|
||||
$scope.newTask = ""
|
||||
|
||||
|
||||
#Add the new task to the actions log
|
||||
$scope.clearDoneTodos = ->
|
||||
|
||||
|
||||
#We can't alter $scope.user.tasks here. We have to invoke API call.
|
||||
#To be implemented
|
||||
$scope.selectTask = (task) ->
|
||||
$rootScope.selectedTask = task
|
||||
$location.path "/tasks/" + task.id
|
||||
|
||||
$scope.changeCheck = (task) ->
|
||||
|
||||
# This is calculated post-change, so task.completed=true if they just checked it
|
||||
if task.completed
|
||||
$scope.score task, "up"
|
||||
else
|
||||
$scope.score task, "down"
|
||||
|
||||
$(".taskWell").css "height", $(window).height() - 61
|
||||
|
||||
# TODO this should be somewhere else, but fits the html location better here
|
||||
$rootScope.revive = ->
|
||||
window.habitrpgShared.algos.revive User.user
|
||||
User.log op: "revive"
|
||||
|
||||
counter = 0
|
||||
|
||||
###
|
||||
------------------------
|
||||
Items
|
||||
------------------------
|
||||
###
|
||||
$scope.$watch "user.items", ->
|
||||
$scope.itemStore = window.habitrpgShared.items.updateStore($scope.user)
|
||||
|
||||
$scope.buy = (type) ->
|
||||
hasEnough = window.habitrpgShared.items.buyItem($scope.user, type)
|
||||
if hasEnough
|
||||
User.log
|
||||
op: "buy"
|
||||
type: type
|
||||
|
||||
Notification.push
|
||||
type: "text"
|
||||
text: "Item bought!"
|
||||
|
||||
else
|
||||
Notification.push
|
||||
type: "text"
|
||||
text: "Not enough GP."
|
||||
|
|
@ -1,188 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
habitrpg.controller('TasksCtrl',
|
||||
['$scope', '$rootScope', '$location', 'filterFilter', 'User', 'Algos', 'Helpers', 'Notification',
|
||||
function($scope, $rootScope, $location, filterFilter, User, Algos, Helpers, Notification) {
|
||||
|
||||
$scope.user = User.user;
|
||||
|
||||
$scope.taskTypeTitleSingular = function () {
|
||||
// show title according to the location, singular form
|
||||
return $rootScope.taskContext.type.charAt(0).toUpperCase() + $rootScope.taskContext.type.slice(1);
|
||||
};
|
||||
|
||||
$scope.taskType = function () {
|
||||
return $location.path().split('/')[1]
|
||||
};
|
||||
|
||||
$scope.tasks = function () {
|
||||
//return task array based on our location i.e. /habit will return user.habits[]
|
||||
return User.user[$scope.taskType() + 's'];
|
||||
};
|
||||
|
||||
$scope.showedTasks = []
|
||||
|
||||
$scope.taskFilter = function (task) {
|
||||
return ($location.path() == '/todo') ? !task.completed :
|
||||
($location.path() == '/todo/completed') ? task.completed :
|
||||
true;
|
||||
};
|
||||
|
||||
$scope.score = function (task, direction) {
|
||||
//save current stats to compute the difference after scoring.
|
||||
var statsDiff = {};
|
||||
var oldStats = _.clone(User.user.stats);
|
||||
|
||||
Algos.score(User.user, task, direction);
|
||||
|
||||
//compute the stats change.
|
||||
_.each(oldStats, function (value, key) {
|
||||
var newValue = User.user.stats[key];
|
||||
if (newValue !== value) {
|
||||
statsDiff[key] = newValue - value;
|
||||
}
|
||||
});
|
||||
//notify user if there are changes in stats.
|
||||
if (Object.keys(statsDiff).length > 0) {
|
||||
Notification.push({type: 'stats', stats: statsDiff});
|
||||
}
|
||||
|
||||
if (task.type == 'reward' && _.isEmpty(statsDiff)) {
|
||||
Notification.push({type: 'text', text: 'Not enough GP.'});
|
||||
}
|
||||
|
||||
User.log({op: 'score', data: task, dir: direction});
|
||||
};
|
||||
|
||||
$scope.notDue = function(task) {
|
||||
if (task.type == 'daily') {
|
||||
return !window.habitrpgShared.helpers.shouldDo(moment(), task.repeat);
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
$scope.getClass = function(value) {
|
||||
|
||||
var out = ''
|
||||
if (value < -20)
|
||||
out += ' color-worst'
|
||||
else if (value < -10)
|
||||
out += ' color-worse'
|
||||
else if (value < -1)
|
||||
out += ' color-bad'
|
||||
else if (value < 1)
|
||||
out += ' color-neutral'
|
||||
else if (value < 5)
|
||||
out += ' color-good'
|
||||
else if (value < 10)
|
||||
out += ' color-better'
|
||||
else
|
||||
out += ' color-best'
|
||||
return out
|
||||
}
|
||||
|
||||
$scope.addTask = function () {
|
||||
if (!$scope.newTask.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
var defaults = {
|
||||
text: $scope.newTask,
|
||||
type: $scope.taskType(),
|
||||
value: $scope.taskType() == 'reward' ? 20 : 0
|
||||
},
|
||||
extra = {};
|
||||
|
||||
switch ($scope.taskType()) {
|
||||
case 'habit':
|
||||
extra = {up: true, down: true};
|
||||
break;
|
||||
case 'daily':
|
||||
case 'todo':
|
||||
extra = {completed: false};
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
var newTask = _.defaults(extra, defaults);
|
||||
newTask.id = Helpers.uuid();
|
||||
User.user[newTask.type + 's'].unshift(newTask)
|
||||
$scope.showedTasks.unshift(newTask)
|
||||
User.log({op: 'addTask', data: newTask});
|
||||
$scope.newTask = '';
|
||||
//Add the new task to the actions log
|
||||
|
||||
};
|
||||
|
||||
$scope.clearDoneTodos = function () {
|
||||
//We can't alter $scope.user.tasks here. We have to invoke API call.
|
||||
//To be implemented
|
||||
};
|
||||
|
||||
$scope.selectTask = function (task) {
|
||||
$rootScope.selectedTask = task;
|
||||
$location.path('/tasks/' + task.id)
|
||||
}
|
||||
|
||||
$scope.changeCheck = function (task) {
|
||||
// This is calculated post-change, so task.completed=true if they just checked it
|
||||
if (task.completed) {
|
||||
$scope.score(task, 'up')
|
||||
} else {
|
||||
$scope.score(task, 'down')
|
||||
}
|
||||
}
|
||||
|
||||
$('.taskWell').css('height', $(window).height() - 61)
|
||||
|
||||
// TODO this should be somewhere else, but fits the html location better here
|
||||
$rootScope.revive = function() {
|
||||
window.habitrpgShared.algos.revive(User.user);
|
||||
User.log({op:'revive'});
|
||||
}
|
||||
|
||||
var counter = 0;
|
||||
|
||||
|
||||
/**
|
||||
* ------------------------
|
||||
* Items
|
||||
* ------------------------
|
||||
*/
|
||||
|
||||
$scope.$watch('user.items', function(){
|
||||
$scope.itemStore = window.habitrpgShared.items.updateStore($scope.user);
|
||||
});
|
||||
|
||||
$scope.buy = function(type) {
|
||||
var hasEnough = window.habitrpgShared.items.buyItem($scope.user, type);
|
||||
if (hasEnough) {
|
||||
User.log({op:'buy', type:type});
|
||||
Notification.push({type:'text', text:"Item bought!"})
|
||||
} else {
|
||||
Notification.push({type:'text', text:"Not enough GP."})
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
$scope.loadMore = function() {
|
||||
|
||||
var length = $scope.showedTasks.length
|
||||
if (typeof $scope.tasks() != 'undefined') {
|
||||
for (var i = length; i < length+7; i++) {
|
||||
if (typeof $scope.tasks()[i] != 'undefined') {
|
||||
$scope.showedTasks.push($scope.tasks()[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
$scope.loadMore()
|
||||
|
||||
*/
|
||||
|
||||
}
|
||||
]);
|
||||
|
|
@ -6,8 +6,10 @@
|
|||
header.site-header(ng-class='{hidden: user.preferences.hideHeader}', role='banner', data-partysize='{{party.members.length>1 ? truarr(party.members.length) : 0}}')
|
||||
// avatar
|
||||
.herobox-wrap.main-herobox(ng-controller='UserAvatarCtrl')
|
||||
|
||||
include ./avatar
|
||||
//app:avatar:avatar(profile='{{user}}', main='true')
|
||||
|
||||
// stat bars
|
||||
.hero-stats
|
||||
.meter.health(title='Health')
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ block content
|
|||
include ./modals/login
|
||||
include ./header/header
|
||||
|
||||
span(ng-class='{hidden: _gamePane}')
|
||||
| app:filters:filters
|
||||
span(ng-hide='_gamePane')
|
||||
app:filters:filters
|
||||
|
||||
br
|
||||
#notification-area
|
||||
|
|
@ -14,11 +14,11 @@ block content
|
|||
app:alerts:flash
|
||||
//if they hide the header, we still need user-menu visible
|
||||
app:settings:menu(ng-show='_user.preferences.hideHeader')
|
||||
.exp-chart(ng-class='{hidden: _page.charts.exp}')
|
||||
.exp-chart(ng-show='_page.charts.exp')
|
||||
#main.grid
|
||||
div(ng-class='{hidden: _gamePane}')
|
||||
app:tasks:task-lists(habits='{{_habitList}}', dailys='{{_dailyList}}', todos='{{_todoList}}', rewards='{{_rewardList}}', main='true', editable='true')
|
||||
div(ng-class='{hidden: _gamePane}')
|
||||
div(ng-hide='_gamePane')
|
||||
include ./tasks/task-list
|
||||
div(ng-show='_gamePane')
|
||||
app:game-pane:main
|
||||
app:footer:footer
|
||||
|
||||
|
|
|
|||
11
views/modals/achievements.jade
Normal file
11
views/modals/achievements.jade
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
// Streak Achievement
|
||||
div(modal='modals.streakAchievement', header='Achievement!')
|
||||
.modal-header
|
||||
h3 Achievement!
|
||||
.modal-body
|
||||
.achievement.achievement-thermometer
|
||||
| You have stacked your "Streaker" Achievement! Every 21 days of streak, you gain 1 achievement point here.
|
||||
.modal-footer
|
||||
button.btn.btn-default.cancel(ng-click='modals.modals.streakAchievement = false') Cancel
|
||||
|
||||
86
views/tasks/task-list.html
Normal file
86
views/tasks/task-list.html
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
<!--helpTitle & helpContent moved to tour -->
|
||||
|
||||
<!--
|
||||
header="habits"
|
||||
type="habit"
|
||||
inputValue={_newHabit}
|
||||
placeHolder="New Habit"
|
||||
list={@habits}
|
||||
main={{@main}}
|
||||
editable={@editable}
|
||||
-->
|
||||
|
||||
<!-- Habits Column -->
|
||||
<div class="module" ng-class="'rewards-module': type=='reward'">
|
||||
<div class="task-column {{type}}s" ng-class="'tabbable tabs-below': type=='todo'">
|
||||
|
||||
<!-- todos export/graph options -->
|
||||
<span ng-if="main && type=='todo'" class='option-box pull-right'>
|
||||
<a ng-show='user.history.todos' class="option-action" x-bind=click:toggleChart data-id="todos" rel=tooltip title="Progress"><i class=icon-signal></i></a>
|
||||
<a class="option-action" ng-href="/v1/users/{{user.id}}/calendar.ics?apiToken={{user.apiToken}}" rel=tooltip title="iCal"><i class=icon-calendar></i></a>
|
||||
<!-- <a href="https://www.google.com/calendar/render?cid={{encodeiCalLink(_user.id, _user.apiToken)}}" rel=tooltip title="Google Calendar"><i class=icon-calendar></i></a> -->
|
||||
</span>
|
||||
|
||||
<!-- cash or gems -->
|
||||
<span ng-if="main && type=='reward'" class='option-box pull-right wallet'>
|
||||
<div class="money">
|
||||
{{gold(floor(user.stats.gp))}}
|
||||
<span class='shop_gold' rel='tooltip' title='Gold'></span>
|
||||
</div>
|
||||
<div class="money">
|
||||
{{silver(user.stats.gp)}}
|
||||
<span class='shop_silver' rel='tooltip' title='Silver'></span>
|
||||
</div>
|
||||
</span>
|
||||
|
||||
<h2 class="task-column_title">{{header}}</h2>
|
||||
|
||||
<div ng-if='type == "todo"' class='todos-chart' ng-class="hidden:_page.charts.todos"></div>
|
||||
|
||||
<form ng-show='editable' class="addtask-form form-inline new-task-form" ng-class="hidden: _showCompleted && type=='todo'" data-task-type="{{type}}" x-bind="submit:addTask">
|
||||
<span class="addtask-field"><input value="{{inputValue}}" type="text" placeholder="{{placeHolder}}"/></span>
|
||||
<input class="addtask-btn" type="submit" value="+">
|
||||
</form>
|
||||
<hr>
|
||||
<ul class="{{type}}s" ng-class="hidden: !list">
|
||||
<app:tasks:task ng-repeat='task in list' />
|
||||
</ul>
|
||||
|
||||
<!-- Static Rewards -->
|
||||
<ul ng-show="main && type=='reward'" class='items' ng-class="hidden:!user.flags.itemsEnabled">
|
||||
<rewarditem data-item='{{_items.next.weapon}}' />
|
||||
<rewarditem data-item='{{_items.next.armor}}' />
|
||||
<rewarditem data-item='{{_items.next.head}}' />
|
||||
<rewarditem data-item='{{_items.next.shield}}' />
|
||||
<rewarditem data-item='{{_items.potion}}' />
|
||||
<rewarditem data-item='{{_items.reroll}}' />
|
||||
</ul>
|
||||
|
||||
<br/>
|
||||
<!-- ads -->
|
||||
<div ng-if="authenticated() && user.flags.ads != hide && main">
|
||||
|
||||
<span class='pull-right'>
|
||||
<a x-bind="click:showStripe" rel='tooltip' title='Remove Ads'><i class='icon-remove'></i></a><br/>
|
||||
<a href="#" data-target="#why-ads-modal" data-toggle="modal" rel='tooltip' title='Why Ads?'><i class='icon-question-sign'></i></a>
|
||||
</span>
|
||||
|
||||
<a ng-if='type=="habit"' href="http://www.amazon.com/gp/product/1400069289/ref=as_li_tf_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1400069289&linkCode=as2&tag=ha0d2-20">The Power of Habit: Why We Do What We Do in Life and Business</a><img src="//www.assoc-amazon.com/e/ir?t=ha0d2-20&l=as2&o=1&a=1400069289" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
|
||||
<a ng-if='type=="daily"' href="http://www.amazon.com/gp/product/0142000280/ref=as_li_tf_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0142000280&linkCode=as2&tag=ha0d2-20">Getting Things Done: The Art of Stress-Free Productivity</a><img src="//www.assoc-amazon.com/e/ir?t=ha0d2-20&l=as2&o=1&a=0142000280" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
|
||||
<a ng-if='type=="todo"' href="http://www.amazon.com/gp/product/0312430000/ref=as_li_tf_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0312430000&linkCode=as2&tag=ha0d2-20">The Checklist Manifesto: How to Get Things Right</a><img src="//www.assoc-amazon.com/e/ir?t=ha0d2-20&l=as2&o=1&a=0312430000" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
|
||||
<a ng-if='type="reward"' href="http://www.amazon.com/gp/product/1594484805/ref=as_li_tf_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1594484805&linkCode=as2&tag=ha0d2-20">Drive: The Surprising Truth About What Motivates Us</a><img src="//www.assoc-amazon.com/e/ir?t=ha0d2-20&l=as2&o=1&a=1594484805" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-if="type='todo'">
|
||||
<button class='task-action-btn tile spacious bright' ng-show="_showCompleted" x-bind=click:clearCompleted>Clear Completed</button>
|
||||
|
||||
<!-- remaining/completed tabs -->
|
||||
<ul class="nav nav-tabs">
|
||||
<li ng-class="active:!_showCompleted"><a x-bind="click:todosShowRemaining">Remaining</a></li>
|
||||
<li ng-class="active:_showCompleted"><a x-bind="click:todosShowCompleted">Complete</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
75
views/tasks/task-list.jade
Normal file
75
views/tasks/task-list.jade
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
div(ng-controller='TasksCtrl')
|
||||
.module(ng-controller='TasksCtrl', ng-repeat='list in taskLists', ng-class='{"rewards-module": list.type==="reward"}')
|
||||
.task-column(class='{{list.type}}s', ng-class='{"tabbable tabs-below": list.type=="todo"}')
|
||||
|
||||
// Todos export/graph options
|
||||
span.option-box.pull-right(ng-if='list.main && list.type=="todo"')
|
||||
a.option-action(ng-show='user.history.todos', x-bind='click:toggleChart', data-id='todos', rel='tooltip', title='Progress')
|
||||
i.icon-signal
|
||||
a.option-action(ng-href='/v1/users/{{user.id}}/calendar.ics?apiToken={{user.apiToken}}', rel='tooltip', title='iCal')
|
||||
i.icon-calendar
|
||||
// <a href="https://www.google.com/calendar/render?cid={{encodeiCalLink(_user.id, _user.apiToken)}}" rel=tooltip title="Google Calendar"><i class=icon-calendar></i></a>
|
||||
|
||||
// Gold & Gems
|
||||
span.option-box.pull-right.wallet(ng-if='list.main && list.type=="reward"')
|
||||
.money
|
||||
| {{gold(floor(user.stats.gp))}}
|
||||
span.shop_gold(rel='tooltip', title='Gold')
|
||||
.money
|
||||
| {{silver(user.stats.gp)}}
|
||||
span.shop_silver(rel='tooltip', title='Silver')
|
||||
|
||||
// Header
|
||||
h2.task-column_title {{list.header}}
|
||||
|
||||
// Todo Chart
|
||||
.todos-chart(ng-if='list.type == "todo"', ng-show='_page.charts.todos')
|
||||
|
||||
// Add New
|
||||
form.addtask-form.form-inline.new-task-form(ng-show='editable', ng-hide='_showCompleted && list.type=="todo"', data-task-type='{{list.type}}', x-bind='submit:addTask')
|
||||
span.addtask-field
|
||||
input(type='text', value='{{list.inputValue}}', placeholder='{{list.placeHolder}}')
|
||||
input.addtask-btn(type='submit', value='+')
|
||||
hr
|
||||
|
||||
// Actual List
|
||||
ul(class='{{list.type}}s', ng-show='list.list')
|
||||
app:tasks:task(ng-repeat='task in list.list')
|
||||
|
||||
// Static Rewards
|
||||
ul.items(ng-show='list.main && list.type=="reward"', ng-show='user.flags.itemsEnabled')
|
||||
app:reward:item(item='{{_items.next.weapon}}')
|
||||
app:reward:item(item='{{_items.next.armor}}')
|
||||
app:reward:item(item='{{_items.next.head}}')
|
||||
app:reward:item(item='{{_items.next.shield}}')
|
||||
app:reward:item(item='{{_items.potion}}')
|
||||
app:reward:item(item='{{_items.reroll}}')
|
||||
|
||||
br
|
||||
|
||||
// Ads
|
||||
div(ng-if='authenticated() && user.flags.ads != "hide" && list.main')
|
||||
span.pull-right
|
||||
a(x-bind='click:showStripe', rel='tooltip', title='Remove Ads')
|
||||
i.icon-remove
|
||||
br
|
||||
a(href='#', data-target='#why-ads-modal', data-toggle='modal', rel='tooltip', title='Why Ads?')
|
||||
i.icon-question-sign
|
||||
a(ng-if='list.type=="habit"', href='http://www.amazon.com/gp/product/1400069289/ref=as_li_tf_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1400069289&linkCode=as2&tag=ha0d2-20') The Power of Habit: Why We Do What We Do in Life and Business
|
||||
img(src='//www.assoc-amazon.com/e/ir?t=ha0d2-20&l=as2&o=1&a=1400069289', width='1', height='1', border='0', alt='', style='border:none !important; margin:0px !important;')
|
||||
a(ng-if='list.type=="daily"', href='http://www.amazon.com/gp/product/0142000280/ref=as_li_tf_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0142000280&linkCode=as2&tag=ha0d2-20') Getting Things Done: The Art of Stress-Free Productivity
|
||||
img(src='//www.assoc-amazon.com/e/ir?t=ha0d2-20&l=as2&o=1&a=0142000280', width='1', height='1', border='0', alt='', style='border:none !important; margin:0px !important;')
|
||||
a(ng-if='list.type=="todo"', href='http://www.amazon.com/gp/product/0312430000/ref=as_li_tf_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0312430000&linkCode=as2&tag=ha0d2-20') The Checklist Manifesto: How to Get Things Right
|
||||
img(src='//www.assoc-amazon.com/e/ir?t=ha0d2-20&l=as2&o=1&a=0312430000', width='1', height='1', border='0', alt='', style='border:none !important; margin:0px !important;')
|
||||
a(ng-if='list.type=="reward"', href='http://www.amazon.com/gp/product/1594484805/ref=as_li_tf_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1594484805&linkCode=as2&tag=ha0d2-20') Drive: The Surprising Truth About What Motivates Us
|
||||
img(src='//www.assoc-amazon.com/e/ir?t=ha0d2-20&l=as2&o=1&a=1594484805', width='1', height='1', border='0', alt='', style='border:none !important; margin:0px !important;')
|
||||
|
||||
// Todo Tabs
|
||||
div(ng-if='list.type=="todo"')
|
||||
button.task-action-btn.tile.spacious.bright(ng-show='_showCompleted', x-bind='click:clearCompleted') Clear Completed
|
||||
// remaining/completed tabs
|
||||
ul.nav.nav-tabs
|
||||
li(ng-class='{active: !_showCompleted}')
|
||||
a(x-bind='click: todosShowRemaining') Remaining
|
||||
li(ng-class='{active: _showCompleted}')
|
||||
a(x-bind='click: todosShowCompleted') Complete
|
||||
|
|
@ -1,165 +1,92 @@
|
|||
<modals:>
|
||||
<app:modals:modal modalId='streak-achievement-modal' header="Achievement!">
|
||||
<p>
|
||||
<div class='achievement achievement-thermometer'></div>You have stacked your "Streaker" Achievement! Every 21 days of streak, you gain 1 achievement point here.
|
||||
</p>
|
||||
<@footer>
|
||||
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
|
||||
</@footer>
|
||||
</app:modals:modal>
|
||||
|
||||
<task-lists:>
|
||||
<!--helpTitle & helpContent moved to tour -->
|
||||
|
||||
<!--
|
||||
header="habits"
|
||||
type="habit"
|
||||
inputValue={_newHabit}
|
||||
placeHolder="New Habit"
|
||||
list={@habits}
|
||||
main={{@main}}
|
||||
editable={@editable}
|
||||
-->
|
||||
|
||||
<!-- Habits Column -->
|
||||
<div class="module">
|
||||
<div class="task-column habits">
|
||||
<app:tasks:task-list
|
||||
header="habits"
|
||||
type="habit"
|
||||
inputValue={_newHabit}
|
||||
placeHolder="New Habit"
|
||||
list={@habits}
|
||||
main={{@main}}
|
||||
editable={@editable}
|
||||
>
|
||||
<@ads><a href="http://www.amazon.com/gp/product/1400069289/ref=as_li_tf_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1400069289&linkCode=as2&tag=ha0d2-20">The Power of Habit: Why We Do What We Do in Life and Business</a><img src="//www.assoc-amazon.com/e/ir?t=ha0d2-20&l=as2&o=1&a=1400069289" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></@ads>
|
||||
</app:tasks:task-list>
|
||||
</div>
|
||||
</div>
|
||||
<div class="module" ng-class="'rewards-module': type=='reward'">
|
||||
<div class="task-column {{type}}s" ng-class="'tabbable tabs-below': type=='todo'">
|
||||
|
||||
<!-- Dailys Column -->
|
||||
<div class="module">
|
||||
<div class="task-column dailys">
|
||||
<app:tasks:task-list
|
||||
header="dailies"
|
||||
type="daily"
|
||||
inputValue={_newDaily}
|
||||
placeHolder="New Daily"
|
||||
list={@dailys}
|
||||
main={{@main}}
|
||||
editable={@editable}
|
||||
>
|
||||
<@ads><a href="http://www.amazon.com/gp/product/0142000280/ref=as_li_tf_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0142000280&linkCode=as2&tag=ha0d2-20">Getting Things Done: The Art of Stress-Free Productivity</a><img src="//www.assoc-amazon.com/e/ir?t=ha0d2-20&l=as2&o=1&a=0142000280" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></@ads>
|
||||
</app:tasks:task-list>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Todos Column -->
|
||||
<div class="module">
|
||||
<div class="task-column todos tabbable tabs-below">
|
||||
|
||||
{{#if @main}}
|
||||
<!-- todo export/graph options -->
|
||||
<span class='option-box pull-right'>
|
||||
{#if _user.history.todos}
|
||||
<a class="option-action" x-bind=click:toggleChart data-id="todos" rel=tooltip title="Progress"><i class=icon-signal></i></a>
|
||||
{/}
|
||||
<a class="option-action" href="/v1/users/{{_user.id}}/calendar.ics?apiToken={{_user.apiToken}}" rel=tooltip title="iCal"><i class=icon-calendar></i></a>
|
||||
<!-- todos export/graph options -->
|
||||
<span ng-if="main && type=='todo'" class='option-box pull-right'>
|
||||
<a ng-show='user.history.todos' class="option-action" x-bind=click:toggleChart data-id="todos" rel=tooltip title="Progress"><i class=icon-signal></i></a>
|
||||
<a class="option-action" ng-href="/v1/users/{{user.id}}/calendar.ics?apiToken={{user.apiToken}}" rel=tooltip title="iCal"><i class=icon-calendar></i></a>
|
||||
<!-- <a href="https://www.google.com/calendar/render?cid={{encodeiCalLink(_user.id, _user.apiToken)}}" rel=tooltip title="Google Calendar"><i class=icon-calendar></i></a> -->
|
||||
</span>
|
||||
{{/}}
|
||||
|
||||
|
||||
<app:tasks:task-list
|
||||
header="todos"
|
||||
type="todo"
|
||||
inputValue="{_newTodo}"
|
||||
placeHolder="New Todo"
|
||||
list={@todos}
|
||||
main={{@main}}
|
||||
editable={@editable}
|
||||
>
|
||||
<@ads><a href="http://www.amazon.com/gp/product/0312430000/ref=as_li_tf_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0312430000&linkCode=as2&tag=ha0d2-20">The Checklist Manifesto: How to Get Things Right</a><img src="//www.assoc-amazon.com/e/ir?t=ha0d2-20&l=as2&o=1&a=0312430000" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></@ads>
|
||||
</app:tasks:task-list>
|
||||
|
||||
<button class='task-action-btn tile spacious bright {#unless _showCompleted}hidden{/}' x-bind=click:clearCompleted>Clear Completed</button>
|
||||
|
||||
<!-- remaining/completed tabs -->
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="{#unless _showCompleted}active{/}"><a x-bind="click:todosShowRemaining">Remaining</a></li>
|
||||
<li class="{#if _showCompleted}active{/}"><a x-bind="click:todosShowCompleted">Complete</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Rewards Column -->
|
||||
<div class="module rewards-module">
|
||||
<div class="task-column rewards">
|
||||
|
||||
{{#if @main}}
|
||||
<!-- cash or gems -->
|
||||
<span class='option-box pull-right wallet'>
|
||||
<span ng-if="main && type=='reward'" class='option-box pull-right wallet'>
|
||||
<div class="money">
|
||||
{gold(floor(_user.stats.gp))}
|
||||
{{gold(floor(user.stats.gp))}}
|
||||
<span class='shop_gold' rel='tooltip' title='Gold'></span>
|
||||
</div>
|
||||
<div class="money">
|
||||
{silver(_user.stats.gp)}
|
||||
{{silver(user.stats.gp)}}
|
||||
<span class='shop_silver' rel='tooltip' title='Silver'></span>
|
||||
</div>
|
||||
</span>
|
||||
{{/}}
|
||||
|
||||
<app:tasks:task-list
|
||||
header="rewards"
|
||||
type="reward"
|
||||
inputValue="{_newReward}"
|
||||
placeHolder="New Reward"
|
||||
list={@rewards}
|
||||
main={{@main}}
|
||||
editable={@editable}
|
||||
>
|
||||
<@extra>
|
||||
{{#if @main}}
|
||||
<!-- Static Rewards -->
|
||||
<ul class='items {#unless _user.flags.itemsEnabled}hidden{/}'>
|
||||
<app:rewards:item item={_items.next.weapon} />
|
||||
<app:rewards:item item={_items.next.armor} />
|
||||
<app:rewards:item item={_items.next.head} />
|
||||
<app:rewards:item item={_items.next.shield} />
|
||||
<app:rewards:item item={{_items.potion}} />
|
||||
<app:rewards:item item={{_items.reroll}} />
|
||||
<h2 class="task-column_title">{{header}}</h2>
|
||||
|
||||
<div ng-if='type == "todo"' class='todos-chart' ng-class="hidden:_page.charts.todos"></div>
|
||||
|
||||
<form ng-show='editable' class="addtask-form form-inline new-task-form" ng-class="hidden: _showCompleted && type=='todo'" data-task-type="{{type}}" x-bind="submit:addTask">
|
||||
<span class="addtask-field"><input value="{{inputValue}}" type="text" placeholder="{{placeHolder}}"/></span>
|
||||
<input class="addtask-btn" type="submit" value="+">
|
||||
</form>
|
||||
<hr>
|
||||
<ul class="{{type}}s" ng-class="hidden: !list">
|
||||
<app:tasks:task ng-repeat='task in list' />
|
||||
</ul>
|
||||
|
||||
<!-- Static Rewards -->
|
||||
<ul ng-show="main && type=='reward'" class='items' ng-class="hidden:!user.flags.itemsEnabled">
|
||||
<app:rewards:item item={{_items.next.weapon}} />
|
||||
<app:rewards:item item={{_items.next.armor}} />
|
||||
<app:rewards:item item={{_items.next.head}} />
|
||||
<app:rewards:item item={{_items.next.shield}} />
|
||||
<app:rewards:item item={{_items.potion}} />
|
||||
<app:rewards:item item={{_items.reroll}} />
|
||||
</ul>
|
||||
|
||||
<br/>
|
||||
<!-- ads -->
|
||||
<div ng-if="authenticated() && user.flags.ads != hide && main">
|
||||
|
||||
<span class='pull-right'>
|
||||
<a x-bind="click:showStripe" rel='tooltip' title='Remove Ads'><i class='icon-remove'></i></a><br/>
|
||||
<a href="#" data-target="#why-ads-modal" data-toggle="modal" rel='tooltip' title='Why Ads?'><i class='icon-question-sign'></i></a>
|
||||
</span>
|
||||
|
||||
<a ng-if='type=="habit"' href="http://www.amazon.com/gp/product/1400069289/ref=as_li_tf_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1400069289&linkCode=as2&tag=ha0d2-20">The Power of Habit: Why We Do What We Do in Life and Business</a><img src="//www.assoc-amazon.com/e/ir?t=ha0d2-20&l=as2&o=1&a=1400069289" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
|
||||
<a ng-if='type=="daily"' href="http://www.amazon.com/gp/product/0142000280/ref=as_li_tf_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0142000280&linkCode=as2&tag=ha0d2-20">Getting Things Done: The Art of Stress-Free Productivity</a><img src="//www.assoc-amazon.com/e/ir?t=ha0d2-20&l=as2&o=1&a=0142000280" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
|
||||
<a ng-if='type=="todo"' href="http://www.amazon.com/gp/product/0312430000/ref=as_li_tf_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0312430000&linkCode=as2&tag=ha0d2-20">The Checklist Manifesto: How to Get Things Right</a><img src="//www.assoc-amazon.com/e/ir?t=ha0d2-20&l=as2&o=1&a=0312430000" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
|
||||
<a ng-if='type="reward"' href="http://www.amazon.com/gp/product/1594484805/ref=as_li_tf_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1594484805&linkCode=as2&tag=ha0d2-20">Drive: The Surprising Truth About What Motivates Us</a><img src="//www.assoc-amazon.com/e/ir?t=ha0d2-20&l=as2&o=1&a=1594484805" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-if="type='todo'">
|
||||
<button class='task-action-btn tile spacious bright' ng-show="_showCompleted" x-bind=click:clearCompleted>Clear Completed</button>
|
||||
|
||||
<!-- remaining/completed tabs -->
|
||||
<ul class="nav nav-tabs">
|
||||
<li ng-class="active:!_showCompleted"><a x-bind="click:todosShowRemaining">Remaining</a></li>
|
||||
<li ng-class="active:_showCompleted"><a x-bind="click:todosShowCompleted">Complete</a></li>
|
||||
</ul>
|
||||
{{/}}
|
||||
</@extra>
|
||||
<@ads><a href="http://www.amazon.com/gp/product/1594484805/ref=as_li_tf_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1594484805&linkCode=as2&tag=ha0d2-20">Drive: The Surprising Truth About What Motivates Us</a><img src="//www.assoc-amazon.com/e/ir?t=ha0d2-20&l=as2&o=1&a=1594484805" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></@ads>
|
||||
</app:tasks:task-list>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Templates -->
|
||||
<task-list: nonvoid>
|
||||
<h2 class="task-column_title">{{t(@header)}}</h2>
|
||||
|
||||
{{#if equal(@type,'todo')}}<div class='todos-chart {#unless _page.charts.todos}hidden{/}'></div>{{/}}
|
||||
|
||||
{#if @editable}
|
||||
|
||||
<!-- need {#with} so we can reference model.at() in the submit handler -->
|
||||
<!-- NOTE: static binding {{}} seems to be required, otherwise things get weird - e.at() is _habitList first time, _habitList.0 second time, etc -->
|
||||
{{#with @list}}
|
||||
<form class="addtask-form form-inline new-task-form {#if and(_showCompleted,equal(@type,'todo'))}hidden{/}" data-task-type="{{@type}}" x-bind="submit:addTask">
|
||||
<span class="addtask-field"><input value="{@inputValue}" type="text" placeholder="{{@placeHolder}}"/></span>
|
||||
<input class="addtask-btn" type="submit" value="+">
|
||||
</form>
|
||||
{{/}}
|
||||
<hr>
|
||||
{/}
|
||||
<ul class="{{@type}}s {#unless @list}hidden{/}">
|
||||
{#each @list as :task}<app:tasks:task main={{@main}} />{/}
|
||||
</ul>
|
||||
{{@extra}}
|
||||
<br/>
|
||||
<!-- ads -->
|
||||
{{#if and( _loggedIn, notEqual(_user.flags.ads,'hide'), @main )}}
|
||||
<span class='pull-right'>
|
||||
<a x-bind="click:showStripe" rel='tooltip' title='Remove Ads'><i class='icon-remove'></i></a><br/>
|
||||
<a href="#" data-target="#why-ads-modal" data-toggle="modal" rel='tooltip' title='Why Ads?'><i class='icon-question-sign'></i></a>
|
||||
</span>
|
||||
|
||||
{{@ads}}
|
||||
{{/}}
|
||||
|
||||
<!-- all the parts of a single task -->
|
||||
<task:>
|
||||
|
|
|
|||
3
views/tasks/tasks.jade
Normal file
3
views/tasks/tasks.jade
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
//
|
||||
Created by lefnire on 8/25/13.
|
||||
|
||||
Loading…
Reference in a new issue