added comment editing to changes dialog...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2018-12-31 04:38:38 +03:00
parent 83a16f6e55
commit 1e238e8efe

View File

@ -43,6 +43,7 @@ var ExperimentActions = actions.Actions({
{dialogTitle: 'Unsaved changes'},
widgets.makeUIDialog(function(path){
var that = this
var comment
var handlers_setup = false
return browse.makeLister(null, function(_, make){
var keys = Object.keys(that.changes || {})
@ -64,9 +65,39 @@ var ExperimentActions = actions.Actions({
make(key, opts)
})
// save comment...
if(that.getSaveComment){
make('---')
comment = comment
|| that.getSaveComment()
// XXX this behaves in an odd manner...
make.Editable(['$Comment: ', comment],
{
multiline: true,
abort_keys: [
'Esc',
],
})
.on('edit-commit', function(_, text){
that.setSaveComment(
$(this)
.find('.text')
.last()
.text())
})
.on('edit-abort', function(){
$(this)
.find('.text')
.last()
.text(comment)
})
}
make('---')
make('Save', {
open: function(){
that.setSaveComment
&& that.setSaveComment(comment)
that.saveIndexHere
&& that.saveIndexHere()
},