Commit 9ebb9662 authored by Randall Leeds's avatar Randall Leeds

Compute share link in the appropriate watcher

It makes more sense to compute this when its value changes, rather
than at the time the share button is toggled
parent e420cba9
......@@ -563,6 +563,16 @@ class Annotation
if drafts.contains $scope.model
$scope.editing = true
# XXX: This should be done some other way since we should not assume
# the annotation share URL is in any particular path relation to the
# app base URL. It's time to start reflecting routes, I think. I'm
# just not sure how best to do that with pyramid traversal since there
# is not a pre-determined route map. One possibility would be to
# unify everything so that it's relative to the app URL.
prefix = baseURI.replace /\/\w+\/?$/, ''
$scope.shared_link = prefix + '/a/' + $scope.model.id
$scope.$watch 'model.target', (targets) ->
return unless targets
for target in targets
......@@ -577,15 +587,6 @@ class Annotation
if newValue? is true
$timeout -> $element.find('input').focus()
$timeout -> $element.find('input').select()
# XXX: This should be done some other way since we should not assume
# the annotation share URL is in any particular path relation to the
# app base URL. It's time to start reflecting routes, I think. I'm
# just not sure how best to do that with pyramid traversal since there
# is not a pre-determined route map. One possibility would be to
# unify everything so that it's relative to the app URL.
prefix = baseURI.replace /\/\w+\/?$/, ''
$scope.shared_link = prefix + '/a/' + $scope.model.id
$scope.shared = false
return
......
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