@@ -15,8 +15,17 @@ function addTab(link) {
1515 var path = $ ( link ) . attr ( "rel" ) ;
1616 var modelist = ace . require ( "ace/ext/modelist" ) ;
1717 var mode = modelist . getModeForPath ( path ) . mode ;
18+ $ ( ".current" ) . attr ( 'mode' , mode ) ;
1819 console . log ( mode ) ;
1920 editor . session . setMode ( mode ) ;
21+ if ( mode == "ace/mode/html" )
22+ {
23+ assign ( $ ( link ) . attr ( 'rel' ) ) ;
24+ }
25+ else {
26+ $ ( ".actions" ) . show ( ) ;
27+ $ ( ".compile" ) . hide ( ) ;
28+ }
2029 editor . setTheme ( 'ace/theme/twilight' ) ;
2130 console . log ( path ) ;
2231 console . log ( url ) ;
@@ -34,11 +43,7 @@ function addTab(link) {
3443 console . log ( error ) ;
3544 }
3645 } ) ;
37- console . log ( $ ( link ) . attr ( 'rel' ) ) ;
38- var a = "<%=Dir.pwd%>" ;
39- a = a . replace ( "home/sifat/directory/public/system/repositories/" , "" )
40- console . log ( "a=" + a ) ;
41- $ ( ".compile" ) . attr ( 'href' , a + "/" + $ ( link ) . attr ( 'rel' ) ) ;
46+
4247 $ ( function ( ) {
4348 $ ( '#res-tab' ) . on ( 'change' , function ( ) {
4449 var current = $ ( this ) . find ( ':selected' ) . text ( ) ;
@@ -53,6 +58,13 @@ function addTab(link) {
5358 $ ( '#tabs-editor li' ) . each ( function ( ) {
5459 if ( $ ( this ) . attr ( 'id' ) == current ) {
5560 $ ( this ) . addClass ( "current" ) ;
61+ if ( $ ( this ) . attr ( 'mode' ) == 'ace/mode/html' ) {
62+ assign ( current ) ;
63+ }
64+ else {
65+ $ ( ".actions" ) . show ( ) ;
66+ $ ( ".compile" ) . hide ( ) ;
67+ }
5668 }
5769 } ) ;
5870 console . log ( current ) ;
@@ -68,6 +80,14 @@ function addTab(link) {
6880 console . log ( $ ( this ) . attr ( 'id' ) ) ;
6981 if ( $ ( this ) . attr ( 'id' ) == $ ( current ) . attr ( 'id' ) ) {
7082 $ ( this ) . addClass ( "current" ) ;
83+ if ( $ ( this ) . attr ( 'mode' ) == 'ace/mode/html' ) {
84+ assign ( $ ( current ) . attr ( 'id' ) ) ;
85+
86+ }
87+ else {
88+ $ ( ".actions" ) . show ( ) ;
89+ $ ( ".compile" ) . hide ( ) ;
90+ }
7191 }
7292 } ) ;
7393 } ) ;
@@ -95,3 +115,12 @@ function addTab(link) {
95115 } ) ;
96116 } ) ;
97117}
118+ function assign ( current ) {
119+ console . log ( "current=" + current ) ;
120+ $ ( ".actions" ) . show ( ) ;
121+ $ ( ".compile" ) . show ( ) ;
122+ var a = $ ( ".root-list" ) . attr ( 'datapath' ) ;
123+ a = a . replace ( "home/sifat/directory/public/system/repositories/" , "" )
124+ console . log ( "a=" + a ) ;
125+ $ ( ".compile" ) . attr ( 'href' , a + "/" + current ) ;
126+ }
0 commit comments