]> BookStack Code Mirror - bookstack/commitdiff
#47 - Adds a cancel button for edit and reply button.
authorAbijeet <redacted>
Sun, 4 Jun 2017 15:13:56 +0000 (20:43 +0530)
committerAbijeet <redacted>
Sun, 4 Jun 2017 15:13:56 +0000 (20:43 +0530)
resources/assets/js/directives.js
resources/lang/en/entities.php
resources/views/comments/comment-reply.blade.php

index 18217633ffe05a8d89801ddc65d90547b474f3a3..5bd764fa7ee01acb35b569ecfdbe95fdfd76d6b4 100644 (file)
@@ -839,9 +839,13 @@ module.exports = function (ngApp, events) {
                     // no need for the event to do anything more.
                     event.stopPropagation();
                     event.preventDefault();
+                    scope.closeBox();
+                });
+
+                scope.closeBox = function () {
                     element.remove();
                     scope.$destroy();
-                });
+                }
             }
         }
     }]);
@@ -861,10 +865,14 @@ module.exports = function (ngApp, events) {
                    event.stopPropagation();
                    event.preventDefault();
                    if (commentId === scope.comment.id && !scope.isNew) {
-                       element.remove();
-                       scope.$destroy();
+                       scope.closeBox();
                    }
                 });
+
+                scope.closeBox = function () {
+                    element.remove();
+                    scope.$destroy();
+                }
             }
         }
     }]);
index 8480879d6c6517dd8ab58eedba929a1e8fba33ad..dd7c54755d99198d3af30aa05c7e0f071879a9c0 100644 (file)
@@ -244,5 +244,7 @@ return [
     'no_comments' => 'No Comments',
     'x_comments' => ':numComments Comments',
     'one_comment' => '1 Comment',
-    'comments_loading' => 'Loading...'
+    'comments_loading' => 'Loading...',
+    'comment_save' => 'Save Comment',
+    'comment_cancel' => 'Cancel'
 ];
\ No newline at end of file
index 74a13edff4fab8e3c5538a05a39cc5e23c807287..16fa2bff043b60e4c9be763c774c18a31c4ce6bc 100644 (file)
@@ -4,7 +4,8 @@
                   @if($errors->has('markdown')) class="neg" @endif>@if(isset($model) ||
                   old('markdown')){{htmlspecialchars( old('markdown') ? old('markdown') : ($model->markdown === '' ? $model->html : $model->markdown))}}@endif</textarea>
         <input type="hidden" ng-model="comment.pageId" name="comment.pageId" value="{{$pageId}}" ng-init="comment.pageId = {{$pageId }}">
-        <button type="submit" class="button pos" ng-click="vm.saveComment(isReply)">Save</button>
+        <button type="button" ng-if="::(isReply || isEdit)" class="button muted" ng-click="closeBox()">{{ trans('entities.comment_cancel') }}</button>
+        <button type="submit" class="button pos" ng-click="vm.saveComment(isReply)">{{ trans('entities.comment_save') }}</button>
     </form>
 </div>
 
Morty Proxy This is a proxified and sanitized view of the page, visit original site.