Commit 480e1bae authored by Sean Roberts's avatar Sean Roberts Committed by GitHub

Merge pull request #212 from hypothesis/update-docs

Add examples in docs for sidebar trigger and annotation count display.
parents 07a12c17 5cb22b42
# Interacting with the sidebar
## Show the sidebar:
If you need to have a custom trigger on your third party page to bring up the embedded Hypothesis
sidebar, add the `data-hypothesis-trigger` attribute to the element that you want to enable.
Clicking that element will cause the sidebar to open.
Note, however, subsequent clicks do not hide the sidebar.
Example:
To add a `button` on a page to open the sidebar, simply
add the `data-hypothesis-trigger` attribute.
```html
<button data-hypothesis-trigger>
Open sidebar
</button>
```
## Show the public annotation count:
If you need to show the total number of public annotations, page notes and orphaned annotations
on your third party page where the Hypothesis sidebar is embedded, add the `data-hypothesis-annotation-count`
attribute to the element that you want to enable.
The contents of the enabled element will be replaced with the count of public annotations and if there are no
public annotations, with 0.
Example:
To display the annotation count in a `div` element, simply
add the `data-hypothesis-annotation-count` attribute to the `div`:
```html
<div data-hypothesis-annotation-count>
Annotation count will appear here
</div>
```
......@@ -264,8 +264,7 @@ describe('annotation-metadata', function () {
}]);
it('returns false if an annotation is missing permissions', function () {
var annotation = Object.assign(fixtures.defaultAnnotation());
assert.isFalse(annotationMetadata.isPublic(annotation));
assert.isFalse(annotationMetadata.isPublic(fixtures.defaultAnnotation()));
});
});
......
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