cleanup...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-12-05 00:40:31 +03:00
parent fddb35b9c7
commit c81acad83a

View File

@ -2081,29 +2081,36 @@ var UICollectionActions = actions.Actions({
// element edit... // element edit...
// XXX should this be generic??? // XXX should this be generic???
menu: function(_, from){ menu: function(_, from){
var f = $(this).find('.text').last().attr('text') || from var elem = $(this).find('.text').last()
from = elem.attr('text') || from
$(this).find('.text').last() elem
.html(f) // NOTE: we need to do this to account for
// '$' in names...
.html(from)
.makeEditable({ .makeEditable({
activate: true, activate: true,
clear_on_edit: false, clear_on_edit: false,
abort_keys: [ abort_keys: [
'Esc', 'Esc',
'Up',
'Down',
], ],
}) })
.on('edit-commit', function(_, to){ .on('edit-commit', function(_, to){
// check if name unique... (???) to = to.trim()
if(to in that.collections){ // check if name is unique or empty...
if(to in that.collections || to == ''){
// XXX ??? // XXX ???
return return
} }
// XXX need to get the real from... // XXX need to get the real from...
that.renameCollection(f, to) that.renameCollection(from, to)
// rename was successful...
if(to in that.collections){ if(to in that.collections){
collections[collections.indexOf(f)] = to collections[collections.indexOf(from)] = to
} }
}) })
.on('edit-abort edit-commit', function(_, title){ .on('edit-abort edit-commit', function(_, title){