added basic footer...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2019-06-29 16:09:32 +03:00
parent 0e7ee0af2a
commit 944243ea4b
2 changed files with 34 additions and 13 deletions

View File

@ -241,7 +241,9 @@ requirejs([
.map(function(_, i){ .map(function(_, i){
return make(i) })) return make(i) }))
}, { },
browser.Browser.INFO_FOOTER,
{
itemButtons: [ itemButtons: [
['&ndash;', ['&ndash;',
'buttonAction: item button focused -- example button action...'], 'buttonAction: item button focused -- example button action...'],

View File

@ -797,8 +797,7 @@ var BaseBrowserPrototype = {
sections: [ sections: [
'header', 'header',
'items', 'items',
// XXX do we need this? 'footer',
//'footer',
], ],
focusDisabled: false, focusDisabled: false,
@ -3144,15 +3143,18 @@ var BaseBrowserPrototype = {
// XXX should we update on init.... // XXX should we update on init....
__init__: function(func, options){ __init__: function(func, options){
var args = [...arguments] var args = [...arguments]
// header (optional)...
args[1] instanceof Function
&& (this.__header__ = args.shift())
// items...
this.__items__ = args.shift() this.__items__ = args.shift()
if(args[0] instanceof Function){ // footer (optional)..
this.__header__ = this.__items__ args[0] instanceof Function
this.__items__ = args.shift() && (this.__footer__ = args.shift())
} // options (optional)...
this.options = Object.assign( this.options = Object.assign(
Object.create(this.options || {}), Object.create(this.options || {}),
args[0] || {}) args[0] || {}) },
},
} }
@ -3428,15 +3430,30 @@ var HTMLBrowserClassPrototype = {
// XXX add // XXX add
PATH_HEADER: function(make, options){ PATH_HEADER: function(make, options){
make('CURRENT_PATH', { make('CURRENT_PATH', {
id: 'current_path', id: 'header_current_path',
cls: 'path', cls: 'path',
buttons: (options || {}).headerButtons buttons: (options || {}).headerButtons
|| (this.options || {}).headerButtons || (this.options || {}).headerButtons
|| [], || [], })
})
this.focus(function(){ this.focus(function(){
var e = this.get({id: 'current_path'}, {section: 'header'}) var e = this.get({id: 'header_current_path'}, {section: 'header'})
e.value = this.pathArray e.value = this.pathArray
this.renderItem(e) }) },
// XXX use focused element...
// XXX add on mouse over...
INFO_FOOTER: function(make, options){
make('INFO', {
id: 'footer_info',
cls: 'info',
buttons: (options || {}).footerButtons
|| (this.options || {}).footerButtons
|| [], })
this.focus(function(){
var focused = this.focused
var e = this.get({id: 'footer_info'}, {section: 'footer'})
e.value = focused.info
|| focused.alt
|| '&nbsp;'
this.renderItem(e) }) this.renderItem(e) })
}, },
} }
@ -3537,6 +3554,8 @@ var HTMLBrowserPrototype = {
['c', 'collapse: "*"'], ['c', 'collapse: "*"'],
['e', 'expand: "*"'], ['e', 'expand: "*"'],
], ],
footerButtons: [
],
itemTemplate: { itemTemplate: {
__proto__: (BaseBrowser.prototype.options || {}).itemTemplate || {}, __proto__: (BaseBrowser.prototype.options || {}).itemTemplate || {},