Skip to content

Commit

Permalink
Merge pull request #81 from ecomfe/dev
Browse files Browse the repository at this point in the history
v0.2.7
  • Loading branch information
Justineo committed Sep 16, 2015
2 parents a37ff56 + 7c9c415 commit 6ae2208
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
* 0.2.7
- 修正 `list.tpl.html` 遗漏了一处 batch block 的问题
- 增加 `.ui-item` 样式,用于在 `.ui-row` 内与控件一起正确排列
- 增加了在 model 中注册 API 请求方法的功能,以后不允许直接在 action 发起 API 请求,而需要调用注册在 model 上的方法

* 0.2.6
- 增加 `system/session` 模块
- `ListView` 原型增加 `batchModify` 方法,提供批量操作在 View 层的扩展点
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bat-ria",
"version": "0.2.6",
"version": "0.2.7",
"description": "RIA extension for Brand Ads Team",
"main": "main.js",
"repository": {
Expand Down
3 changes: 2 additions & 1 deletion src/css/ui.less
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
&,
.ui-group,
.form-value {
& > [data-ctrl-id] {
& > [data-ctrl-id],
& > .ui-item {
float: left;
margin-left: 10px;

Expand Down
2 changes: 2 additions & 0 deletions src/mvc/BaseAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ define(function (require) {
model = new BaseModel(args);
}

model.registerRequesters();

return model;
};

Expand Down
25 changes: 25 additions & 0 deletions src/mvc/BaseModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,31 @@ define(function (require) {
return this.$super(arguments);
};


/**
* api请求
*/
exports.requesters = {};

/**
* 获取api请求,默认直接返回`this.requesters`
*
* @return {Object}
*/
exports.getRequesters = function () {
return this.requesters;
};

/**
* 注册api,将api的名称添加`request`前缀,注册为model的方法
*/
exports.registerRequesters = function () {
var me = this;
u.each(this.getRequesters(), function (requester, name) {
me['request' + u.pascalize(name)] = requester;
});
};

var BaseModel = require('eoo').create(UIModel, exports);
return BaseModel;
});
6 changes: 5 additions & 1 deletion src/tpl/list.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,16 @@
<!-- block: summaryContent --><!-- /block -->
</div>
<!-- /block -->

<!-- block: filter -->
<form data-ui-type="Form" data-ui-id="filter" class="list-filter">
<!-- block: filterContent --><!-- /block -->
</form>
<!-- /block -->
<!-- block: batch -->
<div class="list-batch">
<!-- block: batchContent --><!-- /block -->
</div>
<!-- /block -->
</div>
<!-- /block -->
<!-- block: table -->
Expand Down

0 comments on commit 6ae2208

Please # to comment.