Skip to content

NOW MANAGED ON CODEBERG

#47 - Adds a cancel button for edit and reply button.

Abijeet689d1eb08255
diff --git a/resources/assets/js/directives.js b/resources/assets/js/directives.js
index 18217633f..5bd764fa7 100644
--- a/resources/assets/js/directives.js
+++ b/resources/assets/js/directives.js
@@ -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();
+ }
}
}
}]);
diff --git a/resources/lang/en/entities.php b/resources/lang/en/entities.php
index 8480879d6..dd7c54755 100644
--- a/resources/lang/en/entities.php
+++ b/resources/lang/en/entities.php
@@ -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
diff --git a/resources/views/comments/comment-reply.blade.php b/resources/views/comments/comment-reply.blade.php
index 74a13edff..16fa2bff0 100644
--- a/resources/views/comments/comment-reply.blade.php
+++ b/resources/views/comments/comment-reply.blade.php
@@ -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>