@@ -123,21 +123,7 @@ var SystemScopeView = Backbone.View.extend({
123
123
} ) ;
124
124
} ) ;
125
125
} ,
126
- error :function ( error , response ) {
127
-
128
- //Pull out the response text.
129
- var responseJson = JSON . parse ( response . responseText ) ;
130
-
131
- //Display an alert with an error message
132
- $ ( '#modalAlert div.modal-header' ) . html ( responseJson . error ) ;
133
- $ ( '#modalAlert div.modal-body' ) . html ( responseJson . error_description ) ;
134
-
135
- $ ( "#modalAlert" ) . modal ( { // wire up the actual modal functionality and show the dialog
136
- "backdrop" : "static" ,
137
- "keyboard" : true ,
138
- "show" : true // ensure the modal is shown immediately
139
- } ) ;
140
- }
126
+ error :app . errorHandlerView . handleError ( )
141
127
} ) ;
142
128
143
129
_self . parentView . delegateEvents ( ) ;
@@ -170,7 +156,7 @@ var SystemScopeListView = Backbone.View.extend({
170
156
'<span class="label" id="loading-scopes">' + $ . t ( 'common.scopes' ) + '</span> '
171
157
) ;
172
158
173
- $ . when ( this . model . fetchIfNeeded ( { success :function ( e ) { $ ( '#loading-scopes' ) . addClass ( 'label-success' ) ; } } ) )
159
+ $ . when ( this . model . fetchIfNeeded ( { success :function ( e ) { $ ( '#loading-scopes' ) . addClass ( 'label-success' ) ; } , error : app . errorHandlerView . handleError ( ) } ) )
174
160
. done ( function ( ) {
175
161
$ ( '#loadingbox' ) . sheet ( 'hide' ) ;
176
162
callback ( ) ;
@@ -194,7 +180,7 @@ var SystemScopeListView = Backbone.View.extend({
194
180
'<span class="label" id="loading-scopes">' + $ . t ( 'common.scopes' ) + '</span> '
195
181
) ;
196
182
197
- $ . when ( this . model . fetch ( { success :function ( e ) { $ ( '#loading-scopes' ) . addClass ( 'label-success' ) ; } } ) )
183
+ $ . when ( this . model . fetch ( { success :function ( e ) { $ ( '#loading-scopes' ) . addClass ( 'label-success' ) ; } , error : app . errorHandlerView . handleError ( ) } ) )
198
184
. done ( function ( ) {
199
185
$ ( '#loadingbox' ) . sheet ( 'hide' ) ;
200
186
_self . render ( ) ;
@@ -296,7 +282,7 @@ var SystemScopeFormView = Backbone.View.extend({
296
282
'<span class="label" id="loading-scopes">' + $ . t ( "common.scopes" ) + '</span> '
297
283
) ;
298
284
299
- $ . when ( this . model . fetchIfNeeded ( { success :function ( e ) { $ ( '#loading-scopes' ) . addClass ( 'label-success' ) ; } } ) )
285
+ $ . when ( this . model . fetchIfNeeded ( { success :function ( e ) { $ ( '#loading-scopes' ) . addClass ( 'label-success' ) ; } , error : app . errorHandlerView . handleError ( ) } ) )
300
286
. done ( function ( ) {
301
287
$ ( '#loadingbox' ) . sheet ( 'hide' ) ;
302
288
callback ( ) ;
@@ -340,21 +326,7 @@ var SystemScopeFormView = Backbone.View.extend({
340
326
app . systemScopeList . add ( _self . model ) ;
341
327
app . navigate ( 'admin/scope' , { trigger : true } ) ;
342
328
} ,
343
- error :function ( error , response ) {
344
-
345
- //Pull out the response text.
346
- var responseJson = JSON . parse ( response . responseText ) ;
347
-
348
- //Display an alert with an error message
349
- $ ( '#modalAlert div.modal-header' ) . html ( responseJson . error ) ;
350
- $ ( '#modalAlert div.modal-body' ) . html ( responseJson . error_description ) ;
351
-
352
- $ ( "#modalAlert" ) . modal ( { // wire up the actual modal functionality and show the dialog
353
- "backdrop" : "static" ,
354
- "keyboard" : true ,
355
- "show" : true // ensure the modal is shown immediately
356
- } ) ;
357
- }
329
+ error :app . errorHandlerView . handleError ( )
358
330
} ) ;
359
331
}
360
332
0 commit comments