Show More
@@ -0,0 +1,23 b'' | |||||
|
1 | /* We need an invisible input field on top of the sentense*/ | |||
|
2 | /* "Drag file onto the list ..." */ | |||
|
3 | ||||
|
4 | .alternate_upload | |||
|
5 | { | |||
|
6 | background-color:none; | |||
|
7 | display: inline; | |||
|
8 | } | |||
|
9 | ||||
|
10 | .alternate_upload.form | |||
|
11 | { | |||
|
12 | padding: 0; | |||
|
13 | margin:0; | |||
|
14 | } | |||
|
15 | ||||
|
16 | .alternate_upload input.fileinput | |||
|
17 | { | |||
|
18 | background-color:red; | |||
|
19 | position:relative; | |||
|
20 | opacity: 0; | |||
|
21 | z-index: 2; | |||
|
22 | width: 356px; | |||
|
23 | } |
@@ -44,7 +44,21 b' var IPython = (function (IPython) {' | |||||
44 | return false; |
|
44 | return false; | |
45 | }); |
|
45 | }); | |
46 |
this.element.bind('drop', function |
|
46 | this.element.bind('drop', function(event){ | |
47 | var files = event.originalEvent.dataTransfer.files; |
|
47 | console.log('bound to drop'); | |
|
48 | that.handelFilesUpload(event,'drop'); | |||
|
49 | return false; | |||
|
50 | }); | |||
|
51 | }; | |||
|
52 | ||||
|
53 | NotebookList.prototype.handelFilesUpload = function(event, dropOrForm) { | |||
|
54 | var that = this; | |||
|
55 | var files; | |||
|
56 | if(dropOrForm =='drop'){ | |||
|
57 | files = event.originalEvent.dataTransfer.files; | |||
|
58 | } else | |||
|
59 | { | |||
|
60 | files = event.originalEvent.target.files | |||
|
61 | } | |||
48 |
|
|
62 | for (var i = 0, f; f = files[i]; i++) { | |
49 |
|
|
63 | var reader = new FileReader(); | |
50 |
|
|
64 | reader.readAsText(f); | |
@@ -67,10 +81,8 b' var IPython = (function (IPython) {' | |||||
67 |
|
|
81 | }; | |
68 |
|
|
82 | } | |
69 |
|
|
83 | return false; | |
70 | }); |
|
|||
71 | }; |
|
84 | }; | |
72 |
|
85 | |||
73 |
|
||||
74 | NotebookList.prototype.clear_list = function () { |
|
86 | NotebookList.prototype.clear_list = function () { | |
75 | this.element.children('.list_item').remove(); |
|
87 | this.element.children('.list_item').remove(); | |
76 | } |
|
88 | } |
@@ -32,8 +32,11 b' $(document).ready(function () {' | |||||
32 |
|
32 | |||
33 | IPython.notebook_list.load_list(); |
|
33 | IPython.notebook_list.load_list(); | |
34 | IPython.cluster_list.load_list(); |
|
34 | IPython.cluster_list.load_list(); | |
35 |
|
||||
36 | IPython.page.show(); |
|
35 | IPython.page.show(); | |
37 |
|
36 | |||
|
37 | // bound the upload method to the on change of the file select list | |||
|
38 | $("#alternate_upload").change(function (event){ | |||
|
39 | IPython.notebook_list.handelFilesUpload(event,'form'); | |||
|
40 | }); | |||
38 | }); |
|
41 | }); | |
39 |
|
42 |
@@ -4,6 +4,7 b'' | |||||
4 |
|
4 | |||
5 | {% block stylesheet %} |
|
5 | {% block stylesheet %} | |
6 | <link rel="stylesheet" href="{{static_url("css/projectdashboard.css") }}" type="text/css" /> |
|
6 | <link rel="stylesheet" href="{{static_url("css/projectdashboard.css") }}" type="text/css" /> | |
|
7 | <link rel="stylesheet" href="{{static_url("css/alternate_uploadform.css") }}" type="text/css" /> | |||
7 | {% end %} |
|
8 | {% end %} | |
8 |
|
9 | |||
9 |
|
10 | |||
@@ -30,8 +31,14 b' data-read-only={{read_only}}' | |||||
30 | <div id="tab1"> |
|
31 | <div id="tab1"> | |
31 | {% if logged_in or not read_only %} |
|
32 | {% if logged_in or not read_only %} | |
32 | <div id="notebook_toolbar"> |
|
33 | <div id="notebook_toolbar"> | |
33 | <span id="drag_info">Drag files onto the list to import |
|
34 | ||
|
35 | <form id='alternate_upload' action="notebooks" enctype="multipart/form-data" method="post" class='alternate_upload'> | |||
|
36 | <span id="drag_info" style="position:absolute" >Drag files | |||
|
37 | onto the list, or click here, to import | |||
34 | notebooks.</span> |
|
38 | notebooks.</span> | |
|
39 | <input type="file" name="datafile" class="fileinput"> | |||
|
40 | </form> | |||
|
41 | ||||
35 |
|
42 | |||
36 | <span id="notebook_buttons"> |
|
43 | <span id="notebook_buttons"> | |
37 | <button id="refresh_notebook_list" title="Refresh notebook list">Refresh</button> |
|
44 | <button id="refresh_notebook_list" title="Refresh notebook list">Refresh</button> |
General Comments 0
You need to be logged in to leave comments.
Login now