Add cancel buttons for comments

This commit is contained in:
James Allen 2016-11-09 15:51:40 +00:00
parent 1622269d1b
commit c5532bd8a3
2 changed files with 12 additions and 1 deletions

View file

@ -62,12 +62,14 @@ div.full-size(
div(ng-if="entry.replying") div(ng-if="entry.replying")
textarea(ng-model="entry.replyContent") textarea(ng-model="entry.replyContent")
a.btn.btn-sm.btn-primary(href, ng-click="submitReply(entry)") Submit a.btn.btn-sm.btn-primary(href, ng-click="submitReply(entry)") Submit
a(href, ng-click="cancelReply(entry)") X
a.btn.btn-sm.btn-primary(href, ng-click="startReply(entry)", ng-if="!entry.replying") Reply a.btn.btn-sm.btn-primary(href, ng-click="startReply(entry)", ng-if="!entry.replying") Reply
div(ng-if="entry.type == 'focus-position'") div(ng-if="entry.type == 'focus-position'")
a.btn.btn-sm(href, ng-if="!commentState.adding", ng-click="startNewComment()") Add comment a.btn.btn-sm(href, ng-if="!commentState.adding", ng-click="startNewComment()") Add comment
div(ng-if="commentState.adding") div(ng-if="commentState.adding")
textarea(ng-model="commentState.content") textarea(ng-model="commentState.content")
a.btn.btn-sm.btn-primary(href, ng-click="submitNewComment()") Submit a.btn.btn-sm.btn-primary(href, ng-click="submitNewComment()") Submit
a(href, ng-click="cancelNewComment()") X
.ui-layout-east .ui-layout-east
div(ng-if="ui.pdfLayout == 'sideBySide'") div(ng-if="ui.pdfLayout == 'sideBySide'")

View file

@ -70,8 +70,12 @@ define [
$scope.commentState.content = "" $scope.commentState.content = ""
$scope.$broadcast "review-panel:layout" $scope.$broadcast "review-panel:layout"
$scope.cancelNewComment = (entry) ->
$scope.commentState.adding = false
$scope.commentState.content = ""
$scope.$broadcast "review-panel:layout"
$scope.startReply = (entry) -> $scope.startReply = (entry) ->
console.log "Start new reply"
entry.replying = true entry.replying = true
$scope.$broadcast "review-panel:layout" $scope.$broadcast "review-panel:layout"
@ -83,4 +87,9 @@ define [
} }
entry.replyContent = "" entry.replyContent = ""
entry.replying = false entry.replying = false
$scope.$broadcast "review-panel:layout"
$scope.cancelReply = (entry) ->
entry.replying = false
entry.replyContent = ""
$scope.$broadcast "review-panel:layout" $scope.$broadcast "review-panel:layout"