working on alias ui...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-08-09 15:36:03 +03:00
parent 17d0046fb5
commit c074793aef
4 changed files with 69 additions and 9 deletions

View File

@ -298,6 +298,7 @@
.browse-widget .list .item.disabled {
opacity: 0.3;
}
.browse-widget .list .item.empty-msg,
.browse-widget .list .item.hidden {
font-style: italic;
}

View File

@ -78,13 +78,59 @@ module.Alias = core.ImageGridFeatures.Feature({
var UIAliasActions = actions.Actions({
browseAliases: ['System/Aliases...',
widgets.makeUIDialog(function(){
// XXX
}],
var that = this
return browse.makeLister(null,
function(path, make){
var aliases = that.config.aliases || {}
var names = Object.keys(aliases)
names.length > 0 ?
names
.forEach(function(name){
make([name, aliases[name]])
.on('open', function(){ that.editAlias(name) })
})
: make.Empty()
}, {
cls: 'table-view',
})
})],
editAlias: ['- System/Edit alias...',
widgets.makeUIDialog(function(alias){
// XXX
}],
var that = this
return browse.makeLister(null,
function(path, make){
make.Editable(['Alias:', alias],
{
start_on: 'open',
edit_text: 'last',
clear_on_edit: false,
reset_on_commit: false,
})
.on('edit-commit',
function(evt, text){
})
make.Editable(['Code:', that.config.aliases[alias]],
{
start_on: 'open',
edit_text: 'last',
clear_on_edit: false,
reset_on_commit: false,
})
.on('edit-commit',
function(evt, text){
})
make('---')
make.ConfirmAction('Delete', {})
}, {
cls: 'table-view',
})
})],
})
var UIAlias =

View File

@ -1029,11 +1029,7 @@ var KeyboardUIActions = actions.Actions({
// XXX is adding info stuff like this a correct
// thing to do in code?
c == 0 && options.empty_section_text !== false
&& make(options.empty_section_text || 'No bindings...',
{
disabled: true,
hide_on_search: true,
})
&& make.Empty(options.empty_section_text || 'No bindings...')
.attr('mode', mode)
.addClass('info')

View File

@ -86,6 +86,23 @@ function makeSimpleAction(direction){
// make protocol, i.e. make(content[, options]) or their own...
var Items = module.items = function(){}
// Empty list place holder...
//
// XXX should this be in CSS???
Items.Empty =
function(msg, options){
options = options || {}
options.disabled = options.disabled !== undefined ?
options.disabled
: true
options.hide_on_search = options.hide_on_search !== undefined ?
options.hide_on_search
: true
msg = msg || options.message || 'Empty...'
return this(msg, options)
.addClass('empty-msg')
}
// NOTE: this is the same as make('---'[, options])
Items.Separator =