fix chart shown below task edit form

This commit is contained in:
Matteo Pagliazzi
2013-10-21 20:41:19 +02:00
parent cc05926e6b
commit c4882942d6
3 changed files with 11 additions and 3 deletions

View File

@@ -77,7 +77,7 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
default: default:
$rootScope.charts[id] = !$rootScope.charts[id]; $rootScope.charts[id] = !$rootScope.charts[id];
history = task.history; history = task.history;
if (task) task._editing = false; if (task && task._editing) task._editing = false;
} }
matrix = [['Date', 'Score']]; matrix = [['Date', 'Score']];
_.each(history, function(obj) { _.each(history, function(obj) {

View File

@@ -70,6 +70,13 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User', '
op: "revive" op: "revive"
}); });
}; };
$scope.toggleEdit = function(task){
console.log(task)
task._editing = !task._editing;
if($rootScope.charts[task.id]) $rootScope.charts[task.id] = false;
};
$scope.remove = function(task) { $scope.remove = function(task) {
var tasks; var tasks;
if (confirm("Are you sure you want to delete this task?") !== true) { if (confirm("Are you sure you want to delete this task?") !== true) {
@@ -82,6 +89,7 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User', '
}); });
tasks.splice(tasks.indexOf(task), 1); tasks.splice(tasks.indexOf(task), 1);
}; };
/* /*
------------------------ ------------------------
Items Items

View File

@@ -9,10 +9,10 @@ li(ng-repeat='task in user[list.type + "s"]', class='task {{taskClasses(task,use
i.icon-tags(tooltip='{{appliedTags(user.tags, task.tags)}}', ng-hide='noTags(task.tags)') i.icon-tags(tooltip='{{appliedTags(user.tags, task.tags)}}', ng-hide='noTags(task.tags)')
// edit // edit
a(ng-hide='task._editing', ng-click='task._editing = !task._editing', tooltip='Edit') a(ng-hide='task._editing', ng-click='toggleEdit(task)', tooltip='Edit')
i.icon-pencil(ng-hide='task._editing') i.icon-pencil(ng-hide='task._editing')
// cancel // cancel
a(ng-hide='!task._editing', ng-click='task._editing = !task._editing', tooltip='Cancel') a(ng-hide='!task._editing', ng-click='toggleEdit(task)', tooltip='Cancel')
i.icon-remove(ng-hide='!task._editing') i.icon-remove(ng-hide='!task._editing')
//- challenges //- challenges
// {{#if task.challenge}} // {{#if task.challenge}}