got_lists_version(resp.lists_version);
});
}
+function save_list_item(dlg,li) {
+ var new_description = dlg.find('input[type="text"]').val();
+
+ $.ajax( li.data('lsl-uri'),
+ { type: 'PUT',
+ data: JSON.stringify({
+ description: new_description,
+ version: li.data('lsl-version')})
+ }
+ )
+ .done((d)=>{
+ selected_list.data('lsl-version', selected_list.data('lsl-version') + 1);
+
+ li.data('lsl-description', new_description);
+ li.data('lsl-version', d.version);
+ li.find('.description').text(new_description);
+
+ dlg.dialog('destroy');
+ got_list_version(d.list_version);
+ got_lists_version(d.lists_version);
+ });
+}
function edit_list_item(li) {
var d = $('<div>')
.append(
.append(
$('<legend>').text('Item name'),
$('<input type="text" size="10">')
+ .on('keypress', (ev) => {
+ if (13 == ev.keyCode) {
+ save_list_item(d, li);
+ return false;
+ }
+
+ return true;
+ })
.val(li.data('lsl-description'))
)
);