Commit 5de7bf86 authored by Sean Hammond's avatar Sean Hammond

Just pass isSidebar into AnnotationController normally

It does not change after directive linking, there's no reason to
$observe() it.
parent e13a0492
...@@ -163,7 +163,10 @@ function AnnotationController( ...@@ -163,7 +163,10 @@ function AnnotationController(
vm.action = 'view'; vm.action = 'view';
vm.document = null; vm.document = null;
vm.editing = false; vm.editing = false;
vm.isSidebar = false; // Copy isSidebar from $scope onto vm for consistency (we want this
// directive's templates to always access variables from vm rather than
// directly from scope).
vm.isSidebar = $scope.isSidebar;
vm.preview = 'no'; vm.preview = 'no';
vm.timestamp = null; vm.timestamp = null;
...@@ -629,14 +632,6 @@ function annotation($document, features) { ...@@ -629,14 +632,6 @@ function annotation($document, features) {
var threadFilter = controllers[2]; var threadFilter = controllers[2];
var counter = controllers[3]; var counter = controllers[3];
attrs.$observe('isSidebar', function(value) {
if (value && value !== 'false') {
ctrl.isSidebar = true;
} else {
ctrl.isSidebar = false;
}
});
// Save on Meta + Enter or Ctrl + Enter. // Save on Meta + Enter or Ctrl + Enter.
elem.on('keydown', function(event) { elem.on('keydown', function(event) {
if (event.keyCode === 13 && (event.metaKey || event.ctrlKey)) { if (event.keyCode === 13 && (event.metaKey || event.ctrlKey)) {
...@@ -711,7 +706,8 @@ function annotation($document, features) { ...@@ -711,7 +706,8 @@ function annotation($document, features) {
isLastReply: '=', isLastReply: '=',
replyCount: '@annotationReplyCount', replyCount: '@annotationReplyCount',
replyCountClick: '&annotationReplyCountClick', replyCountClick: '&annotationReplyCountClick',
showReplyCount: '@annotationShowReplyCount' showReplyCount: '@annotationShowReplyCount',
isSidebar: '='
}, },
templateUrl: 'annotation.html' templateUrl: 'annotation.html'
}; };
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
name="annotation" name="annotation"
annotation="vm.container.message" annotation="vm.container.message"
is-last-reply="$last" is-last-reply="$last"
is-sidebar="{{isSidebar}}" is-sidebar="isSidebar"
annotation-show-reply-count="{{vm.shouldShowNumReplies()}}" annotation-show-reply-count="{{vm.shouldShowNumReplies()}}"
annotation-reply-count="{{vm.numReplies()}}" annotation-reply-count="{{vm.numReplies()}}"
annotation-reply-count-click="vm.toggleCollapsed()" annotation-reply-count-click="vm.toggleCollapsed()"
......
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