Commit 8bcb6d23 authored by Randall Leeds's avatar Randall Leeds

Revert "Merge pull request #2123 from hypothesis/2053-scroll-sidebar-to-new-annotations-2"

This reverts commit 08d991f066e48c0388ff76ce24a611c1f553a096, reversing
changes made to d488f9c491c0334ee4f46210ba17127df169a9e6.
parent d7982a19
...@@ -42,25 +42,6 @@ describe 'thread', -> ...@@ -42,25 +42,6 @@ describe 'thread', ->
describe 'controller', -> describe 'controller', ->
it 'returns true from isNew() for a new annotation', ->
createDirective()
# When the user clicks to create a new annotation in the browser, we get
# a ThreadController with a container with a message (the annotation)
# with no id.
controller.container = {message: {}}
assert(controller.isNew())
it 'returns false from isNew() for an old annotation', ->
createDirective()
# When we create a ThreadController for an old annotation, the controller
# has a container with a message (the annotation) with an id.
controller.container = {message: {id: 123}}
assert(not controller.isNew())
describe '#toggleCollapsed', -> describe '#toggleCollapsed', ->
count = null count = null
......
uuid = require('node-uuid')
###* ###*
# @ngdoc type # @ngdoc type
# @name thread.ThreadController # @name thread.ThreadController
...@@ -138,17 +136,6 @@ ThreadController = [ ...@@ -138,17 +136,6 @@ ThreadController = [
return true return true
return @filter.check(@container) return @filter.check(@container)
###*
# @ngdoc method
# @name thread.ThreadController#isNew
# @description
# Return true if this is a newly-created annotation (e.g. the user has just
# created it by clicking the new annotation button in the browser),
# false otherwise.
###
this.isNew = ->
return (this.id and not this.container?.message?.id)
this._isFilterActive = -> this._isFilterActive = ->
if @filter if @filter
@filter.active() @filter.active()
...@@ -161,8 +148,6 @@ ThreadController = [ ...@@ -161,8 +148,6 @@ ThreadController = [
else else
0 0
this.id = uuid.v4()
this this
] ]
...@@ -189,8 +174,8 @@ isHiddenThread = (elem) -> ...@@ -189,8 +174,8 @@ isHiddenThread = (elem) ->
# Directive that instantiates {@link thread.ThreadController ThreadController}. # Directive that instantiates {@link thread.ThreadController ThreadController}.
### ###
module.exports = [ module.exports = [
'$parse', '$window', '$location', '$anchorScroll', 'pulse', 'render', '$parse', '$window', 'pulse', 'render',
($parse, $window, $location, $anchorScroll, pulse, render) -> ($parse, $window, pulse, render) ->
linkFn = (scope, elem, attrs, [ctrl, counter, filter]) -> linkFn = (scope, elem, attrs, [ctrl, counter, filter]) ->
# We would ideally use require for this, but searching parents only for a # We would ideally use require for this, but searching parents only for a
...@@ -225,10 +210,6 @@ module.exports = [ ...@@ -225,10 +210,6 @@ module.exports = [
render -> render ->
ctrl.container = thread ctrl.container = thread
scope.$digest() scope.$digest()
if ctrl.isNew()
# Scroll the sidebar to show new annotations.
$location.hash(ctrl.id)
$anchorScroll()
controller: ThreadController controller: ThreadController
controllerAs: 'vm' controllerAs: 'vm'
......
...@@ -32,8 +32,7 @@ ...@@ -32,8 +32,7 @@
</ul> </ul>
</span> </span>
</li> </li>
<li id="{{vm.id}}" <li class="paper thread"
class="paper thread"
ng-class="{'js-hover': hasFocus(child.message)}" ng-class="{'js-hover': hasFocus(child.message)}"
deep-count="count" deep-count="count"
thread="child" thread-filter thread="child" thread-filter
......
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