]> BookStack Code Mirror - bookstack/blobdiff - resources/assets/js/directives.js
#47 - Fixes the issues with the test case.
[bookstack] / resources / assets / js / directives.js
index 5bd764fa7ee01acb35b569ecfdbe95fdfd76d6b4..16d1ad2a4fe1be758f57cc24ac0a2b286275b509 100644 (file)
@@ -845,9 +845,9 @@ module.exports = function (ngApp, events) {
                 scope.closeBox = function () {
                     element.remove();
                     scope.$destroy();
-                }
+                };
             }
-        }
+        };
     }]);
 
     ngApp.directive('commentEdit', [function () {
@@ -855,7 +855,7 @@ module.exports = function (ngApp, events) {
             restrict: 'E',
             templateUrl: 'comment-reply.html',
             scope: {
-              comment: '=',
+              comment: '='
             },
             link: function (scope, element) {
                 scope.isEdit = true;
@@ -872,9 +872,9 @@ module.exports = function (ngApp, events) {
                 scope.closeBox = function () {
                     element.remove();
                     scope.$destroy();
-                }
+                };
             }
-        }
+        };
     }]);
 
 
@@ -889,8 +889,9 @@ module.exports = function (ngApp, events) {
                     scope.$destroy();
                 });
 
-                element.on('click', function () {
-                    var $container = element.parents('.comment-box').first();
+                element.on('click', function (e) {
+                    e.preventDefault();
+                    var $container = element.parents('.comment-actions').first();
                     if (!$container.length) {
                         console.error('commentReplyLink directive should be placed inside a container with class comment-box!');
                         return;
@@ -933,13 +934,14 @@ module.exports = function (ngApp, events) {
             },
             link: function (scope, element, attr, ctrl) {
 
-                element.on('click', function() {
-                   var resp = $window.confirm('This will remove the content of the comment, are you sure you want to continue?');
-                   if (!resp) {
-                       return;
-                   }
+                element.on('click', function(e) {
+                    e.preventDefault();
+                    var resp = $window.confirm(trans('entities.comment_delete_confirm'));
+                    if (!resp) {
+                        return;
+                    }
 
-                   ctrl.delete(scope.comment);
+                    ctrl.delete(scope.comment);
                 });
             }
         };