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
12a58176
Commit
12a58176
authored
Nov 22, 2013
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
starting to make setPageElements global layout handler
parent
f6c066bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
20 deletions
+28
-20
js/erp5_loader.js
js/erp5_loader.js
+28
-20
No files found.
js/erp5_loader.js
View file @
12a58176
...
...
@@ -5,15 +5,25 @@
(
function
(
window
,
document
,
$
)
{
"
use strict
"
;
var
init
,
app
,
util
,
erp5
,
factory
;
var
init
,
app
,
util
,
erp5
,
factory
,
map
,
storage
;
/* ====================================================================== */
/* MAPPING ERP5 */
/* STORAGE */
/* ====================================================================== */
/*
* storage object
*/
storage
=
{};
/* ====================================================================== */
/* MAPPING */
/* ====================================================================== */
/*
*
object containing mappering methods
*
mapping object for custom (in this case ERP5) backend
*/
map
=
{};
erp5
=
{};
...
...
@@ -3085,9 +3095,9 @@
};
/**
* set
s up JIO based on loaded JSON "recipe"
* set
up storages based on fetched recipee
* @method createStorages
* @param {object} re
sponse object containing data (jio.util.ajax response)
* @param {object} re
ply Storage recipee
* @return {object} promise object
*/
app
.
createStorages
=
function
(
reply
)
{
...
...
@@ -3095,13 +3105,11 @@
store
,
promises
=
[];
app
.
storages
=
{};
for
(
i
=
0
;
i
<
reply
.
length
;
i
+=
1
)
{
store
=
reply
[
i
].
definition
;
promises
[
i
]
=
app
.
storages
[
store
.
application_name
]
=
storage
[
store
.
application_name
]
=
jIO
.
createJIO
(
store
);
}
return
RSVP
.
all
(
promises
);
...
...
@@ -3167,7 +3175,7 @@
// TODO should be generic, not only JIO based!
init
.
fetchConfiguration
=
function
(
parcel
)
{
//storage, file, attachment, baggage
var
reply
,
store
=
app
.
storages
[
parcel
.
storage
];
var
reply
,
store
=
storage
[
parcel
.
storage
];
return
store
.
getAttachment
({
"
_id
"
:
parcel
.
file
,
...
...
@@ -3209,7 +3217,7 @@
*/
// NOTE: until we have real data we load fake data on application init!
init
.
fetchData
=
function
(
parcel
)
{
return
app
.
storages
[
parcel
.
storage
].
allDocs
(
parcel
.
query
)
return
storage
[
parcel
.
storage
].
allDocs
(
parcel
.
query
)
.
then
(
function
(
response
)
{
return
{
"
response
"
:
response
,
...
...
@@ -3584,7 +3592,7 @@
init
.
timer
=
window
.
setTimeout
(
function
()
{
// update gadgets
init
.
setPageElements
(
{},
[{
"
children
"
:
[{
"
id
"
:
config
.
id
}]}]
,
false
[{
"
children
"
:
[{
"
id
"
:
config
.
id
}]}],
{}
,
false
);
init
.
timer
=
0
;
},
500
);
...
...
@@ -3628,7 +3636,7 @@
// update gadget
init
.
setPageElements
(
{},
[{
"
children
"
:
[{
"
id
"
:
action_dict
.
id
}]}]
,
false
[{
"
children
"
:
[{
"
id
"
:
action_dict
.
id
}]}],
{}
,
false
);
})
.
fail
(
util
.
errorHandler
);
...
...
@@ -3884,7 +3892,7 @@
// update gadget
init
.
setPageElements
(
{},
[{
"
children
"
:
[{
"
id
"
:
config
.
id
}]}]
,
false
[{
"
children
"
:
[{
"
id
"
:
config
.
id
}]}],
{}
,
false
);
}
else
{
util
.
errorHandler
({
...
...
@@ -3917,7 +3925,7 @@
.
then
(
function
(
reply
)
{
if
(
!
page
.
querySelectorAll
(
"
div.ui-content
"
)[
0
]
.
getAttribute
(
"
data-bound
"
))
{
return
init
.
setPageElements
(
{
"
id
"
:
page
.
id
},
reply
,
undefined
);
return
init
.
setPageElements
(
reply
,
{
"
id
"
:
page
.
id
}
,
undefined
);
}
})
.
fail
(
util
.
errorHandler
);
...
...
@@ -4088,7 +4096,7 @@
init
.
fetchPageLayouts
(
"
settings
"
,
destination
)
.
then
(
function
(
reply
)
{
return
init
.
setPageElements
(
config
,
reply
,
create
);
return
init
.
setPageElements
(
reply
,
config
,
create
);
})
.
then
(
init
.
setPageBindings
)
.
fail
(
util
.
errorHandler
);
...
...
@@ -4205,7 +4213,7 @@
promises
,
record
,
items
,
store
=
app
.
storages
[
"
items
"
],
store
=
storage
[
"
items
"
],
baggage
=
reply
.
baggage
;
if
(
reply
.
response
)
{
...
...
@@ -4393,11 +4401,11 @@
/**
* Setup/update elements to on the page being shown, generate page
* @method setupPageElements
* @param {object} config JSON pointers based on parsed link
* @param {object} layouts Layouts to be generated for this page
* @param {object} config JSON pointers based on parsed link
* @param {boolean} create Create page/Generate content/Refresh content
*/
init
.
setPageElements
=
function
(
config
,
layouts
,
create
)
{
init
.
setPageElements
=
function
(
layouts
,
config
,
create
)
{
var
i
,
page
,
target
,
...
...
@@ -4922,7 +4930,7 @@
window
.
localStorage
.
clear
();
// TODO: modernizr check and shim
here
// TODO: modernizr check and shim
based on app.json
// initalize translations
...
...
@@ -4934,7 +4942,7 @@
ns
:
"
dict
"
});
// TODO:
run this to the normal route!
// TODO:
get storage run, get config run, get page run
app
.
setupStorages
(
util
.
getPathFromScriptTag
(
"
data-storage
"
))
.
then
(
init
.
loadGlobalElements
)
.
then
(
init
.
setupGlobalElements
)
...
...
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