CRM-14931 - Nicer aja handling of statusBounce errors

I believe it will not cause a js error because this.options.crmForm is 
always defined (initialized to null when used without loadForm). And so 
this.options.crmForm.autoClose would be undefined which will fail the 
"truthy" test but not throw an error.

On 07/04/2014 11:48 PM, Tim Otten wrote:
>
> In js/crm.ajax.js:
>
> > @@ -213,6 +213,12 @@
> >        this.element.trigger('crmAjaxFail', data);
> >        CRM.alert(ts('Unable to reach the server. Please refresh this page in your browser and try again.'), ts('Network Error'), 'error');
> >      },
> > +    _onError: function(data) {
> > +      this.element.attr('data-unsaved-changes', 'false').trigger('crmAjaxError', data);
> > +      if (this.options.crmForm.autoClose && this.element.data('uiDialog')) {
>
> Using the autoClose property seems nice -- better than the 
> unconditional approach I used. :)
>
> But... Can't one use $.crmSnippet without $.loadForm? Seems like 
> this.options.crmForm would be undefined or null -- and therefore 
> produce a JS error. (Granted: there aren't many places where 
> statusBounce is used outside a form -- "rgrep statusBounce CRM | grep 
> Page" shows 12. So maybe it's theoretical at this point.)
>
> —
> Reply to this email directly or view it on GitHub 
> <https://github.com/civicrm/civicrm-core/pull/3607/files#r14568377>.
>