copy chat messages as todo

This commit is contained in:
Negue
2015-04-25 18:30:11 +02:00
parent ca3ac96d6d
commit 78dd949f20
4 changed files with 52 additions and 2 deletions

View File

@@ -344,7 +344,21 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Shared', 'Groups', '
});
});
}
}
};
$scope.copyToDo = function(message) {
var taskNotes = '[' + message.user + '](' + env.BASE_URL + '/static/front/#?memberId=' + message.uuid +
') wrote in [' + $scope.group.name + '](' + window.location.href + ')';
var newScope = $scope.$new();
newScope.text = message.text;
newScope.notes = taskNotes;
$rootScope.openModal('copyChatToDo',{
controller:'CopyMessageModalCtrl',
scope: newScope
});
};
$scope.sync = function(group){
group.$get();
@@ -549,3 +563,20 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Shared', 'Groups', '
}
}
])
.controller("CopyMessageModalCtrl", ['$scope', 'User', 'Notification',
function($scope, User, Notification){
$scope.saveTodo = function() {
var newTask = {
text: $scope.text,
type: 'todo',
notes: $scope.notes
};
User.user.ops.addTask({body:newTask});
Notification.text(window.env.t('messageAddedAsToDo'));
$scope.$close();
}
}
]);