mirror of
https://github.com/lukevella/rallly.git
synced 2025-06-09 22:21:49 +02:00
New Features
- added notifications - added toggle switches - added delete feature - added email verification
This commit is contained in:
parent
e61ef151f6
commit
1b20a11bba
91 changed files with 6859 additions and 2756 deletions
41
public/js/directives/discussion.directive.js
Normal file
41
public/js/directives/discussion.directive.js
Normal file
|
@ -0,0 +1,41 @@
|
|||
angular.module('rallly')
|
||||
.directive('discussion', function($timeout, Comment, ConfirmModal){
|
||||
return {
|
||||
restrict : 'A',
|
||||
templateUrl : 'templates/directives/discussion.html',
|
||||
scope : {
|
||||
'event' : '='
|
||||
},
|
||||
link : function(scope, el, attrs){
|
||||
scope.comment = {};
|
||||
var thread = angular.element('.comment-thread');
|
||||
$timeout(function(){
|
||||
thread.scrollTop(thread.prop('scrollHeight'));
|
||||
});
|
||||
scope.deleteComment = function(comment){
|
||||
var modal = new ConfirmModal({
|
||||
title : 'Are you sure?',
|
||||
message : 'Are you sure you want to remove this comment?',
|
||||
confirmText : 'Yes - delete',
|
||||
cancelText : 'No - nevermind',
|
||||
isDestructive : true,
|
||||
confirm : function(){
|
||||
Comment.remove({ id : scope.event._id , cid : comment._id }, function(event){
|
||||
scope.event = event;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
scope.postComment = function(){
|
||||
if (scope.commentForm.$valid){
|
||||
var comment = new Comment(scope.comment);
|
||||
comment.$save({id:scope.event._id}, function(event){
|
||||
scope.event = event;
|
||||
scope.comment = {};
|
||||
});
|
||||
scope.commentForm.$setPristine();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue