summaryrefslogtreecommitdiffstats
path: root/public/js
diff options
context:
space:
mode:
authorFuXiaoHei <fuxiaohei@hexiaz.com>2014-03-10 21:12:49 +0800
committerFuXiaoHei <fuxiaohei@hexiaz.com>2014-03-10 21:12:49 +0800
commitefa039a0f75ff9ba9376af1cbd3d948752c074fc (patch)
treec98399f49124b90f513d2a8e029118802849ef29 /public/js
parent3ca7a33907e674c2c90e9f795b57bf87868f16b7 (diff)
downloadgitea-efa039a0f75ff9ba9376af1cbd3d948752c074fc.tar.gz
gitea-efa039a0f75ff9ba9376af1cbd3d948752c074fc.zip
finish ssh key pages ui
Diffstat (limited to 'public/js')
-rw-r--r--public/js/app.js41
1 files changed, 40 insertions, 1 deletions
diff --git a/public/js/app.js b/public/js/app.js
index 59d521090c..f6e1471204 100644
--- a/public/js/app.js
+++ b/public/js/app.js
@@ -30,7 +30,8 @@ var Gogits = {
return;
}
$.each(modals, function (i, item) {
- $(item).modal("hide");
+ var hide = $(item).data('modal');
+ $(item).modal(hide ? hide : "hide");
});
};
Gogits.initTooltips = function () {
@@ -39,6 +40,30 @@ var Gogits = {
//container: "body"
});
};
+ Gogits.initTabs = function () {
+ var $tabs = $('[data-toggle=tab]');
+ $tabs.tab("show");
+ $tabs.find("li:eq(" + index + ") a").tab("show");
+ }
+})(jQuery);
+
+// ajax utils
+(function ($) {
+ Gogits.ajaxDelete = function (url, data, success) {
+ data = data || {};
+ data._method = "DELETE";
+ $.ajax({
+ url: url,
+ data: data,
+ method: "POST",
+ dataType: "json",
+ success: function (json) {
+ if (success) {
+ success(json);
+ }
+ }
+ })
+ }
})(jQuery);
@@ -72,4 +97,18 @@ function initRegister() {
}
});
});
+}
+
+function initUserSetting(){
+ $('#gogs-ssh-keys').on("click",".delete",function(){
+ var $this = $(this);
+ Gogits.ajaxDelete("",{"id":$this.data("del")},function(json){
+ if(json.ok){
+ $this.parent().remove();
+ }else{
+ alert(json.err);
+ }
+ });
+ return false;
+ });
} \ No newline at end of file