diff --git a/ui (gen4)/features/keyboard.js b/ui (gen4)/features/keyboard.js index 0adf1942..babf387a 100755 --- a/ui (gen4)/features/keyboard.js +++ b/ui (gen4)/features/keyboard.js @@ -1160,13 +1160,6 @@ var KeyboardUIActions = actions.Actions({ sortModes(cur.parent()) } }], - // XXX make this work on click... - // XXX focus resulting mode... - ['⋯', function(_, cur){ - that.editKeyboardMode( - cur.attr('mode'), - function(e){ to_select = e }) - .close(function(){ dialog.update() }) }], ], mode_actions: [ // XXX focus resulting key... @@ -1201,7 +1194,6 @@ var KeyboardUIActions = actions.Actions({ function(e){ to_select = e }) // mode... - // XXX BUG: for some reason modes are unclickable... } else if(cur.hasClass('mode')){ sub_dialog = that .editKeyboardMode( @@ -1217,7 +1209,8 @@ var KeyboardUIActions = actions.Actions({ sub_dialog && sub_dialog - .close(function(){ dialog.update() }) + .close(function(evt, mode){ + mode != 'cancel' && dialog.update() }) }) // select updated/new items... .on('update', function(){ @@ -1330,7 +1323,7 @@ var KeyboardUIActions = actions.Actions({ buttons: [ ['Cancel edit', function(){ abort = true - make.dialog.close() + make.dialog.close('cancel') }], ], }) @@ -1436,7 +1429,7 @@ var KeyboardUIActions = actions.Actions({ buttons: [ ['Cancel edit', function(){ abort = true - make.dialog.close() + make.dialog.close('cancel') }], ], }) @@ -1474,7 +1467,7 @@ var KeyboardUIActions = actions.Actions({ dialog.abort = function(){ abort = true - this.close() + this.close('cancel') } dialog.keyboard .handler('General', 'Q', 'abort') @@ -1550,7 +1543,7 @@ var KeyboardUIActions = actions.Actions({ buttons: [ ['Cancel edit', function(){ abort = true - make.dialog.close() + make.dialog.close('cancel') }], ], }) diff --git a/ui (gen4)/features/ui-widgets.js b/ui (gen4)/features/ui-widgets.js index 73933cb8..5ea62c42 100755 --- a/ui (gen4)/features/ui-widgets.js +++ b/ui (gen4)/features/ui-widgets.js @@ -318,7 +318,7 @@ module.makeUIContainer = function(make){ o // notify the client that we are closing... - .close(function(){ o.client.trigger('close', 'reject') }) + .close(function(evt, mode){ o.client.trigger('close', mode) }) .client // NOTE: strictly this is the responsibility of the client // but it is less error prone to just in case also do @@ -1560,7 +1560,9 @@ var WidgetTestActions = actions.Actions({ to_bottom_button: true, }) - make.Heading('Numbers:') + make.Heading('Numbers:', { + doc: 'Sortable list, use sort handle to the right to sort...' + }) make.EditableList(letters, { list_id: 'letters', sortable: 'y', diff --git a/ui (gen4)/lib/widget/browse.js b/ui (gen4)/lib/widget/browse.js index 1beb9245..bf2ea5c1 100755 --- a/ui (gen4)/lib/widget/browse.js +++ b/ui (gen4)/lib/widget/browse.js @@ -566,6 +566,7 @@ function(data, options){ // // Temporary state is stored in the dialog object: // .__list - cached input list +// .__editable - list editable status // .__to_remove - list of items to remove // .__editable_list_handlers // - indicator that the dialog handlers are set up @@ -594,6 +595,7 @@ function(list, options){ } dialog.__list = dialog.__list || {} + dialog.__editable = dialog.__editable || {} dialog.__to_remove = dialog.__to_remove || {} dialog.__editable_list_handlers = dialog.__editable_list_handlers || {} @@ -610,16 +612,22 @@ function(list, options){ } options = opts - var lst = list instanceof Function ? - list() - : list - 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() + if(id in dialog.__list){ + var lst = dialog.__list[id] + var editable = dialog.__editable[id] - 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 = {}