升级 avalon 到1.5.4,增加 pager 的 web 组件。修复升级带来的部分兼容性问题

This commit is contained in:
virusdefender 2015-10-16 20:44:41 +08:00
parent 723b26a828
commit e7aa9ce9a6
7 changed files with 11570 additions and 5 deletions

View File

@ -1,4 +1,4 @@
require(["jquery", "avalon", "bootstrap"], function ($, avalon) {
require(["jquery", "avalon", "csrfToken", "bsAlert", "bootstrap"], function ($, avalon, csrfTokenHeader, bsAlert) {
avalon.ready(function () {
@ -155,7 +155,15 @@ require(["jquery", "avalon", "bootstrap"], function ($, avalon) {
show_template("template/" + hash + ".html");
}
};
setTimeout(function(){li_active("#li-" + hash.replace("/", "-"));}, 500)
setTimeout(function(){li_active("#li-" + hash.replace("/", "-"));}, 500);
$.ajaxSetup({
beforeSend: csrfTokenHeader,
dataType: "json",
error: function(){
bsAlert("请求失败");
}
});
});

View File

@ -0,0 +1,32 @@
define("pager", ["avalon"], function (avalon) {
var _interface = function () {
};
avalon.component("ms:pager", {
$template: "页数: {{ currentPage }}/{{ totalPage }} " +
"<button ms-class=\"{{ currentPage==1?'btn btn-primary disabled':'btn btn-primary' }}\" ms-click=\"_getPrevPage\">上一页</button> " +
" <button ms-class=\"{{ currentPage==totalPage?'btn btn-primary disabled':'btn btn-primary' }}\" ms-click=\"_getNextPage\">下一页</button>",
currentPage: 1,
totalPage: 1,
_getPrevPage: _interface,
_getNextPage: _interface,
$init: function (vm, el) {
vm._getPrevPage = function () {
if (vm.currentPage > 1) {
vm.currentPage--;
vm.getPage(vm.currentPage);
}
};
vm._getNextPage = function () {
if (vm.currentPage < vm.totalPage) {
vm.currentPage++;
vm.getPage(vm.currentPage);
}
};
},
$ready: function(vm, el){
el.msRetain = true;
vm.getPage(1);
}
})
});

View File

@ -6,6 +6,7 @@ var require = {
jquery: "lib/jquery/jquery",
jcountdown: "lib/jcountdown/jcountdown",
avalon: "lib/avalon/avalon",
//avalon15: "lib/avalon/avalon15",
editor: "utils/editor",
uploader: "utils/uploader",
formValidation: "utils/formValidation",
@ -23,6 +24,9 @@ var require = {
validator: "lib/validator/validator",
ZeroClipboard: "lib/ZeroClipboard/ZeroClipboard",
// ------ admin web 组件 ----------
pager: "components/pager",
// ------ 下面写的都不要直接用,而是使用上面的封装版本 ------
//富文本编辑器simditor -> editor
@ -69,5 +73,10 @@ var require = {
contestPassword_19_pack: "app/oj/contest/contestPassword",
group_20_pack: "app/admin/group/group",
submissionList_21_pack: "app/admin/contest/submissionList"
},
shim: {
avalon: {
exports: "avalon"
}
}
};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -69,8 +69,8 @@
<ul class="list-group">
<div ms-repeat="adminNavList">
<li class="list-group-header">{{ el.name }}</li>
<li class="list-group-item" ms-attr-id="getLiId(item.hash)" ms-repeat-item="el.children">
<a ms-attr-href="el.hash">{{ item.name }}</a>
<li class="list-group-item" ms-repeat-item="el.children" ms-attr-id="getLiId(item.hash)" >
<a ms-attr-href="item.hash">{{ item.name }}</a>
</li>
</div>
</ul>

View File

@ -64,7 +64,7 @@
</div>
<div class="row">
<div class="form-group col-md-4"><label>新密码(留空则保留原密码)</label>
<input name="password" type="password" class="form-control" id="password" ms-duplex="password"
<input name="password" type="password" class="form-control" id="password"
placeholder="此项留空则保留原密码" data-minlength="6" data-minlength-error="密码不得少于6位">
<div class="help-block with-errors"></div>
</div>