Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
ecommerce-ui
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
nexedi
ecommerce-ui
Commits
32a5a0fd
Commit
32a5a0fd
authored
Mar 06, 2014
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added status messages indicating loading of records/config
parent
e468c03e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
99 deletions
+8
-99
js/erp5_loader.js
js/erp5_loader.js
+6
-99
lang/en-EN/dict.json
lang/en-EN/dict.json
+2
-0
No files found.
js/erp5_loader.js
View file @
32a5a0fd
...
@@ -5034,6 +5034,7 @@
...
@@ -5034,6 +5034,7 @@
"
_jump
"
:
pointer
"
_jump
"
:
pointer
};
};
}
}
return
RSVP
.
resolve
(
return
RSVP
.
resolve
(
app
.
storage_dict
.
items
[
method
||
"
allDocs
"
](
query
,
config
)
app
.
storage_dict
.
items
[
method
||
"
allDocs
"
](
query
,
config
)
).
then
(
function
(
response
)
{
).
then
(
function
(
response
)
{
...
@@ -5055,6 +5056,8 @@
...
@@ -5055,6 +5056,8 @@
* @method write
* @method write
* @param {object} obj Action object
* @param {object} obj Action object
*/
*/
// TODO: storage.add included prefetch of field_items and validation
// TODO: storage.add deleted identifier if create_new was set
storage
.
write
=
function
(
obj
)
{
storage
.
write
=
function
(
obj
)
{
var
form
,
data
,
valid
,
prefix
,
config
,
method
,
action
,
pointer
,
id
;
var
form
,
data
,
valid
,
prefix
,
config
,
method
,
action
,
pointer
,
id
;
...
@@ -5359,105 +5362,6 @@
...
@@ -5359,105 +5362,6 @@
}
}
};
};
/**
* add a new item to a storage
* @method add
* @param {object} config Action Object
*/
// NOTE: we always validate! to skip validation test for class on form
// TODO: generate common promise handler for add/remove/clone/export/etc
// TODO: make form validation and captcha generic
storage
.
add
=
function
(
config
)
{
var
property
,
replace
,
obj
,
value
,
form_to_submit
,
valid
,
pass_id
,
validate_portal_type_fields
,
decode
,
data
;
form_to_submit
=
document
.
getElementById
(
config
.
id
);
valid
=
storage
.
validate
(
config
);
if
(
valid
===
undefined
)
{
util
.
loader
(
""
,
"
validation_dict.general
"
,
"
ban-circle
"
);
// form is valid and not "spam"
}
else
{
replace
=
form_to_submit
.
id
+
"
_
"
;
obj
=
{};
// force portal_type
if
(
config
.
gadget
.
state
.
force_type
)
{
config
.
gadget
.
state
.
type
=
config
.
gadget
.
state
.
force_type
;
validate_portal_type_fields
=
true
;
}
// force formData
if
(
config
.
gadget
.
state
.
force_formdata
)
{
data
=
storage
.
parseForm
(
valid
,
replace
);
}
else
{
for
(
property
in
valid
)
{
if
(
valid
.
hasOwnProperty
(
property
))
{
value
=
valid
[
property
];
// prepare to store
if
(
property
!==
"
undefined
"
)
{
obj
[
property
.
replace
(
replace
,
""
)]
=
value
;
}
}
}
}
// force new
if
(
config
.
gadget
.
state
.
create_new
)
{
delete
obj
.
identifier
;
}
util
.
loader
(
""
,
"
status_dict.saving
"
);
// TODO: a post should always include all required fields
// TODO: find a way to set default fields, like timestamp etc
app
.
store
({
"
response
"
:
[
obj
],
"
pass
"
:
{
"
type
"
:
config
.
gadget
.
state
.
type
,
"
reply
"
:
true
,
"
validate_type
"
:
validate_portal_type_fields
,
// hacked view
"
view
"
:
config
.
gadget
.
state
.
view
,
"
form_data
"
:
data
||
undefined
,
"
fetch
"
:
config
.
gadget
.
state
.
url_pointer
}
})
.
then
(
function
(
answer
)
{
if
(
answer
.
response
&&
answer
.
response
.
result
===
"
success
"
)
{
pass_id
=
answer
.
response
.
id
;
switch
(
config
.
gadget
.
getAttribute
(
"
data-reset
"
))
{
case
"
login_state
"
:
app
.
setLoginStatus
(
answer
.
response
,
config
.
portal_type_source
);
break
;
}
util
.
loader
(
""
,
"
status_dict.saved
"
,
"
check
"
);
return
pass_id
;
}
// install new instance
if
(
answer
.
response
&&
answer
.
response
.
location
)
{
return
jIO
.
util
.
ajax
({
"
url
"
:
answer
.
response
.
location
,
"
xhrFields
"
:
{
"
withCredentials
"
:
true
}
})
.
then
(
function
(
instance_location
)
{
return
util
.
parse
(
instance_location
.
target
.
responseText
).
_relative_url
;
}).
fail
(
util
.
error
);
}
})
.
then
(
function
(
id
)
{
decode
=
/^
[^\/]
*%2
[^\/]
*$/
.
test
(
id
);
if
(
id
&&
config
.
state
.
callback
)
{
$
.
mobile
.
changePage
(
config
.
state
.
callback
.
replace
(
"
__id__
"
,
decode
?
id
:
window
.
encodeURIComponent
(
id
)));
}
})
.
fail
(
util
.
error
);
}
};
/* ====================================================================== */
/* ====================================================================== */
/* FLUX */
/* FLUX */
/* ====================================================================== */
/* ====================================================================== */
...
@@ -6703,6 +6607,7 @@
...
@@ -6703,6 +6607,7 @@
// get an item?
// get an item?
if
(
pass
.
mode
!==
"
new
"
||
pass
.
config
.
initial_query
!==
undefined
)
{
if
(
pass
.
mode
!==
"
new
"
||
pass
.
config
.
initial_query
!==
undefined
)
{
util
.
loader
(
""
,
"
status_dict.loading_set
"
);
return
storage
.
fetch
({
return
storage
.
fetch
({
"
storage
"
:
"
items
"
,
"
storage
"
:
"
items
"
,
"
query
"
:
pass
.
state
.
query
,
"
query
"
:
pass
.
state
.
query
,
...
@@ -6786,6 +6691,7 @@
...
@@ -6786,6 +6691,7 @@
// store the complete initial query, not only the "query"
// store the complete initial query, not only the "query"
pass
.
state
.
initial_query
=
pass
.
config
.
initial_query
;
pass
.
state
.
initial_query
=
pass
.
config
.
initial_query
;
util
.
loader
(
""
,
"
status_dict.loading_set
"
);
return
storage
.
fetch
({
return
storage
.
fetch
({
"
pass
"
:
pass
,
"
pass
"
:
pass
,
"
storage
"
:
"
items
"
,
"
storage
"
:
"
items
"
,
...
@@ -7014,6 +6920,7 @@
...
@@ -7014,6 +6920,7 @@
// TODO: keep this until sample handling is removed
// TODO: keep this until sample handling is removed
pass
.
needs_fields
=
true
;
pass
.
needs_fields
=
true
;
util
.
loader
(
""
,
"
status_dict.loading_config
"
);
return
app
.
fetchConfig
({
return
app
.
fetchConfig
({
"
storage
"
:
app
.
storage_dict
.
settings
,
"
storage
"
:
app
.
storage_dict
.
settings
,
"
file
"
:
app
.
storage_dict
.
property_dict
.
name_dict
.
data_type
,
"
file
"
:
app
.
storage_dict
.
property_dict
.
name_dict
.
data_type
,
...
...
lang/en-EN/dict.json
View file @
32a5a0fd
...
@@ -58,6 +58,8 @@
...
@@ -58,6 +58,8 @@
"find_out_more_details"
:
"For additional information, please refer to the following sections:"
"find_out_more_details"
:
"For additional information, please refer to the following sections:"
},
},
"status_dict"
:
{
"status_dict"
:
{
"loading_set"
:
"Loading Records"
,
"loading_config"
:
"Loading Configuration"
,
"requesting"
:
"Requesting"
,
"requesting"
:
"Requesting"
,
"timeout"
:
"Request Timeout. Try again."
,
"timeout"
:
"Request Timeout. Try again."
,
"ssl_error"
:
"Please revoke existing certificate first"
,
"ssl_error"
:
"Please revoke existing certificate first"
,
...
...
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