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
960afe58
Commit
960afe58
authored
Apr 08, 2014
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
app: update dynamic content generation to handle popup and panels
parent
9e8b1d5e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
18 deletions
+11
-18
js/erp5_loader.js
js/erp5_loader.js
+11
-18
No files found.
js/erp5_loader.js
View file @
960afe58
...
...
@@ -2620,9 +2620,11 @@
};
// TODO: remove, should be handled by content.set
// TODO: why is this not done on click, when we can get the href > element
// from the link attribute?
/**
* Load content into a dynamic element
* @method generate
Popup
Contents
* @method generate
Dynamic
Contents
* @param {obj} object Action object (popupbeforeposition)
*/
factory
.
util
.
generateDynamicContents
=
function
(
obj
)
{
...
...
@@ -2640,6 +2642,10 @@
}
else
{
element
.
setAttribute
(
"
data-state
"
,
reference
);
element
.
setAttribute
(
"
data-reference
"
,
reference
);
// empty gadget and reload
// TODO: how to replace in javaScript?
element
.
innerHTML
=
""
;
promises
=
[];
// fetch content
...
...
@@ -2650,29 +2656,15 @@
"
pass
"
:
undefined
})
.
then
(
function
(
reply
)
{
element
.
setAttribute
(
"
data-reference
"
,
reference
);
if
(
reply
.
children
)
{
for
(
i
=
0
;
i
<
reply
.
children
.
length
;
i
+=
1
)
{
promises
[
i
]
=
app
.
content
.
set
(
reply
.
children
[
i
],
{});
}
}
return
RSVP
.
all
(
promises
);
return
RSVP
.
resolve
(
app
.
content
.
set
(
reply
,
{}));
})
.
then
(
function
(
content
)
{
fragment
=
document
.
createDocumentFragment
();
for
(
j
=
0
;
j
<
content
.
length
;
j
+=
1
)
{
fragment
.
appendChild
(
content
[
j
]);
}
// translate
if
(
i18n
)
{
map
.
actions
.
translateNodeList
(
fragm
ent
);
map
.
actions
.
translateNodeList
(
cont
ent
);
}
// empty gadget and reload
// TODO: how to replace in javaScript?
element
.
innerHTML
=
""
;
// append
element
.
appendChild
(
fragm
ent
);
element
.
appendChild
(
cont
ent
);
})
.
then
(
function
()
{
$el
=
$
(
element
);
...
...
@@ -2683,6 +2675,7 @@
$el
.
popup
(
"
reposition
"
,
{
"
positionto
"
:
"
window
"
});
break
;
}
$el
.
enhanceWithin
();
})
.
fail
(
app
.
util
.
error
);
}
...
...
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