some tweaking + cleanup + fixes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-01-30 05:37:55 +03:00
parent 712f212f7f
commit 00b4c9d33b
3 changed files with 27 additions and 24 deletions

View File

@ -1160,13 +1160,6 @@ var KeyboardUIActions = actions.Actions({
sortModes(cur.parent()) sortModes(cur.parent())
} }
}], }],
// XXX make this work on click...
// XXX focus resulting mode...
['&ctdot;', function(_, cur){
that.editKeyboardMode(
cur.attr('mode'),
function(e){ to_select = e })
.close(function(){ dialog.update() }) }],
], ],
mode_actions: [ mode_actions: [
// XXX focus resulting key... // XXX focus resulting key...
@ -1201,7 +1194,6 @@ var KeyboardUIActions = actions.Actions({
function(e){ to_select = e }) function(e){ to_select = e })
// mode... // mode...
// XXX BUG: for some reason modes are unclickable...
} else if(cur.hasClass('mode')){ } else if(cur.hasClass('mode')){
sub_dialog = that sub_dialog = that
.editKeyboardMode( .editKeyboardMode(
@ -1217,7 +1209,8 @@ var KeyboardUIActions = actions.Actions({
sub_dialog sub_dialog
&& sub_dialog && sub_dialog
.close(function(){ dialog.update() }) .close(function(evt, mode){
mode != 'cancel' && dialog.update() })
}) })
// select updated/new items... // select updated/new items...
.on('update', function(){ .on('update', function(){
@ -1330,7 +1323,7 @@ var KeyboardUIActions = actions.Actions({
buttons: [ buttons: [
['Cancel edit', function(){ ['Cancel edit', function(){
abort = true abort = true
make.dialog.close() make.dialog.close('cancel')
}], }],
], ],
}) })
@ -1436,7 +1429,7 @@ var KeyboardUIActions = actions.Actions({
buttons: [ buttons: [
['Cancel edit', function(){ ['Cancel edit', function(){
abort = true abort = true
make.dialog.close() make.dialog.close('cancel')
}], }],
], ],
}) })
@ -1474,7 +1467,7 @@ var KeyboardUIActions = actions.Actions({
dialog.abort = function(){ dialog.abort = function(){
abort = true abort = true
this.close() this.close('cancel')
} }
dialog.keyboard dialog.keyboard
.handler('General', 'Q', 'abort') .handler('General', 'Q', 'abort')
@ -1550,7 +1543,7 @@ var KeyboardUIActions = actions.Actions({
buttons: [ buttons: [
['Cancel edit', function(){ ['Cancel edit', function(){
abort = true abort = true
make.dialog.close() make.dialog.close('cancel')
}], }],
], ],
}) })

View File

@ -318,7 +318,7 @@ module.makeUIContainer = function(make){
o o
// notify the client that we are closing... // notify the client that we are closing...
.close(function(){ o.client.trigger('close', 'reject') }) .close(function(evt, mode){ o.client.trigger('close', mode) })
.client .client
// NOTE: strictly this is the responsibility of the client // NOTE: strictly this is the responsibility of the client
// but it is less error prone to just in case also do // but it is less error prone to just in case also do
@ -1560,7 +1560,9 @@ var WidgetTestActions = actions.Actions({
to_bottom_button: true, to_bottom_button: true,
}) })
make.Heading('Numbers:') make.Heading('Numbers:', {
doc: 'Sortable list, use sort handle to the right to sort...'
})
make.EditableList(letters, { make.EditableList(letters, {
list_id: 'letters', list_id: 'letters',
sortable: 'y', sortable: 'y',

View File

@ -566,6 +566,7 @@ function(data, options){
// //
// Temporary state is stored in the dialog object: // Temporary state is stored in the dialog object:
// .__list - cached input list // .__list - cached input list
// .__editable - list editable status
// .__to_remove - list of items to remove // .__to_remove - list of items to remove
// .__editable_list_handlers // .__editable_list_handlers
// - indicator that the dialog handlers are set up // - indicator that the dialog handlers are set up
@ -594,6 +595,7 @@ function(list, options){
} }
dialog.__list = dialog.__list || {} dialog.__list = dialog.__list || {}
dialog.__editable = dialog.__editable || {}
dialog.__to_remove = dialog.__to_remove || {} dialog.__to_remove = dialog.__to_remove || {}
dialog.__editable_list_handlers = dialog.__editable_list_handlers || {} dialog.__editable_list_handlers = dialog.__editable_list_handlers || {}
@ -610,16 +612,22 @@ function(list, options){
} }
options = opts options = opts
var lst = list instanceof Function ? if(id in dialog.__list){
list() var lst = dialog.__list[id]
: list var editable = dialog.__editable[id]
var editable = lst instanceof Array
// view objects...
// NOTE: we .slice() here to make the changes a bit better packaged
// or discrete and not done as they come in...
lst = !editable ? Object.keys(lst) : lst.slice()
dialog.__list[id] = lst } else {
var lst = list instanceof Function ?
list()
: list
var editable = dialog.__editable[id] = lst instanceof Array
// view objects...
// NOTE: we .slice() here to make the changes a bit better packaged
// or discrete and not done as they come in...
lst = !editable ? Object.keys(lst) : lst.slice()
dialog.__list[id] = lst
}
var buttons = options.buttons = (options.buttons || []).slice() var buttons = options.buttons = (options.buttons || []).slice()
var _buttons = {} var _buttons = {}