Commit 9be50963 authored by Robert Knight's avatar Robert Knight

Avoid scrolling the page when expanding/collapsing excerpts

Stop propagation of the click event in the 'More'/'Less'
links which would otherwise bubble up to the
annotation card and scroll the page to that annotation.
parent 58f66c69
...@@ -587,6 +587,11 @@ function AnnotationController( ...@@ -587,6 +587,11 @@ function AnnotationController(
} }
}; };
vm.toggleCollapseBody = function(event) {
event.stopPropagation();
vm.collapseBody = !vm.collapseBody;
};
/** /**
* @ngdoc method * @ngdoc method
* @name annotation.AnnotationController#reply * @name annotation.AnnotationController#reply
......
...@@ -21,7 +21,8 @@ function ExcerptController() { ...@@ -21,7 +21,8 @@ function ExcerptController() {
return this.overflowing() && !this.collapse; return this.overflowing() && !this.collapse;
}; };
this.toggle = function () { this.toggle = function (event) {
event.stopPropagation();
this.collapse = !this.collapse; this.collapse = !this.collapse;
}; };
......
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
</ul> </ul>
<div class="u-stretch"></div> <div class="u-stretch"></div>
<a class="annotation-link u-strong" ng-show="vm.canCollapseBody" <a class="annotation-link u-strong" ng-show="vm.canCollapseBody"
ng-click="vm.collapseBody = !vm.collapseBody" ng-click="vm.toggleCollapseBody($event)"
ng-title="vm.collapseBody ? 'Show the full annotation text' : 'Show the first few lines only'" ng-title="vm.collapseBody ? 'Show the full annotation text' : 'Show the first few lines only'"
ng-bind="vm.collapseBody ? 'More' : 'Less'"></a> ng-bind="vm.collapseBody ? 'More' : 'Less'"></a>
</div> </div>
......
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
title="Show the full excerpt">More</a> title="Show the full excerpt">More</a>
</span> </span>
<span class="excerpt__toggle-link" ng-show="vm.isCollapsible()"> <span class="excerpt__toggle-link" ng-show="vm.isCollapsible()">
<a ng-click="vm.toggle()" <a ng-click="vm.toggle($event)"
title="Show the first few lines only">Less</a> title="Show the first few lines only">Less</a>
</span> </span>
</div> </div>
</div> </div>
<div ng-click="vm.toggle()" <div ng-click="vm.toggle($event)"
ng-class="vm.bottomShadowStyles()" ng-class="vm.bottomShadowStyles()"
title="Show the full excerpt"></div> title="Show the full excerpt"></div>
</div> </div>
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