Sha256: a14d1205b23c8dc04ad545fcdd3109c6d45f3cdb237f19d0ffb7126a4d61669e

Contents?: true

Size: 1.17 KB

Versions: 4

Compression:

Stored size: 1.17 KB

Contents

/**
*   @class  Wando.callback 
*   @description
*       这个对象是用于封装一些共用性强的回调函数,DRY<br>
*       使用Wando.callback 之后不需要重写 Wando.loadMask.hide(), success与failure两个方法都默认配置<br>
*   @example
*       Wando.callback.success()
*       Wando.callback.failure(respone,opts)
*/
//= require_lib msg
Wando.callback = {
    /**
     *  请求成功的回调函数
     */
    success: function() {
        Wando.loadMask.hide();
        Wando.msg.info('', '操作成功');
    },
    
    /**
     *  请求失败的回调函数
     */
    failure: function(response, opts) {
        Wando.loadMask.hide();
        if(response.status == -1)
            var error_message = '操作超时,网络异常,检查后请重试...';
        else
            var error_message = Ext.decode(response.responseText).root.error_msg;
        Wando.msg.error(
            '', 
            error_message
        );
    },
    
    /**
     *  请求失败的回调函数
     */
    formFailure: function(form, action) {
        Wando.loadMask.hide();
        Wando.msg.error('', Ext.decode(action.response.responseText).root.error_msg);
    }
};

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
view_assets-1.1.1 test/dummy/public/lib/javascripts/callback.js
view_assets-1.0.4 test/dummy/public/lib/javascripts/callback.js
view_assets-1.0.3 test/dummy/public/lib/javascripts/callback.js
view_assets-1.0.0 test/dummy/public/lib/javascripts/callback.js