File tree 2 files changed +20
-11
lines changed
2 files changed +20
-11
lines changed Original file line number Diff line number Diff line change 3
3
const modules = require ( '../module' ) ;
4
4
const array2d = require ( './array2d' ) ;
5
5
const util = require ( './util' ) ;
6
+ const Server = require ( '../server' ) ;
7
+ const DOM = require ( '../dom' ) ;
6
8
7
- const closeCreate = ( modules ) => {
9
+ const {
10
+ getPath
11
+ } = require ( '../server/helpers' ) ;
12
+
13
+ const closeCreate = ( ) => {
8
14
const $btnClose = $ ( '#btn_close' ) ;
9
15
10
16
$btnClose . click ( ( ) => {
11
17
$ ( '.sandbox_container' ) . remove ( ) ;
12
18
util . clearModules ( ) ;
13
- restoreModules ( modules ) ;
19
+ reloadAlgorithm ( ) ;
14
20
} ) ;
15
21
} ;
16
22
17
- const restoreModules = ( modules ) => {
18
- for ( var i = 0 ; i < modules . length ; i ++ ) {
19
- $ ( '.module_container' ) . append ( modules [ i ] ) ;
20
- }
21
- } ;
23
+ const reloadAlgorithm = ( ) => {
24
+ const {
25
+ category,
26
+ algorithm,
27
+ file
28
+ } = getPath ( ) ;
22
29
23
- const saveModules = ( ) => {
24
- return $ ( '.module_wrapper' )
30
+ Server . loadAlgorithm ( category , algorithm ) . then ( ( data ) => {
31
+ DOM . showAlgorithm ( category , algorithm , data ) ;
32
+ } ) ;
25
33
} ;
26
34
35
+
36
+
27
37
const init = ( ) => {
28
- var moduleWrappers = saveModules ( ) ;
38
+
29
39
var check = $ ( '.sandbox_container' ) ;
30
40
if ( ! check . length ) {
31
41
util . clearModules ( ) ;
Original file line number Diff line number Diff line change @@ -32,7 +32,6 @@ RSVP.on('error', function (reason) {
32
32
} ) ;
33
33
34
34
$ ( ( ) => {
35
-
36
35
// initialize the application and attach in to the instance module
37
36
const appConstructor = new AppConstructor ( ) ;
38
37
extend ( true , app , appConstructor ) ;
You can’t perform that action at this time.
0 commit comments