summaryrefslogtreecommitdiffstats
path: root/public/js/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/js/app.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