challenges: back to dealing with taskLists from scopes, rather than the

habitrpg-tasks directive. Was having trouble accessing it by reference
otherwise. Would love to move off of the directive entirely and use
ng-include instead, but some scope issues with lists
This commit is contained in:
Tyler Renelle
2013-10-29 19:07:39 -07:00
parent 02ebc536ca
commit 6e71a76e22
7 changed files with 37 additions and 45 deletions

View File

@@ -2,6 +2,8 @@
habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User', 'Algos', 'Helpers', 'Notification', '$http', 'API_URL',
function($scope, $rootScope, $location, User, Algos, Helpers, Notification, $http, API_URL) {
$scope.obj = User.user; // used for task-lists
$scope.score = function(task, direction) {
if (task.type === "reward" && User.user.stats.gp < task.value){
return Notification.text('Not enough GP.');
@@ -11,11 +13,11 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User', '
};
$scope.addTask = function(list) {
var task = window.habitrpgShared.helpers.taskDefaults({text: list.newTask, type: list.type}, User.user.filters);
list.tasks.unshift(task);
$scope.addTask = function(addTo, listDef) {
var task = window.habitrpgShared.helpers.taskDefaults({text: listDef.newTask, type: listDef.type}, User.user.filters);
addTo.unshift(task);
User.log({op: "addTask", data: task});
delete list.newTask;
delete listDef.newTask;
};
/**