Commit 0f0bf3e3 authored by Randall Leeds's avatar Randall Leeds

re-implement showViewer on the XDM RPC

parent 73aad9a8
......@@ -338,7 +338,7 @@ class Viewer
$scope.detail = false
$scope.focus $scope.annotations
if $routeParams.bucket?
if $routeParams.bucket? and $routeParams.bucket > 0
$scope.annotations = heatmap.buckets[$routeParams.bucket]
else
unless $scope.detail
......
......@@ -140,6 +140,7 @@ class Annotator.Host extends Annotator
addPlugin: {}
createAnnotation: {}
showEditor: {}
showViewer: {}
back: {}
update: {}
......
......@@ -158,7 +158,6 @@ class Hypothesis extends Annotator
this.show()
null
showEditor: (annotation) =>
return unless this._canCloseUnsaved()
thread = (threading.getContainer annotation.id)
if thread.message?.annotation
angular.extend thread.message.annotation, annotation
......@@ -168,6 +167,11 @@ class Hypothesis extends Annotator
id: annotation.id
references: annotation.thread?.split('/')
this.showEditor thread.message.annotation
showViewer: (annotations) =>
annotations = for a in annotations
thread = (threading.getContainer a.id)
thread.message?.annotation or a
this.showViewer annotations
# This guy does stuff when you "back out" of the interface.
# (Currently triggered by a click on the source page.)
back: =>
......@@ -319,13 +323,23 @@ class Hypothesis extends Annotator
id: annotation.id
ranges: annotation.ranges
showViewer: (annotations=[], detail=false) =>
if (@visible and not detail) or @unsaved_drafts.indexOf(@editor) > -1
if not this._canCloseUnsaved() then return
# Not implemented
showViewer: (annotations=[]) =>
return unless this._canCloseUnsaved()
@element.injector().invoke [
'$location', '$rootScope', '$route',
($location, $rootScope, $route) =>
$rootScope.$apply =>
$location.path('/viewer')
.search
bucket: -1
.replace()
$route.current.scope.annotations = annotations
$route.current.scope.$digest()
]
this.show()
showEditor: (annotation) =>
return unless this._canCloseUnsaved()
@element.injector().invoke [
'$location', '$rootScope',
($location, $rootScope) =>
......
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