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

This commit is contained in:
Abijeet 2017-06-04 20:43:56 +05:30
parent 06d75e1804
commit 689d1eb082
3 changed files with 16 additions and 5 deletions

View 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();
}
}
}
}]);

View 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'
];

View 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>