Integrate new directive, plumb data into it. More styling.

This commit is contained in:
Paulo Reis 2017-01-06 12:00:17 +00:00
parent f2e6e69df6
commit 42585085c0
4 changed files with 76 additions and 22 deletions

View file

@ -3,6 +3,7 @@
resolved-comments-dropdown(
entries="reviewPanel.entries"
threads="reviewPanel.commentThreads"
docs="docs"
)
span.review-panel-toolbar-label(ng-click="editor.wantTrackChanges = true;", ng-if="editor.wantTrackChanges === false") Track Changes is
strong off
@ -162,11 +163,6 @@ script(type='text/ng-template', id='commentEntryTemplate')
stop-propagation="click"
placeholder="{{ 'Hit \"Enter\" to reply' + (entry.resolved ? ' and re-open' : '') }}"
)
//- .rp-comment-resolved-description(ng-if="threads[entry.thread_id].resolved && !entry.showWhenResolved")
//- div
//- | Comment resolved by
//- span(style="color: hsl({{ threads[entry.thread_id].resolved_by_user.hue }}, 70%, 40%);") {{ threads[entry.thread_id].resolved_by_user.name }}
//- div {{ threads[entry.thread_id].resolved_at | date : 'MMM d, y h:mm a' }}
.rp-entry-actions
a.rp-entry-button(href, ng-click="onResolve();")
i.fa.fa-inbox
@ -174,15 +170,31 @@ script(type='text/ng-template', id='commentEntryTemplate')
a.rp-entry-button(href, ng-click="onReply();")
i.fa.fa-reply
|  Reply
//- a.rp-entry-button(href, ng-click="onShowThread();", ng-if="threads[entry.thread_id].resolved && !entry.showWhenResolved")
//- |  Show
//- a.rp-entry-button(href, ng-click="onHideThread();", ng-if="threads[entry.thread_id].resolved && entry.showWhenResolved")
//- |  Hide
//- a.rp-entry-button(href, ng-click="onUnresolve();", ng-if="threads[entry.thread_id].resolved")
//- |  Re-open
//- a.rp-entry-button(href, ng-click="onDelete();", ng-if="threads[entry.thread_id].resolved")
//- |  Delete
script(type='text/ng-template', id='resolvedCommentEntryTemplate')
.rp-entry.rp-entry-comment
div
.rp-comment-context
| Quoted text on 
.rp-comment-context-file {{ doc.doc.name }}
.rp-comment-context-quote {{ thread.content }}
.rp-comment(
ng-repeat="comment in thread.messages track by comment.id"
)
p.rp-comment-content
span.rp-entry-user(
style="color: hsl({{ comment.user.hue }}, 70%, 40%);"
ng-if="$first || comment.user.id !== thread.messages[$index - 1].user.id"
) {{ comment.user.name }}: 
| {{ comment.content }}
.rp-entry-metadata
| {{ comment.timestamp | date : 'MMM d, y h:mm a' }}
.rp-entry-actions
a.rp-entry-button(href, ng-click="onUnresolve();")
|  Re-open
a.rp-entry-button(href, ng-click="onDelete();")
|  Delete
script(type='text/ng-template', id='addCommentEntryTemplate')
div
@ -222,6 +234,10 @@ script(type='text/ng-template', id='addCommentEntryTemplate')
script(type='text/ng-template', id='resolvedCommentsDropdownTemplate')
.resolved-comments
.resolved-comments-backdrop(
ng-class="{ 'resolved-comments-backdrop-visible' : state.isOpen }"
ng-click="state.isOpen = !state.isOpen"
)
a.resolved-comments-toggle(
href
ng-click="state.isOpen = !state.isOpen"
@ -230,4 +246,12 @@ script(type='text/ng-template', id='resolvedCommentsDropdownTemplate')
.resolved-comments-dropdown(
ng-class="{ 'resolved-comments-dropdown-open' : state.isOpen }"
)
div wut
div(
ng-repeat="doc in docs"
)
resolved-comment-entry(
ng-repeat="thread in resolvedCommentsPerFile[doc.doc.id]"
thread="thread"
doc="doc"
)

View file

@ -5,6 +5,7 @@ define [
"ide/review-panel/directives/changeEntry"
"ide/review-panel/directives/commentEntry"
"ide/review-panel/directives/addCommentEntry"
"ide/review-panel/directives/resolvedCommentEntry"
"ide/review-panel/directives/resolvedCommentsDropdown"
"ide/review-panel/filters/notEmpty"
"ide/review-panel/filters/orderOverviewEntries"

View file

@ -5,22 +5,27 @@ define [
restrict: "E"
templateUrl: "resolvedCommentsDropdownTemplate"
scope:
entries: "="
threads: "="
entries : "="
threads : "="
docs : "="
link: (scope, element, attrs) ->
scope.state =
isOpen: false
scope.resolvedComments = {}
scope.resolvedCommentsPerFile = {}
filterResolvedComments = () ->
scope.resolvedComments = {}
scope.resolvedCommentsPerFile = {}
for fileId, fileEntries of scope.entries
scope.resolvedComments[fileId] = {}
scope.resolvedCommentsPerFile[fileId] = {}
for entryId, entry of fileEntries
if entry.type == "comment" and scope.threads[entry.thread_id].resolved?
scope.resolvedComments[fileId][entryId] = scope.threads[entry.thread_id]
scope.resolvedCommentsPerFile[fileId][entryId] = angular.copy scope.threads[entry.thread_id]
scope.resolvedCommentsPerFile[fileId][entryId].content = entry.content
console.log scope.resolvedCommentsPerFile
scope.$watchCollection "entries", filterResolvedComments
scope.$watchCollection "threads", filterResolvedComments

View file

@ -230,6 +230,10 @@
border-bottom: solid 1px @rp-border-grey;
cursor: pointer;
}
.resolved-comments-dropdown & {
position: static;
margin-bottom: 5px;
}
border-left: solid @rp-entry-ribbon-width transparent;
border-radius: 3px;
@ -649,9 +653,29 @@
}
}
.resolved-comments-backdrop {
display: none;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: rgba(0, 0, 0, .5);
&-visible {
display: block;
}
}
.resolved-comments-dropdown {
display: none;
position: absolute;
width: 300px;
background-color: @rp-bg-blue;
text-align: left;
padding: 5px;
border-radius: 3px;
&-open {
display: block;
}