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
dce382e2
Commit
dce382e2
authored
Jan 21, 2016
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small cleanup and documentation improvements for the drafts service
parent
a815f658
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
drafts.js
h/static/scripts/drafts.js
+13
-8
No files found.
h/static/scripts/drafts.js
View file @
dce382e2
...
...
@@ -17,10 +17,13 @@
function
DraftStore
()
{
this
.
_drafts
=
[];
// returns true if 'draft' is a draft for a given
// annotation. Annotations are matched by ID
// and annotation instance (for unsaved annotations
// which have no ID)
/**
* Returns true if 'draft' is a draft for a given
* annotation.
*
* Annotations are matched by ID and annotation instance (for unsaved
* annotations which have no ID)
*/
function
match
(
draft
,
model
)
{
return
draft
.
model
===
model
||
(
draft
.
model
.
id
&&
model
.
id
===
draft
.
model
.
id
);
...
...
@@ -49,11 +52,12 @@ function DraftStore() {
/** Retrieve the draft changes for an annotation. */
this
.
get
=
function
get
(
model
)
{
for
(
var
i
=
0
;
i
<
this
.
_drafts
.
length
;
i
++
)
{
if
(
match
(
this
.
_drafts
[
i
],
model
))
{
var
draft
=
this
.
_drafts
[
i
];
if
(
match
(
draft
,
model
))
{
return
{
isPrivate
:
this
.
_drafts
[
i
]
.
isPrivate
,
tags
:
this
.
_drafts
[
i
]
.
tags
,
text
:
this
.
_drafts
[
i
]
.
text
,
isPrivate
:
draft
.
isPrivate
,
tags
:
draft
.
tags
,
text
:
draft
.
text
,
};
}
}
...
...
@@ -81,6 +85,7 @@ function DraftStore() {
});
};
/** Remove all drafts. */
this
.
discard
=
function
discard
()
{
this
.
_drafts
=
[];
};
...
...
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