Commit d30020eb authored by Nick Stenning's avatar Nick Stenning Committed by Randall Leeds

Make "collapsed" refer only to a thread's replies

The meaning of "collapsed" in the context of a thread was immensely
confusing:

- on a top-level annotation card it referred to whether replies were or
  were not shown
- on a reply, it referred to whether or not the entire annotation was
  hidden

This change removes all reference to the latter meaning. Annotations
(and replies) are still hidden appropriately when searches are
performed, but now collapsing and uncollapsing refers only to the
visibility of the *replies* of the addressed thread.
parent be2abd94
### global -COLLAPSED_CLASS ###
COLLAPSED_CLASS = 'thread-collapsed'
###*
# @ngdoc type
# @name thread.ThreadController
......@@ -85,10 +81,6 @@ isHiddenThread = (elem) ->
# @restrict A
# @description
# Directive that instantiates {@link thread.ThreadController ThreadController}.
#
# If the `thread-collapsed` attribute is specified, it is treated as an
# expression to watch in the context of the current scope that controls
# the collapsed state of the thread.
###
thread = [
'$parse', '$window', 'pulse', 'render',
......@@ -136,13 +128,6 @@ thread = [
event.stopPropagation()
pulse(elem)
# Add and remove the collapsed class when the collapsed property changes.
scope.$watch (-> ctrl.collapsed), (collapsed) ->
if collapsed
attrs.$addClass COLLAPSED_CLASS
else
attrs.$removeClass COLLAPSED_CLASS
# The watch is necessary because the computed value of the attribute
# expression may change. This won't happen when we use the thread
# directive in a repeat, since the element will be torn down whenever the
......@@ -156,11 +141,6 @@ thread = [
ctrl.container = thread
scope.$digest()
# Watch the thread-collapsed attribute.
if attrs.threadCollapsed
scope.$watch $parse(attrs.threadCollapsed), (collapsed) ->
ctrl.toggleCollapsed(collapsed)
controller: 'ThreadController'
controllerAs: 'vm'
link: linkFn
......
......@@ -20,11 +20,6 @@ $threadexp-width: .6em;
.thread:first-child {
margin-top: 0.5em;
}
.thread-collapsed {
.tag-list, .annotation-body {display: none;}
.thread-reply { margin-top: 0 }
}
}
.thread-reply {
......@@ -62,14 +57,6 @@ $threadexp-width: .6em;
border-left: 1px dotted $gray-light;
padding: 0;
padding-left: $thread-padding;
&.thread-collapsed {
border-color: transparent;
& > article markdown {
display: none;
}
}
}
.threadexp {
......@@ -96,19 +83,6 @@ $threadexp-width: .6em;
}
}
}
&.thread-collapsed {
& > ul {
display: none;
}
& > .thread-message {
.thread &,
.thread & .annotation-header,
.thread & .annotation-section { margin: 0 }
.thread & footer { display: none }
}
}
}
.thread-message {
......
......@@ -36,13 +36,12 @@
</div>
<!-- Replies -->
<ul class="thread-replies">
<ul class="thread-replies" ng-hide="vm.collapsed">
<li class="thread"
deep-count="count"
thread="child" thread-filter
ng-include="'thread.html'"
ng-init="child.message.id || threadFilter.active(false)"
ng-class="{'thread-collapsed': vm.collapsed}"
ng-repeat="child in vm.container.children
| orderBy : 'message.updated' : true"
ng-show="count('edit') || count('match') || !threadFilter.active()">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment