Avoid empty comment replies.

This commit is contained in:
Paulo Reis 2017-01-16 17:06:57 +00:00
parent 1c8942c5c6
commit 121629426e
3 changed files with 25 additions and 5 deletions

View file

@ -195,10 +195,16 @@ script(type='text/ng-template', id='commentEntryTemplate')
placeholder="{{ 'Hit \"Enter\" to reply' + (entry.resolved ? ' and re-open' : '') }}"
)
.rp-entry-actions
a.rp-entry-button(href, ng-click="animateAndCallOnResolve();", ng-if="permissions.comment && permissions.write")
button.rp-entry-button(
ng-click="animateAndCallOnResolve();"
ng-if="permissions.comment && permissions.write"
)
i.fa.fa-inbox
|  Resolve
a.rp-entry-button(href, ng-click="onReply();", ng-if="permissions.comment")
button.rp-entry-button(
ng-click="onReply();"
ng-if="permissions.comment"
ng-disabled="!entry.replyContent.length")
i.fa.fa-reply
|  Reply
@ -214,7 +220,7 @@ script(type='text/ng-template', id='resolvedCommentEntryTemplate')
href
ng-if="needsCollapsing"
ng-click="toggleCollapse();"
)  {{ isCollapsed ? '(more)' : '(less)' }}
)  {{ isCollapsed ? '... (show all)' : ' (show less)' }}
.rp-comment(
ng-repeat="comment in thread.messages track by comment.id"
)

View file

@ -18,8 +18,9 @@ define [
scope.handleCommentReplyKeyPress = (ev) ->
if ev.keyCode == 13 and !ev.shiftKey and !ev.ctrlKey and !ev.metaKey
ev.preventDefault()
ev.target.blur()
scope.onReply()
if scope.entry.length > 0
ev.target.blur()
scope.onReply()
scope.animateAndCallOnResolve = () ->
scope.state.animating = true

View file

@ -36,12 +36,25 @@
color: #FFF;
text-align: center;
line-height: 1.3;
user-select: none;
border: 0;
&:hover,
&:focus {
outline: 0;
background-color: darken(@rp-highlight-blue, 5%);
text-decoration: none;
color: #FFF;
}
&[disabled] {
opacity: 0.5;
&:hover,
&:focus {
background-color: @rp-highlight-blue;
}
}
}
.triangle(@_, @width, @height, @color) {