Commit f5be22af authored by Randall Leeds's avatar Randall Leeds

Merge branch '158_reply_count_in_summary_view' into develop

parents 0fdc89e5 1f31cbd5
......@@ -557,6 +557,15 @@ blockquote {
}
}
.reply-count {
.detail .magicontrols & {
display: none;
}
.summary &:after {
content: ' /'
}
}
//SUMMARY////////////////////////////////
......
......@@ -113,15 +113,6 @@ class App
if data.flash? then flash q, msgs for q, msgs of data.flash
if data.status is 'failure' then flash 'error', data.reason
$scope.toggleShow = ->
if annotator.visible
$location.path('').replace()
annotator.hide()
else
if $location.path()?.match '^/?$'
$location.path('/viewer').replace()
annotator.show()
$scope.$watch 'personas', (newValue, oldValue) =>
if newValue?.length
annotator.element.find('#persona')
......@@ -158,6 +149,16 @@ class App
plugins.HypothesisPermissions.setUser(null)
delete plugins.Auth
$scope.$watch 'visible', (newValue) ->
if newValue then annotator.show() else annotator.hide()
$scope.$on 'back', ->
return unless drafts.discard()
if $location.path() == '/viewer' and $location.search()?.id?
$location.search('id', null).replace()
else
$scope.visible = false
$scope.$on 'showAuth', (event, show=true) ->
angular.extend $scope.sheet,
collapsed: !show
......@@ -245,6 +246,15 @@ class Annotation
$scope.editing = true
$scope.unsaved = true
$scope.directChildren = ->
if $scope.$modelValue? and threading.getContainer($scope.$modelValue.id).children?
return threading.getContainer($scope.$modelValue.id).children.length
0
$scope.allChildren = ->
if $scope.$modelValue? and threading.getContainer($scope.$modelValue.id).flattenChildren()?
return threading.getContainer($scope.$modelValue.id).flattenChildren().length
0
class Editor
this.$inject = [
......
......@@ -16,17 +16,17 @@ fuzzyTime = (date) ->
month = day * 30
if (delta < 30)
fuzzy = 'moments ago.'
fuzzy = 'moments ago'
else if (delta < minute)
fuzzy = delta + ' seconds ago.'
fuzzy = delta + ' seconds ago'
else if (delta < 2 * minute)
fuzzy = 'a minute ago.'
fuzzy = 'a minute ago'
else if (delta < hour)
fuzzy = Math.floor(delta / minute) + ' minutes ago.'
fuzzy = Math.floor(delta / minute) + ' minutes ago'
else if (Math.floor(delta / hour) == 1)
fuzzy = '1 hour ago.'
fuzzy = '1 hour ago'
else if (delta < day)
fuzzy = Math.floor(delta / hour) + ' hours ago.'
fuzzy = Math.floor(delta / hour) + ' hours ago'
else if (delta < day * 2)
fuzzy = 'yesterday'
else if (delta < month)
......
......@@ -10,11 +10,6 @@ class Hypothesis extends Annotator
showViewPermissionsCheckbox: false,
userString: (user) -> user.replace(/^acct:(.+)@(.+)$/, '$1 on $2')
# Internal state
detail: false # * Whether the viewer shows a summary or detail listing
visible: false # * Whether the sidebar is visible
unsaved_drafts: [] # * Unsaved drafts currenty open
this.$inject = [
'$document', '$location', '$rootScope',
'threading'
......@@ -82,7 +77,6 @@ class Hypothesis extends Annotator
_setupXDM: ->
$scope = @element.scope()
$location = @element.injector().get '$location'
drafts = @element.injector().get 'drafts'
threading = @element.injector().get 'threading'
@provider = new easyXDM.Rpc
......@@ -199,14 +193,7 @@ class Hypothesis extends Annotator
thread.message?.annotation or a
$scope.$apply => this.showViewer annotations
this.show()
# This guy does stuff when you "back out" of the interface.
# (Currently triggered by a click on the source page.)
back: =>
return unless drafts.discard()
if $location.path() == '/viewer' and $location.search()?.id?
$scope.$apply => $location.search('id', null).replace()
else
this.hide()
back: => $scope.$apply => $scope.$broadcast 'back'
update: => this.publish 'hostUpdated'
remote:
publish: {}
......@@ -340,14 +327,12 @@ class Hypothesis extends Annotator
]
show: =>
@visible = true
@provider.showFrame()
@element.find('#toolbar').addClass('shown')
.find('.tri').attr('draggable', true)
hide: =>
@lastWidth = window.innerWidth
@visible = false
@provider.setActiveHighlights []
@provider.hideFrame()
@element.find('#toolbar').removeClass('shown')
......
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