Skip to content

Commit

Permalink
bug
Browse files Browse the repository at this point in the history
  • Loading branch information
yidashi committed Jul 6, 2016
1 parent 3805ce5 commit 553f2f7
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 50 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"yiisoft/yii2-sphinx": "^2.0",
"dmstr/yii2-adminlte-asset": "*",
"yiisoft/yii2-composer": "2.0.4",
"yidashi/yii2-bootstrap-markdown": "^1.0",
"yidashi/yii2-webuploader": "1.2.0",
"yidashi/yii2-bootstrap-markdown": "2.0.0",
"yidashi/yii2-webuploader": "1.2.1",
"yidashi/yii2-ueditor": "1.0.1",
"mihaildev/yii2-elfinder": "^1.0",
"qiniu/php-sdk": "^7.0",
Expand Down
90 changes: 45 additions & 45 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 38 additions & 3 deletions web/js/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ $(function(){
$('#modal').modal({ remote: XMLHttpRequest.getResponseHeader('X-Redirect')});
}
if(XMLHttpRequest.status == 403){
$('#modal').modal({ remote: SITE_URL + '/site/login'});
$.modalLogin();
}
this.abort();

Expand Down Expand Up @@ -56,7 +56,7 @@ $(function(){
$('#modal').modal({ remote: XMLHttpRequest.getResponseHeader('X-Redirect')});
}
if(XMLHttpRequest.status == 403){
$('#modal').modal({ remote: SITE_URL + '/site/login'});
$.modalLogin();
}
this.abort();
}
Expand Down Expand Up @@ -91,11 +91,46 @@ $(function(){
$('#modal').modal({ remote: XMLHttpRequest.getResponseHeader('X-Redirect')});
}
if(XMLHttpRequest.status == 403){
$('#modal').modal({ remote: SITE_URL + '/site/login'});
$.modalLogin();
}
this.abort();
}
});
return false;
});
});

jQuery.extend({
modalLoad: function(url, data, callback) {
$('#modal .modal-body').load(url, data, callback);
$('#modal').modal();
},
modalLogin: function() {
$('#modal .modal-title').text('需要登录');
$('#modal .modal-body').load(SITE_URL + '/site/login');
$('#modal').modal();
},
modalAlert: function(content) {
$('#modal .modal-title').text('友情提示');
$('#modal .modal-body').html('<p>' + content + '</p>');
$('#modal .modal-footer').html('<button type="button" class="btn btn-default" data-dismiss="modal">确定</button>');
$('#modal').modal();
},
modalConfirm: function(object) {
$('#modal .modal-title').text('确认');
$('#modal .modal-body').html('<p>' + object.attr('data-confirm') + '</p>');
$('#modal .modal-footer').html('<a class="btn btn-primary" href="' + object.attr('href') + '" data-method="post">确定</a><button type="button" class="btn btn-default" data-dismiss="modal">取消</button>');
$('#modal').modal();
},
modalPrompt: function() {
}
});

window.alert = $.modalAlert;
$("[data-confirm]").click(function() {
$.modalConfirm($(this));
return false;
});
$(".modal").on("hidden.bs.modal", function() {
$(this).removeData("bs.modal");
});

0 comments on commit 553f2f7

Please sign in to comment.