Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
jio
Commits
64cc2e3b
Commit
64cc2e3b
authored
May 22, 2015
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Storage: support listbox_uid:list parameters.
Array parameters are converted to multiple FormData.append calls.
parent
1ef272aa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
1 deletion
+55
-1
src/jio.storage/erp5storage.js
src/jio.storage/erp5storage.js
+8
-1
test/jio.storage/erp5storage.tests.js
test/jio.storage/erp5storage.tests.js
+47
-0
No files found.
src/jio.storage/erp5storage.js
View file @
64cc2e3b
...
...
@@ -299,10 +299,17 @@
.
push
(
function
(
evt
)
{
var
form_data
=
JSON
.
parse
(
evt
.
target
.
result
),
data
=
new
FormData
(),
i
,
key
;
for
(
key
in
form_data
)
{
if
(
form_data
.
hasOwnProperty
(
key
))
{
data
.
append
(
key
,
form_data
[
key
]);
if
(
Array
.
isArray
(
form_data
[
key
]))
{
for
(
i
=
0
;
i
<
form_data
[
key
].
length
;
i
+=
1
)
{
data
.
append
(
key
,
form_data
[
key
][
i
]);
}
}
else
{
data
.
append
(
key
,
form_data
[
key
]);
}
}
}
return
jIO
.
util
.
ajax
({
...
...
test/jio.storage/erp5storage.tests.js
View file @
64cc2e3b
...
...
@@ -515,6 +515,53 @@
});
});
test
(
"
putAttachment convert array property
"
,
function
()
{
var
submit_url
=
domain
+
"
/Form_view/Base_edit
"
,
id
=
"
fake
"
,
form_json
=
{
"
multiple_value
"
:
[
"
fooé
"
,
"
barè
"
]
},
context
=
this
,
server
=
this
.
server
;
this
.
server
.
respondWith
(
"
POST
"
,
submit_url
,
[
204
,
{
"
Content-Type
"
:
"
text/xml
"
},
""
]);
stop
();
expect
(
11
);
this
.
jio
.
putAttachment
(
id
,
submit_url
,
new
Blob
([
JSON
.
stringify
(
form_json
)])
)
.
then
(
function
()
{
equal
(
server
.
requests
.
length
,
1
);
equal
(
server
.
requests
[
0
].
method
,
"
POST
"
);
equal
(
server
.
requests
[
0
].
url
,
submit_url
);
equal
(
server
.
requests
[
0
].
status
,
204
);
ok
(
server
.
requests
[
0
].
requestBody
instanceof
FormData
);
ok
(
context
.
spy
.
calledTwice
,
"
FormData.append count
"
+
context
.
spy
.
callCount
);
equal
(
context
.
spy
.
firstCall
.
args
[
0
],
"
multiple_value
"
,
"
First append call
"
);
equal
(
context
.
spy
.
firstCall
.
args
[
1
],
"
fooé
"
,
"
First append call
"
);
equal
(
context
.
spy
.
secondCall
.
args
[
0
],
"
multiple_value
"
,
"
Second append call
"
);
equal
(
context
.
spy
.
secondCall
.
args
[
1
],
"
barè
"
,
"
Second append call
"
);
equal
(
server
.
requests
[
0
].
withCredentials
,
true
);
})
.
fail
(
function
(
error
)
{
ok
(
false
,
error
);
})
.
always
(
function
()
{
start
();
});
});
/////////////////////////////////////////////////////////////////
// erp5Storage.getAttachment
/////////////////////////////////////////////////////////////////
...
...
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