$scope.errors = {};
// keep track of comment levels
$scope.level = 1;
- vm.totalCommentsStr = 'Loading...';
+ vm.totalCommentsStr = trans('entities.comments_loading');
vm.permissions = {};
$scope.$on('evt.new-comment', function (event, comment) {
// add the comment to the comment list.
vm.comments.push(comment);
+ ++vm.totalComments;
+ setTotalCommentMsg();
event.stopPropagation();
event.preventDefault();
});
return;
}
vm.comments = resp.data.comments;
- vm.totalComments = resp.data.total;
+ vm.totalComments = +resp.data.total;
vm.permissions = resp.data.permissions;
vm.current_user_id = resp.data.user_id;
-
- // TODO : Fetch message from translate.
- if (vm.totalComments === 0) {
- vm.totalCommentsStr = 'No comments found.';
- } else if (vm.totalComments === 1) {
- vm.totalCommentsStr = '1 Comments';
- } else {
- vm.totalCommentsStr = vm.totalComments + ' Comments';
- }
+ setTotalCommentMsg();
}, checkError('app'));
});
+ function setTotalCommentMsg () {
+ // TODO : Fetch message from translate.
+ if (vm.totalComments === 0) {
+ vm.totalCommentsStr = trans('entities.no_comments');
+ } else if (vm.totalComments === 1) {
+ vm.totalCommentsStr = trans('entities.one_comment');
+ } else {
+ vm.totalCommentsStr = trans('entities.x_comments', {
+ numComments: vm.totalComments
+ });
+ }
+ }
+
function checkError(errorGroupName) {
$scope.errors[errorGroupName] = {};
return function(response) {
}]);
function updateComment(comment, resp, $timeout, isDelete) {
- if (isDelete && !resp.comment.active) {
- comment.html = trans('entities.comment_deleted');
- }
comment.text = resp.comment.text;
comment.updated = resp.comment.updated;
comment.updated_by = resp.comment.updated_by;
comment.active = resp.comment.active;
if (isDelete && !resp.comment.active) {
- comment.html = trans('entities.comment_deleted');
+ comment.html = trans('activities.comment_deleted');
} else {
comment.html = resp.comment.html;
}
*/
'comment' => 'Comment',
'comments' => 'Comments',
- 'comment_placeholder' => 'Enter your comments here, markdown supported...'
+ 'comment_placeholder' => 'Enter your comments here, markdown supported...',
+ 'no_comments' => 'No Comments',
+ 'x_comments' => ':numComments Comments',
+ 'one_comment' => '1 Comment',
+ 'comments_loading' => 'Loading...'
];
\ No newline at end of file
<div class="comment-header">
<a href="@{{::comment.created_by.profile_url}}">@{{ ::comment.created_by.name }}</a>
</div>
- <div ng-bind-html="comment.html" ng-if="::comment.active" class="comment-body">
+ <div ng-bind-html="comment.html" ng-if="::comment.active" class="comment-body" ng-class="!comment.active ? 'comment-inactive' : ''">
</div>
- <div ng-if="::!comment.active" class="comment-body">
- {{ trans('entites.comment_deleted') }}
+ <div ng-if="::!comment.active" class="comment-body comment-inactive">
+ {{ trans('activities.comment_deleted') }}
</div>
<div class="comment-actions">
<ul ng-if="!comment.is_hidden">