@@ -44,7 +44,7 @@ var BlackListListView = Backbone.View.extend({
44
44
'<span class="label" id="loading-blacklist">' + $ . t ( 'admin.blacklist' ) + '</span> '
45
45
) ;
46
46
47
- $ . when ( this . collection . fetchIfNeeded ( { success :function ( e ) { $ ( '#loading-blacklist' ) . addClass ( 'label-success' ) ; } } ) )
47
+ $ . when ( this . collection . fetchIfNeeded ( { success :function ( e ) { $ ( '#loading-blacklist' ) . addClass ( 'label-success' ) ; } , error : app . errorHandlerView . handleError ( ) } ) )
48
48
. done ( function ( ) {
49
49
$ ( '#loadingbox' ) . sheet ( 'hide' ) ;
50
50
callback ( ) ;
@@ -121,20 +121,7 @@ var BlackListListView = Backbone.View.extend({
121
121
_self . collection . add ( item ) ;
122
122
_self . render ( ) ;
123
123
} ,
124
- error :function ( error , response ) {
125
- //Pull out the response text.
126
- var responseJson = JSON . parse ( response . responseText ) ;
127
-
128
- //Display an alert with an error message
129
- $ ( '#modalAlert div.modal-header' ) . html ( responseJson . error ) ;
130
- $ ( '#modalAlert div.modal-body' ) . html ( responseJson . error_description ) ;
131
-
132
- $ ( "#modalAlert" ) . modal ( { // wire up the actual modal functionality and show the dialog
133
- "backdrop" : "static" ,
134
- "keyboard" : true ,
135
- "show" : true // ensure the modal is shown immediately
136
- } ) ;
137
- }
124
+ error :app . errorHandlerView . handleError ( )
138
125
} ) ;
139
126
140
127
}
@@ -182,23 +169,7 @@ var BlackListWidgetView = Backbone.View.extend({
182
169
} ) ;
183
170
} ) ;
184
171
} ,
185
- error :function ( model , response ) {
186
- //Pull out the response text.
187
- var responseJson = { error : 'Error' , error_description : 'Error.' } ;
188
- if ( response ) {
189
- responseJson = JSON . parse ( response . responseText ) ;
190
- }
191
-
192
- //Display an alert with an error message
193
- $ ( '#modalAlert div.modal-header' ) . html ( responseJson . error ) ;
194
- $ ( '#modalAlert div.modal-body' ) . html ( responseJson . error_description ) ;
195
-
196
- $ ( "#modalAlert" ) . modal ( { // wire up the actual modal functionality and show the dialog
197
- "backdrop" : "static" ,
198
- "keyboard" : true ,
199
- "show" : true // ensure the modal is shown immediately
200
- } ) ;
201
- }
172
+ error :app . errorHandlerView . handleError ( )
202
173
} ) ;
203
174
204
175
_self . parentView . delegateEvents ( ) ;
0 commit comments