Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Stefane Fermigier
jio
Commits
f19a4f95
Commit
f19a4f95
authored
Dec 27, 2012
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix test bugs on jio localstorage.js
parent
b94e9b36
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
21 deletions
+40
-21
src/jio.storage/localstorage.js
src/jio.storage/localstorage.js
+40
-21
No files found.
src/jio.storage/localstorage.js
View file @
f19a4f95
...
...
@@ -194,7 +194,7 @@ var newLocalStorage = function (spec, my) {
doc
);
that
.
success
({
"
ok
"
:
true
,
"
_
id
"
:
command
.
getDocId
()
+
"
/
"
+
command
.
getAttachmentId
()
"
id
"
:
command
.
getDocId
()
+
"
/
"
+
command
.
getAttachmentId
()
});
});
};
...
...
@@ -249,38 +249,57 @@ var newLocalStorage = function (spec, my) {
*/
that
.
remove
=
function
(
command
)
{
setTimeout
(
function
()
{
var
doc
;
var
doc
,
error
;
error
=
function
(
word
)
{
that
.
error
({
"
status
"
:
404
,
"
statusText
"
:
"
Not Found
"
,
"
error
"
:
"
not_found
"
,
"
message
"
:
word
+
"
not found
"
,
"
reason
"
:
"
missing
"
});
};
doc
=
localstorage
.
getItem
(
priv
.
localpath
+
"
/
"
+
command
.
getDocId
());
if
(
typeof
command
.
getAttachmentId
()
===
"
string
"
)
{
// seeking for an attachment
localstorage
.
removeItem
(
priv
.
localpath
+
"
/
"
+
command
.
getDocId
()
+
"
/
"
+
command
.
getAttachmentId
());
// remove attachment from document
if
(
doc
!==
null
&&
typeof
doc
===
"
object
"
&&
typeof
doc
[
"
_attachments
"
]
===
"
object
"
)
{
delete
doc
[
"
_attachments
"
][
command
.
getAttachmentId
()];
if
(
priv
.
objectIsEmpty
(
doc
[
"
_attachments
"
]))
{
delete
doc
[
"
_attachments
"
];
if
(
typeof
doc
[
"
_attachments
"
][
command
.
getAttachmentId
()]
===
"
object
"
)
{
delete
doc
[
"
_attachments
"
][
command
.
getAttachmentId
()];
if
(
priv
.
objectIsEmpty
(
doc
[
"
_attachments
"
]))
{
delete
doc
[
"
_attachments
"
];
}
localstorage
.
setItem
(
priv
.
localpath
+
"
/
"
+
command
.
getDocId
(),
doc
);
localstorage
.
removeItem
(
priv
.
localpath
+
"
/
"
+
command
.
getDocId
()
+
"
/
"
+
command
.
getAttachmentId
());
that
.
success
({
"
ok
"
:
true
,
"
id
"
:
command
.
getDocId
()
+
"
/
"
+
command
.
getAttachmentId
()
});
}
else
{
error
(
"
Attachment
"
);
}
localstorage
.
setItem
(
priv
.
localpath
+
"
/
"
+
command
.
getDocId
(),
doc
);
}
else
{
error
(
"
Document
"
);
}
that
.
success
({
"
ok
"
:
true
,
"
id
"
:
command
.
getDocId
()
+
"
/
"
+
command
.
getAttachmentId
()
});
}
else
{
// seeking for a document
var
attachment_list
=
[],
i
;
if
(
doc
!==
null
&&
typeof
doc
===
"
object
"
&&
typeof
doc
[
"
_attachments
"
]
===
"
object
"
)
{
// prepare list of attachments
for
(
i
in
doc
[
"
_attachments
"
])
{
attachment_list
.
push
(
i
);
if
(
doc
!==
null
&&
typeof
doc
===
"
object
"
)
{
if
(
typeof
doc
[
"
_attachments
"
]
===
"
object
"
)
{
// prepare list of attachments
for
(
i
in
doc
[
"
_attachments
"
])
{
attachment_list
.
push
(
i
);
}
}
}
else
{
return
error
(
"
Document
"
);
}
localstorage
.
removeItem
(
priv
.
localpath
+
"
/
"
+
command
.
getDocId
());
...
...
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