Skip to content

Commit 9d19aa3

Browse files
authored
Merge pull request #4221 from betatim/uploading-ui-tweak
Tweak upload button to give visual feedback
2 parents 21b93ea + f03797b commit 9d19aa3

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

notebook/static/tree/js/notebooklist.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ define([
442442
}
443443
);
444444
};
445-
445+
446446
NotebookList.prototype.update_location = function (path) {
447447
this.notebook_path = path;
448448
$('body').attr('data-notebook-path', path);
@@ -542,7 +542,7 @@ define([
542542
var item = $("<div/>")
543543
.addClass("col-md-12")
544544
.appendTo(row);
545-
545+
546546
var checkbox;
547547
if (selectable !== undefined) {
548548
checkbox = $('<input/>')
@@ -641,7 +641,7 @@ define([
641641
var ipynb_extensions = ['ipynb'];
642642
return includes_extension(model.path, ipynb_extensions);
643643
};
644-
644+
645645
NotebookList.prototype._is_editable = function(model) {
646646
// Allow any file to be "edited"
647647
// Non-text files will display the following error:
@@ -650,17 +650,17 @@ define([
650650
// See Console for more details.
651651
return true;
652652
};
653-
653+
654654
NotebookList.prototype._is_viewable = function(model) {
655655
var html_types = ['htm', 'html', 'xhtml', 'xml', 'mht', 'mhtml'];
656656
var media_extension = ['3gp', 'avi', 'mov', 'mp4', 'm4v', 'm4a', 'mp3', 'mkv', 'ogv', 'ogm', 'ogg', 'oga', 'webm', 'wav'];
657657
var image_type = ['bmp', 'gif', 'jpg', 'jpeg', 'png', 'webp'];
658658
var other_type = ['ico'];
659659
var viewable_extensions = [].concat(html_types, media_extension, image_type, other_type);
660-
return model.mimetype === 'text/html'
660+
return model.mimetype === 'text/html'
661661
|| includes_extension(model.path, viewable_extensions);
662662
};
663-
663+
664664
// Files like PDF that should be opened using `/files` prefix
665665
NotebookList.prototype._is_pdflike = function(model) {
666666
var pdflike_extensions = ['pdf'];
@@ -879,7 +879,7 @@ define([
879879
return false;
880880
});
881881
}
882-
882+
883883
// Add in the date that the file was last modified
884884
item.find(".item_modified").text(utils.format_datetime(model.last_modified));
885885
item.find(".item_modified").attr("title", moment(model.last_modified).format("YYYY-MM-DD HH:mm"));
@@ -979,7 +979,7 @@ define([
979979
).append(
980980
$("<br/>")
981981
).append(input);
982-
982+
983983
// This statement is used simply so that message extraction
984984
// will pick up the strings. The actual setting of the text
985985
// for the button is in dialog.js.
@@ -1288,7 +1288,7 @@ define([
12881288
});
12891289
return false;
12901290
}
1291-
1291+
12921292
var check_exist = function () {
12931293
var exists = false;
12941294
$.each(that.element.find('.list_item:not(.new-file)'), function(k,v){
@@ -1297,7 +1297,7 @@ define([
12971297
return exists
12981298
};
12991299
var exists = check_exist();
1300-
1300+
13011301
var add_uploading_button = function (f, item) {
13021302
// change buttons, add a progress bar
13031303
var uploading_button = item.find('.upload_button').text("Uploading");
@@ -1318,7 +1318,7 @@ define([
13181318
var offset = 0;
13191319
var chunk = 0;
13201320
var chunk_reader = null;
1321-
1321+
13221322
var large_reader_onload = function (event) {
13231323
if (stop_signal === true) {
13241324
return;
@@ -1391,7 +1391,7 @@ define([
13911391

13921392
model.chunk = chunk;
13931393
model.content = filedata;
1394-
1394+
13951395
var on_success = function () {
13961396
if (offset < f.size) {
13971397
// of to the next chunk
@@ -1451,6 +1451,7 @@ define([
14511451
var upload_button = $('<button/>').text(i18n.msg._("Upload"))
14521452
.addClass('btn btn-primary btn-xs upload_button')
14531453
.click(function (e) {
1454+
item.find('.upload_button').text("Uploading...");
14541455
var filename = item.find('.item_name > input').val();
14551456
var path = utils.url_path_join(that.notebook_path, filename);
14561457
var filedata = item.data('filedata');

0 commit comments

Comments
 (0)