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
48cd44fd
Commit
48cd44fd
authored
Jul 31, 2013
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
App/modules: added forceRefresh option to force rebuild of gaget on reload
parent
6801c759
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
17 deletions
+28
-17
modules/core/app/app.js
modules/core/app/app.js
+2
-2
modules/ui/browser/browser.js
modules/ui/browser/browser.js
+15
-6
modules/ui/gallery/gallery.js
modules/ui/gallery/gallery.js
+3
-5
modules/ui/items/items.js
modules/ui/items/items.js
+8
-4
No files found.
modules/core/app/app.js
View file @
48cd44fd
...
...
@@ -265,7 +265,7 @@ define([
// @method renderGadgets
// @param {object} gadget to be rendered
//
that
.
renderGadgets
=
function
(
gadget
)
{
that
.
renderGadgets
=
function
(
gadget
,
forceRefresh
)
{
var
gadget_id
=
gadget
.
dom
.
attr
(
'
id
'
),
gadget_parent
=
gadget
.
dom
.
parents
(
"
div[data-gadget]
"
),
gadget_props
,
...
...
@@ -279,7 +279,7 @@ define([
}
// so now we do it here...
if
(
gadget
.
isEnhanced
()
===
false
)
{
if
(
gadget
.
isEnhanced
()
===
false
||
forceRefresh
)
{
gadget
.
dom
.
parent
().
trigger
(
"
create
"
);
gadget
.
setEnhanced
(
true
);
}
...
...
modules/ui/browser/browser.js
View file @
48cd44fd
...
...
@@ -119,11 +119,20 @@ define([
spec
.
source
=
source
;
spec
.
callback_mockup
=
callback_mockup
;
// bind here, we attach to document
priv
.
setBindings
(
spec
);
if
(
!
spec
.
page
.
getAttribute
(
"
events_pagination
"
))
{
spec
.
page
.
setAttribute
(
"
events_pagination
"
,
true
);
$
(
document
).
on
(
"
pagebeforeshow.pagination
"
,
spec
.
pageId
,
function
(
e
,
data
)
{
// TODO: if we allow to reload, we also need to trigger refresh on
// so we need to reload this every time a page is shown. question
// is how to trigger a refresh on this element ONLY
// > the gadgets should tell whether they need enhancement!
// callback
priv
.
iterate
(
spec
);
});
// callback
priv
.
iterate
(
spec
);
// callback
priv
.
iterate
(
spec
);
}
};
that
.
callback
=
function
(
self
)
{
...
...
@@ -132,14 +141,14 @@ define([
def
.
done
(
function
(
gadget
)
{
// prefix instance-ids, pass JSON
App
.
renderGadgets
(
gadget
);
App
.
renderGadgets
(
gadget
,
true
);
});
window
.
fallbackLoader
.
deferreds
.
push
(
def
);
window
.
fallbackLoader
.
args
.
push
(
self
);
}
else
{
// prefix instance-ids, pass JSON
App
.
renderGadgets
(
self
);
App
.
renderGadgets
(
self
,
true
);
}
};
...
...
modules/ui/gallery/gallery.js
View file @
48cd44fd
...
...
@@ -209,9 +209,7 @@ define([
if
(
location
.
search
)
{
spec
.
pointer
=
location
.
search
.
split
(
"
=
"
);
}
if
(
$
.
mobile
.
firstPage
.
attr
(
'
id
'
)
!==
spec
.
pageId
.
replace
(
"
#
"
,
""
))
{
priv
.
generateItems
(
spec
);
}
priv
.
generateItems
(
spec
,
true
);
})
.
on
(
"
click.gallery
"
,
spec
.
pageId
+
"
.display_item
"
,
function
(
e
)
{
var
target
=
e
.
target
,
...
...
@@ -235,14 +233,14 @@ define([
def
.
done
(
function
(
gadget
)
{
// prefix instance-ids, pass JSON
App
.
renderGadgets
(
gadget
);
App
.
renderGadgets
(
gadget
,
true
);
});
window
.
fallbackLoader
.
deferreds
.
push
(
def
);
window
.
fallbackLoader
.
args
.
push
(
self
);
}
else
{
// prefix instance-ids, pass JSON
App
.
renderGadgets
(
self
);
App
.
renderGadgets
(
self
,
true
);
}
};
...
...
modules/ui/items/items.js
View file @
48cd44fd
...
...
@@ -111,9 +111,13 @@ define([
if
(
!
spec
.
page
.
getAttribute
(
"
events_items
"
))
{
spec
.
page
.
setAttribute
(
"
events_items
"
,
true
);
$
(
document
).
on
(
"
pagebeforeshow.items
"
,
spec
.
pageId
,
function
(
e
,
data
)
{
if
(
$
.
mobile
.
firstPage
.
attr
(
'
id
'
)
!==
spec
.
pageId
.
replace
(
"
#
"
,
""
))
{
// TODO: if we allow to reload, we also need to trigger refresh on
// so we need to reload this every time a page is shown. question
// is how to trigger a refresh on this element ONLY
// > the gadgets should tell whether they need enhancement!
//if ($.mobile.firstPage.attr('id') !== spec.pageId.replace("#","")) {
priv
.
generateItems
(
spec
);
}
//
}
});
// and run intial
priv
.
generateItems
(
spec
);
...
...
@@ -142,14 +146,14 @@ define([
def
.
done
(
function
(
gadget
)
{
// prefix instance-ids, pass JSON
App
.
renderGadgets
(
gadget
);
App
.
renderGadgets
(
gadget
,
true
);
});
window
.
fallbackLoader
.
deferreds
.
push
(
def
);
window
.
fallbackLoader
.
args
.
push
(
self
);
}
else
{
// prefix instance-ids, pass JSON
App
.
renderGadgets
(
self
);
App
.
renderGadgets
(
self
,
true
);
}
};
...
...
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