' +
avatar +
'' + _.escape(displayName) + '' +
@@ -201,12 +208,38 @@ class ActivityController {
}
updateComment(item) {
- let newMessage = 'Edited at ' + (new Date());
- item.commentModel.save({
- message: newMessage,
- });
- item.message = newMessage;
+ let message = this.formatMessage(item);
+ item.commentEdit = message;
+ let $target = $('.newCommentForm .message');
+ this.applyAtWho($target);
+ window.setTimeout(function () {
+ $target.find('.avatar').avatar(undefined, 16);
+ }, 0);
+ }
+ editComment(item) {
+ const self = this;
+ let content = this.commentBodyToPlain(item.commentEdit);
+ if (content.length < 1) {
+ OC.Notification.showTemporary(t('deck', 'Please provide a content for your comment.'));
+ return;
+ }
+ /** We need to save the model and afterwards run a fetch to update the mentions
+ * and call apply to propagate the changes to angular
+ */
+ item.commentModel.on('sync', function() {
+ item.commentModel.off('sync');
+ item.commentModel.fetch({
+ success: function() {
+ self.$scope.$apply();
+ }
+ });
+ });
+ item.commentModel.save({
+ message: content,
+ });
+ item.message = content;
+ item.commentEdit = undefined;
}
deleteComment(item) {
diff --git a/js/directive/contenteditable.js b/js/directive/contenteditable.js
index 7d8b24058..8ea80dda8 100644
--- a/js/directive/contenteditable.js
+++ b/js/directive/contenteditable.js
@@ -22,9 +22,10 @@
import app from '../app/App';
-app.directive("contenteditable", function() {
+app.directive("ngContenteditable", function($compile) {
return {
require: "ngModel",
+ restrict: 'A',
link: function(scope, element, attrs, ngModel) {
//read the text typed in the div (syncing model with the view)
diff --git a/templates/part.card.activity.html b/templates/part.card.activity.html
index 44e71a6b8..065e83d5d 100644
--- a/templates/part.card.activity.html
+++ b/templates/part.card.activity.html
@@ -5,13 +5,12 @@
{{ $ctrl.currentUser.displayName }}
-
+