updated alias dialog...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-08-16 14:40:17 +03:00
parent 3e8d0a6bba
commit 764e78b4f4
2 changed files with 32 additions and 12 deletions

View File

@ -109,6 +109,7 @@ module.Alias = core.ImageGridFeatures.Feature({
var UIAliasActions = actions.Actions({
// XXX should this update the parent???
// XXX updating this does not work yet...
browseAliases: ['System/Aliases...',
widgets.makeUIDialog(function(){
var that = this
@ -119,6 +120,8 @@ var UIAliasActions = actions.Actions({
var getKeys = function(action){
return (keys[action] || []).join(' / ') }
var to_remove = []
return browse.makeLister(null,
function(path, make){
var dialog = this
@ -127,18 +130,24 @@ var UIAliasActions = actions.Actions({
var names = Object.keys(aliases)
names.length > 0 ?
names
.forEach(function(name){
//make([name, (aliases[name]).slice(-1)[0]])
make([name])
.attr({
keys: getKeys(name),
action: name,
})
.on('open', function(){
that.editAlias(name)
.on('close', function(){ dialog.update() })
})
make.EditableList(names,
{
new_item: false,
to_remove: to_remove,
itemopen: function(name){
that.editAlias(name)
.on('close', function(){ dialog.update() })
dialog.close()
},
each: function(name, elem){
$(elem)
.attr({
keys: getKeys(name),
action: name,
})
}
})
: make.Empty()
@ -161,6 +170,11 @@ var UIAliasActions = actions.Actions({
}
this.keyboard.handler('General', '?', 'showDoc')
})
.close(function(){
to_remove.forEach(function(alias){
that.alias(alias, null)
})
})
})],
// NOTE: this does not include an attr editor by design...

View File

@ -434,6 +434,9 @@ function(list){
// // if true, group the items into a <span> element...
// groupList: false,
//
// // process each dom element...
// each: <function>,
//
// // see: make(..) for additional option info.
// ...
// }
@ -498,6 +501,9 @@ function(data, options){
keys !== data && data[k]
&& elem.on('open', data[k])
opts.each
&& opts.each(txt || k, elem)
res.push(elem[0])
})