Commit 6ec8baae authored by Randall Leeds's avatar Randall Leeds

Merge pull request #1084 from RawKStar77/viewandsort

Add V1 viewsort feature
parents 35c97132 1349d235
......@@ -1230,3 +1230,26 @@ h3.stream {
.fadeOut-setup.fadeOut-start{
opacity:0;
}
// View and Sort tabs ////////////////////
.viewsort {
width: 100%;
text-align: center;
position: absolute;
top: 29px;
right: 0;
}
.viewsort > .dropdown {
@include smallshadow(0);
border-bottom-right-radius: 24px 72px;
border-bottom-left-radius: 24px 72px;
font-family: $sansFontFamily;
background: $white;
border: solid 1px $grayLighter;
padding: 0 4px;
margin: 0 3px;
display: inline-block;
z-index: 4;
}
\ No newline at end of file
......@@ -755,6 +755,17 @@ class Viewer
annotator
) ->
{providers, threading} = annotator
$scope.view = 'Screen'
$scope.sort = 'Newest'
$scope.views = [
{view:'Screen'}
{view:'Document'}]
$scope.sorts = [
{sort:'Newest'}
{sort:'Oldest'}
{sort:'Location'}]
$scope.predicate = 'updated'
$scope.reverse = true
$scope.focus = (annotation) ->
if angular.isArray annotation
......@@ -774,6 +785,32 @@ class Viewer
method: 'scrollTo'
params: annotation.$$tag
$scope.applyview = (view) ->
$scope.view = view
if $scope.view == 'Screen'
annotator.updateViewer($rootScope.annotations)
if $scope.view == 'Document'
annotator.updateViewer(annotator.plugins.Store.annotations)
for p in providers
p.channel.notify
method: 'setDynamicBucketMode'
params: $scope.view == 'Screen'
$scope.applysort = (sort) ->
$scope.sort = sort
if $scope.sort == 'Newest'
$scope.predicate = 'updated'
$scope.reverse = true
if $scope.sort == 'Oldest'
$scope.predicate = 'updated'
$scope.reverse = false
if $scope.sort == 'Location'
$scope.predicate = 'target[0].selector[2].start'
$scope.reverse = false
class Search
this.$inject = ['$filter', '$location', '$rootScope', '$routeParams', '$sce', '$scope', 'annotator']
constructor: ($filter, $location, $rootScope, $routeParams, $sce, $scope, annotator) ->
......
......@@ -218,11 +218,11 @@ class Hypothesis extends Annotator
.bind('showViewer', (ctx, ids=[]) =>
return unless this.discardDrafts()
this.showViewer this._getAnnotationsFromIDs ids
$rootScope.$apply => this.showViewer this._getAnnotationsFromIDs ids
)
.bind('updateViewer', (ctx, ids=[]) =>
this.updateViewer this._getAnnotationsFromIDs ids
$rootScope.$apply => this.updateViewer this._getAnnotationsFromIDs ids
)
.bind('setTool', (ctx, name) =>
......@@ -320,7 +320,6 @@ class Hypothesis extends Annotator
($location, $rootScope) =>
@buildReplyList annotations
$rootScope.annotations = annotations
$rootScope.$digest()
]
this
......@@ -333,7 +332,6 @@ class Hypothesis extends Annotator
@buildReplyList annotations
$rootScope.annotations = annotations
$location.path('/viewer').replace()
$rootScope.$digest()
]
this
......
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