@@ -111,20 +111,26 @@ $(document).ready( function() {
111111 dfSetupField ( $ ( this ) ) ;
112112 } ) ;
113113 } ) ;
114+ // Set dialog icon link
115+ $ ( '.active_admin [data-df-icon]' ) . each ( function ( ) {
116+ $ ( this ) . append ( ' »' ) ; // ' •'
117+ } ) ;
114118 // Open content in dialog
115119 $ ( '.active_admin [data-df-dialog]' ) . on ( 'click' , function ( event ) {
116120 event . preventDefault ( ) ;
117- if ( $ ( '#df-dialog' ) . length == 0 ) $ ( 'body' ) . append ( '<div id="df-dialog"></div>' ) ;
118- var title = $ ( this ) . attr ( 'title' ) ;
119- $ . ajax ( {
120- url : $ ( this ) . attr ( 'href' )
121- } ) . done ( function ( result ) {
122- if ( title ) $ ( '#df-dialog' ) . attr ( 'title' , title ) ;
123- $ ( '#df-dialog' ) . html ( result ) ;
124- $ ( '#df-dialog' ) . dialog ( { modal : true } ) ;
125- } ) ;
126- } ) ;
127- $ ( '.active_admin [data-df-icon]' ) . each ( function ( ) {
128- $ ( this ) . append ( ' »' ) ; // ' •'
121+ $ ( this ) . blur ( ) ;
122+ if ( $ ( '#df-dialog' ) . data ( 'loading' ) != '1' ) {
123+ $ ( '#df-dialog' ) . data ( 'loading' , '1' ) ;
124+ if ( $ ( '#df-dialog' ) . length == 0 ) $ ( 'body' ) . append ( '<div id="df-dialog"></div>' ) ;
125+ var title = $ ( this ) . attr ( 'title' ) ;
126+ $ . ajax ( {
127+ url : $ ( this ) . attr ( 'href' )
128+ } ) . done ( function ( result ) {
129+ if ( title ) $ ( '#df-dialog' ) . attr ( 'title' , title ) ;
130+ $ ( '#df-dialog' ) . html ( result ) ;
131+ $ ( '#df-dialog' ) . dialog ( { modal : true } ) ;
132+ $ ( '#df-dialog' ) . data ( 'loading' , '0' ) ;
133+ } ) ;
134+ }
129135 } ) ;
130136} ) ;
0 commit comments