mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
tweaking...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
7b60f4d326
commit
8385f58747
@ -188,30 +188,59 @@ var BaseBrowserPrototype = {
|
|||||||
renderSubList: function(item, rendered, options){
|
renderSubList: function(item, rendered, options){
|
||||||
return rendered },
|
return rendered },
|
||||||
// Render list item...
|
// Render list item...
|
||||||
renderItem: function(item, options){
|
renderItem: function(item, i, options){
|
||||||
return item },
|
return item },
|
||||||
|
|
||||||
// Render state...
|
// Render state...
|
||||||
//
|
//
|
||||||
// .render()
|
// .render()
|
||||||
|
// .render(options)
|
||||||
// .render(context)
|
// .render(context)
|
||||||
// -> state
|
// -> state
|
||||||
//
|
//
|
||||||
render: function(context, options){
|
//
|
||||||
|
// NOTE: currently options and context are distinguished only via
|
||||||
|
// the .options attribute... (XXX)
|
||||||
|
//
|
||||||
|
render: function(options){
|
||||||
var that = this
|
var that = this
|
||||||
context = context || this
|
// XXX revise -- should options and context be distinguished only
|
||||||
|
// via the .options attr???
|
||||||
|
var context = (options == null || options.options == null) ?
|
||||||
|
{
|
||||||
|
root: this,
|
||||||
|
// NOTE: we are not combining this with .options as nested
|
||||||
|
// lists can have their own unique sets of options
|
||||||
|
// independently of the root list...
|
||||||
|
options: options || {},
|
||||||
|
}
|
||||||
|
: options
|
||||||
|
options = context.options
|
||||||
|
|
||||||
// render the items...
|
// render the items...
|
||||||
|
// XXX should we control render parameters (range, start, end, ...)
|
||||||
|
// from outside render and pass this info down to nested lists???
|
||||||
|
// ...if yes how??
|
||||||
|
// - options
|
||||||
|
// - arg threading
|
||||||
|
// - render context
|
||||||
var items = this.items
|
var items = this.items
|
||||||
.map(function(item){
|
.map(function(item, i){
|
||||||
return item.render ?
|
return item.render ?
|
||||||
that.renderSubList(item, item.render(context, options), options)
|
that.renderSubList(
|
||||||
: item.value.render ?
|
item,
|
||||||
that.renderSubList(item, item.value.render(context, options), options)
|
item.render(context),
|
||||||
: that.renderItem(item) })
|
options)
|
||||||
|
: item.value.render ?
|
||||||
|
that.renderSubList(
|
||||||
|
item,
|
||||||
|
item.value.render(context),
|
||||||
|
options)
|
||||||
|
: that.renderItem(item, i, options) })
|
||||||
|
.flat()
|
||||||
|
|
||||||
// determine the render mode...
|
// determine the render mode...
|
||||||
return context === this ?
|
return context.root === this ?
|
||||||
// root context -> render list and return this...
|
// root context -> render list and return this...
|
||||||
this.renderList(items, options)
|
this.renderList(items, options)
|
||||||
// non-root context -> return items as-is...
|
// non-root context -> return items as-is...
|
||||||
@ -279,7 +308,7 @@ var BrowserPrototype = {
|
|||||||
return rendered },
|
return rendered },
|
||||||
// Render list item...
|
// Render list item...
|
||||||
// XXX save link to dom in item.dom (???)
|
// XXX save link to dom in item.dom (???)
|
||||||
renderItem: function(item, options){
|
renderItem: function(item, i, options){
|
||||||
return item },
|
return item },
|
||||||
|
|
||||||
// save the rendered state to .dom
|
// save the rendered state to .dom
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user