From b21348f75bb45879fb6bbd1dd005ca51bcdf4fbd Mon Sep 17 00:00:00 2001 From: Julien Rebetez Date: Tue, 27 Oct 2015 10:02:25 +0100 Subject: [PATCH] =?UTF-8?q?Attachments=20dialog=20only=20apply=20deletion?= =?UTF-8?q?=20on=20=E2=80=98Apply=E2=80=99.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- notebook/static/base/js/dialog.js | 155 ++++++++++++++++++------------ 1 file changed, 96 insertions(+), 59 deletions(-) diff --git a/notebook/static/base/js/dialog.js b/notebook/static/base/js/dialog.js index 9a4e5c150..99d37440e 100644 --- a/notebook/static/base/js/dialog.js +++ b/notebook/static/base/js/dialog.js @@ -212,72 +212,106 @@ define(function(require) { }; var edit_attachments = function (options) { - var message = - "Current cell attachments"; + // This shows the Edit Attachments dialog. This dialog allows the + // user to delete attachments. We show a list of attachments to + // the user and he can mark some of them for deletion. The deletion + // is applied when the 'Apply' button of this dialog is pressed. + var message; + var attachments_list; + if (Object.keys(options.attachments).length == 0) { + message = "There are no attachments for this cell."; + attachments_list = $('
'); + } else { + message = "Current cell attachments"; - var attachments_list = $('
') - .addClass('list_container') - .append( - $('
') - .addClass('row list_header') + attachments_list = $('
') + .addClass('list_container') .append( $('
') - .text('Attachments') - ) - ); - - var refresh_attachments_list = function() { - $(attachments_list).find('.att_row').remove(); - for (var key in options.attachments) { - var mime = Object.keys(options.attachments[key])[0]; - var delete_btn = $('