Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
b6860bcb
Commit
b6860bcb
authored
Oct 19, 2016
by
Sean Roberts
Committed by
GitHub
Oct 19, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #128 from hypothesis/remove-annotation-ui-controller
Remove AnnotationUIController
parents
28f81290
39c18023
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
6 additions
and
102 deletions
+6
-102
annotation-ui-controller.js
h/static/scripts/annotation-ui-controller.js
+0
-28
app-controller.js
h/static/scripts/app-controller.js
+1
-2
app.js
h/static/scripts/app.js
+0
-1
root-thread.js
h/static/scripts/root-thread.js
+3
-1
annotation-ui-controller-test.js
h/static/scripts/test/annotation-ui-controller-test.js
+0
-67
app-controller-test.js
h/static/scripts/test/app-controller-test.js
+1
-2
root-thread-test.js
h/static/scripts/test/root-thread-test.js
+1
-1
No files found.
h/static/scripts/annotation-ui-controller.js
deleted
100644 → 0
View file @
28f81290
'use strict'
;
var
events
=
require
(
'./events'
);
/** Watch the UI state and update scope properties. */
// @ngInject
function
AnnotationUIController
(
$rootScope
,
$scope
,
annotationUI
)
{
annotationUI
.
subscribe
(
function
()
{
var
state
=
annotationUI
.
getState
();
$scope
.
selectedAnnotations
=
state
.
selectedAnnotationMap
;
if
(
state
.
selectedAnnotationMap
)
{
$scope
.
selectedAnnotationsCount
=
Object
.
keys
(
state
.
selectedAnnotationMap
).
length
;
}
else
{
$scope
.
selectedAnnotationsCount
=
0
;
}
$scope
.
focusedAnnotations
=
state
.
focusedAnnotationMap
;
});
$scope
.
$on
(
events
.
ANNOTATION_DELETED
,
function
(
event
,
annotation
)
{
annotationUI
.
removeSelectedAnnotation
(
annotation
.
id
);
});
}
module
.
exports
=
AnnotationUIController
;
h/static/scripts/app-controller.js
View file @
b6860bcb
...
...
@@ -23,11 +23,10 @@ function authStateFromUserID(userid) {
// @ngInject
module
.
exports
=
function
AppController
(
$
controller
,
$
document
,
$location
,
$rootScope
,
$route
,
$scope
,
$document
,
$location
,
$rootScope
,
$route
,
$scope
,
$window
,
annotationUI
,
auth
,
drafts
,
features
,
frameSync
,
groups
,
serviceUrl
,
session
,
settings
,
streamer
)
{
$controller
(
'AnnotationUIController'
,
{
$scope
:
$scope
});
// This stores information about the current user's authentication status.
// When the controller instantiates we do not yet know if the user is
...
...
h/static/scripts/app.js
View file @
b6860bcb
...
...
@@ -122,7 +122,6 @@ module.exports = angular.module('h', [
'ngRaven'
,
])
.
controller
(
'AnnotationUIController'
,
require
(
'./annotation-ui-controller'
))
.
controller
(
'AnnotationViewerController'
,
require
(
'./annotation-viewer-controller'
))
.
controller
(
'StreamController'
,
require
(
'./stream-controller'
))
.
controller
(
'WidgetController'
,
require
(
'./widget-controller'
))
...
...
h/static/scripts/root-thread.js
View file @
b6860bcb
...
...
@@ -153,7 +153,9 @@ function RootThread($rootScope, annotationUI, drafts, features, searchFilter, vi
// Remove any annotations that are deleted or unloaded
$rootScope
.
$on
(
events
.
ANNOTATION_DELETED
,
function
(
event
,
annotation
)
{
annotationUI
.
removeAnnotations
([
annotation
]);
annotationUI
.
removeSelectedAnnotation
(
annotation
);
if
(
annotation
.
id
)
{
annotationUI
.
removeSelectedAnnotation
(
annotation
.
id
);
}
});
$rootScope
.
$on
(
events
.
ANNOTATIONS_UNLOADED
,
function
(
event
,
annotations
)
{
annotationUI
.
removeAnnotations
(
annotations
);
...
...
h/static/scripts/test/annotation-ui-controller-test.js
deleted
100644 → 0
View file @
28f81290
'use strict'
;
var
angular
=
require
(
'angular'
);
var
annotationUIFactory
=
require
(
'../annotation-ui'
);
describe
(
'AnnotationUIController'
,
function
()
{
var
$scope
;
var
$rootScope
;
var
annotationUI
;
var
sandbox
;
before
(
function
()
{
angular
.
module
(
'h'
,
[])
.
controller
(
'AnnotationUIController'
,
require
(
'../annotation-ui-controller'
));
});
beforeEach
(
angular
.
mock
.
module
(
'h'
));
beforeEach
(
angular
.
mock
.
inject
(
function
(
$controller
,
_$rootScope_
)
{
sandbox
=
sinon
.
sandbox
.
create
();
$rootScope
=
_$rootScope_
;
$scope
=
$rootScope
.
$new
();
$scope
.
search
=
{};
annotationUI
=
annotationUIFactory
(
$rootScope
,
{});
$controller
(
'AnnotationUIController'
,
{
$scope
:
$scope
,
annotationUI
:
annotationUI
,
});
}));
afterEach
(
function
()
{
sandbox
.
restore
();
});
it
(
'updates the view when the selection changes'
,
function
()
{
annotationUI
.
selectAnnotations
([
'1'
,
'2'
]);
assert
.
deepEqual
(
$scope
.
selectedAnnotations
,
{
1
:
true
,
2
:
true
});
});
it
(
'updates the selection counter when the selection changes'
,
function
()
{
annotationUI
.
selectAnnotations
([
'1'
,
'2'
]);
assert
.
deepEqual
(
$scope
.
selectedAnnotationsCount
,
2
);
});
it
(
'clears the selection when no annotations are selected'
,
function
()
{
annotationUI
.
selectAnnotations
([]);
assert
.
deepEqual
(
$scope
.
selectedAnnotations
,
null
);
assert
.
deepEqual
(
$scope
.
selectedAnnotationsCount
,
0
);
});
it
(
'updates the focused annotations when the focus map changes'
,
function
()
{
annotationUI
.
focusAnnotations
([
'1'
,
'2'
]);
assert
.
deepEqual
(
$scope
.
focusedAnnotations
,
{
1
:
true
,
2
:
true
});
});
describe
(
'on annotationDeleted'
,
function
()
{
it
(
'removes the deleted annotation from the selection'
,
function
()
{
annotationUI
.
selectAnnotations
([
'1'
]);
$rootScope
.
$broadcast
(
'annotationDeleted'
,
{
id
:
1
});
assert
.
equal
(
annotationUI
.
getState
().
selectedAnnotationMap
,
null
);
});
});
});
h/static/scripts/test/app-controller-test.js
View file @
b6860bcb
...
...
@@ -45,8 +45,7 @@ describe('AppController', function () {
}));
angular
.
module
(
'h'
,
[])
.
controller
(
'AppController'
,
AppController
)
.
controller
(
'AnnotationUIController'
,
angular
.
noop
);
.
controller
(
'AppController'
,
AppController
);
});
beforeEach
(
angular
.
mock
.
module
(
'h'
));
...
...
h/static/scripts/test/root-thread-test.js
View file @
b6860bcb
...
...
@@ -344,7 +344,7 @@ describe('rootThread', function () {
it
(
'deselects deleted annotations'
,
function
()
{
$rootScope
.
$broadcast
(
events
.
ANNOTATION_DELETED
,
annot
);
assert
.
calledWith
(
fakeAnnotationUI
.
removeSelectedAnnotation
,
annot
);
assert
.
calledWith
(
fakeAnnotationUI
.
removeSelectedAnnotation
,
annot
.
id
);
});
describe
(
'when a new annotation is created'
,
function
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment