Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/ecomfe/bat-ria into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Justineo committed Dec 29, 2014
2 parents c7e838d + 7d96913 commit b2b13e3
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/mvc/ListAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ define(function (require) {
* 根据新的URL参数刷新列表
*
* @param {er.URL} [url] 新的URL对象,没有时按当前URL刷新
* @fires listchange 跳转后将URL通过事件传递出来,作为child的时候父action可以去修改address bar
* @return {er.Promise} 返回请求的Promise对象
*/
ListAction.prototype.loadList = function (url) {
Expand All @@ -122,6 +123,7 @@ define(function (require) {
return me.model.loadData(url).then(function () {
me.redirect(url, {silent: true});
me.view.refresh();
me.fire('listchange', {url: url});
});
}
};
Expand Down
19 changes: 19 additions & 0 deletions src/mvc/ListModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ define(function (require) {
var util = require('er/util');
var BaseModel = require('./BaseModel');
var batUtil = require('../util');
var Deferred = require('er/Deferred');

/**
* 业务`Model`基类
Expand Down Expand Up @@ -210,7 +211,25 @@ define(function (require) {

return me.listRequester(me.getQuery())
.then(function(data) {
function processError (ex) {
var error = {
success: false,
name: '$prepare',
options: {},
error: ex
};
throw error;
}

me.fill(adaptData(data));

var preparing = me.prepare();
if (Deferred.isPromise(preparing)) {
return preparing.fail(processError);
}
else {
return preparing;
}
});
};

Expand Down
2 changes: 1 addition & 1 deletion src/ui/extension/QuickTip.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ define(
// 引用目标控件的属性值
if (content.charAt(0) === '@') {
var path = content.substring(1).split('.');
var data = this.get('data');
var data = this.data;
if (!data) {
return '';
}
Expand Down
12 changes: 6 additions & 6 deletions src/ui/navigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ define(function (require) {
* @param {string} domId dom元素id
* @param {Array} config 配置数组
*
* @cfg {string} [config.navId] 主导航dom元素id
* @cfg {string} [config.text] 导航文本
* @cfg {string} config.navId 主导航dom元素id
* @cfg {string} config.text 导航文本
* @cfg {string} [config.url] er.url,不包含参数
* @cfg {string} [config.externalUrl] 外部路径,优先跳转
* @cfg {Array} [config.include] 表示是否需要高亮该导航
* 匹配目标均为`er.action.url`,不包含`~`的参数
* @cfg {Array} [config.exclude] 和`include`相反的配置
* 这里的逻辑`exclude`优先级比`include`高,但是也不要两个都配同个规则吧。。
* @cfg {Array} [config.tabs] 子导航,结构和一级导航config中每一项保持一致
* @cfg {Array} config.tabs 导航项,子导航结构和一级导航config中每一项保持一致
* @cfg {string} [config.auth] 与er.permission对应的权限控制
*
* @sample:
Expand Down Expand Up @@ -191,8 +191,8 @@ define(function (require) {
* 展示或隐藏二级导航
*
* @param {Object} navItems 缓存导航的集合,传入来记录当前高亮的索引
* @param {Object} element 要展示的子tab,不传表示隐藏所有
* @param {string} index 要展示的导航索引
* @param {Object} [element] 要展示的子tab,不传表示隐藏所有
* @param {string} [index] 要展示的导航索引
*/
function toggleSubNav(navItems, element, index) {
var className = 'nav-sub-current';
Expand Down Expand Up @@ -220,7 +220,7 @@ define(function (require) {
* @param {Object} config globalconfig
* @param {Object} navItems 缓存nav元素的对象
* @param {Object} nav nav父元素
* @param {string} isSub {''|'sub-'},主导航或二级子导航
* @param {string} [isSub] {''|'sub-'},主导航或二级子导航
*/
function createNavElements(config, navItems, nav, isSub) {
isSub = isSub || '';
Expand Down

0 comments on commit b2b13e3

Please sign in to comment.