File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -380,11 +380,13 @@ function update_text_box_size() {
380380$ ( "#download" ) . click ( function ( ) {
381381 let out = notebook_json ( cells_order , vars_in_scope , md_texts ) ;
382382
383- var blob = new Blob ( [ out ] , { "type" : "application/json" } ) ;
384- var url = ( window . URL || window . webkitURL ) . createObjectURL ( blob ) ;
383+ let blob = new Blob ( [ out ] , { "type" : "application/json" } ) ;
384+ let url = ( window . URL || window . webkitURL ) . createObjectURL ( blob ) ;
385385
386- var link = document . createElement ( 'a' ) ;
387- link . download = 'danfo_notebook.json' ;
386+ let link = document . createElement ( 'a' ) ;
387+ let text = $ ( "#notebookname" ) . text ( )
388+ let name = text . length > 0 ? `${ text } .json` : "Dnotebook.json"
389+ link . download = name ;
388390 link . href = url ;
389391
390392 var link_pae = $ ( link ) ;
@@ -436,6 +438,21 @@ $("#import-notebook-file").change(() => {
436438
437439
438440
441+ async function load_data ( path ) {
442+ document . getElementById ( "cell-running" ) . style . display = "block"
443+ let df = await dfd . read_csv ( path )
444+ document . getElementById ( "cell-running" ) . style . display = "none"
445+ return df
446+
447+ }
448+
449+ $ ( "#closename" ) . click ( function ( ) {
450+
451+ let textval = $ ( "#namebook" ) . val ( )
452+
453+ $ ( "#notebookname" ) . html ( `<h2>${ textval } </h2>` )
454+ } ) ;
455+
439456
440457
441458
Original file line number Diff line number Diff line change @@ -99,9 +99,14 @@ function this_div() {
9999// $(`${id}`).append(`<div id=${name}></div>`)
100100
101101// let cb = callback(name);
102+ function viz ( name , callback ) {
103+ // out_div-1
102104
103- // return cb
104- // }
105+ let id = `#out_${ window . current_cell } `
106+ $ ( `${ id } ` ) . append ( `<div id=${ name } ></div>` )
107+
108+ return cb
109+ }
105110
106111function table ( df ) {
107112
@@ -305,10 +310,11 @@ function html_load(new_id) {
305310
306311function load_notebook ( json ) {
307312
308-
313+ cells_order = [ ]
309314 for ( let key in json ) {
310315
311316 let id = key . split ( "-" ) [ 1 ]
317+
312318
313319 if ( Object . prototype . hasOwnProperty . call ( json [ key ] , "in" ) ) {
314320 let html = html_load ( id )
@@ -326,6 +332,7 @@ function load_notebook(json) {
326332 editor . getDoc ( ) . setValue ( input ) ;
327333
328334 vars_in_scope [ `div-${ id } ` ] = editor
335+ cells_order . push ( `div-${ id } ` )
329336
330337 let out = json [ key ] [ "out" ]
331338
@@ -362,6 +369,7 @@ function load_notebook(json) {
362369 md_texts [ `text-div_${ Number ( id ) } ` ] = md_out ;
363370
364371 vars_in_scope [ `div_text-${ id } ` ] = ""
372+ cells_order . push ( `div_text-${ id } ` )
365373
366374 $ ( `textarea#text-box_${ id } ` ) . addClass ( "text-box" )
367375 $ ( `textarea#text-box_${ id } ` ) . val ( md_out )
Original file line number Diff line number Diff line change 4646 <span class =" navbar-toggler-icon" ></span >
4747 </button >
4848
49+ <div style =" margin-right: 150px;color:white;" id =" notebookname" ></div >
50+
4951 <div style =" margin-right: 200px;" class =" collapse navbar-collapse" id =" navbarSupportedContent" >
5052 <ul class =" navbar-nav ml-auto" >
5153 <li class =" nav-item" >
6567 Options
6668 </a >
6769 <div class =" dropdown-menu" aria-labelledby =" navbarDropdown" >
70+ <a class =" dropdown-item" data-toggle =" modal" data-target =" #nameNoteModal" href =" #" >Name Notebook</a >
6871 <a class =" dropdown-item" id =" download" href =" #" >Download Notebook</a >
6972 <a class =" dropdown-item" data-toggle =" modal" data-target =" #uploadNoteModal" href =" #" >Upload Notebook</a >
7073
111114 </div >
112115 </div >
113116 </div >
117+ {{!-- Notebook Name Modal--}}
118+ <div class =" modal" id =" nameNoteModal" tabindex =" -1" >
119+ <div class =" modal-dialog" >
120+ <div class =" modal-content" >
121+ <div class =" modal-header" >
122+ <h5 class =" modal-title" >Name Your Notebook</h5 >
123+ <button type =" button" class =" close" data-dismiss =" modal" aria-label =" Close" >
124+ <span aria-hidden =" true" >× </span >
125+ </button >
126+ </div >
127+ <div class =" modal-body" >
128+ <form >
129+ <div class =" form-group" >
130+ <input type =" text" class =" form-control-file" name =" name-notebook" id =" namebook" >
131+ </div >
132+ </form >
133+ </div >
134+ <div class =" modal-footer" >
135+ <button type =" button" class =" btn btn-secondary" data-dismiss =" modal" id =" closename" >Close</button >
136+ </div >
137+ </div >
138+ </div >
139+ </div >
114140
115141
116142 {{{ body }}}
You can’t perform that action at this time.
0 commit comments