aboutsummaryrefslogtreecommitdiffstats
path: root/public
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-09-10 14:55:29 -0400
committerUnknwon <u@gogs.io>2015-09-10 14:55:29 -0400
commitcbd6276200751f4b64a203767f0f454c3346fca1 (patch)
tree9f0ad4f59e40dbb4f3cdad045611fce382fa9f8e /public
parent52ec80fa18bf991c6356b7aa972a1d3983aa20c3 (diff)
parentb954a22ce28d74021f0d4896e281aabc93eed938 (diff)
downloadgitea-cbd6276200751f4b64a203767f0f454c3346fca1.tar.gz
gitea-cbd6276200751f4b64a203767f0f454c3346fca1.zip
Merge branch 'develop' of https://github.com/SergioBenitez/gogs into develop
# Conflicts: # modules/bindata/bindata.go
Diffstat (limited to 'public')
-rw-r--r--public/ng/js/gogs.js32
1 files changed, 14 insertions, 18 deletions
diff --git a/public/ng/js/gogs.js b/public/ng/js/gogs.js
index e4a0afe9f9..f804816292 100644
--- a/public/ng/js/gogs.js
+++ b/public/ng/js/gogs.js
@@ -57,10 +57,10 @@ var Gogs = {};
});
$.fn.extend({
toggleHide: function () {
- $(this).addClass("hidden");
+ $(this).each(function(n, v) { $(v).addClass("hidden"); });
},
toggleShow: function () {
- $(this).removeClass("hidden");
+ $(this).each(function(n, v) { $(v).removeClass("hidden"); });
},
toggleAjax: function (successCallback, errorCallback) {
var url = $(this).data("ajax");
@@ -775,24 +775,20 @@ function initAdmin() {
$form.attr('action', $form.data('delete-url'));
});
- // Create authorization.
+ // Create authorization. Keep list in sync with models/login.go.
+ var all_auths = ['none', 'plain', 'ldap', 'dldap', 'smtp', 'pam'];
$('#auth-type').on("change", function () {
var v = $(this).val();
- if (v == 2) {
- $('.ldap').toggleShow();
- $('.smtp').toggleHide();
- $('.pam').toggleHide();
- }
- if (v == 3) {
- $('.smtp').toggleShow();
- $('.ldap').toggleHide();
- $('.pam').toggleHide();
- }
- if (v == 4) {
- $('.pam').toggleShow();
- $('.smtp').toggleHide();
- $('.ldap').toggleHide();
- }
+ if (v >= all_auths.length) return;
+
+ // Hide all through their class names.
+ $.each(all_auths, function(i, type) {
+ $('.' + type).toggleHide();
+ });
+
+ // Show the selected one.
+ var selected = all_auths[v];
+ $('.' + selected).toggleShow();
});
// Delete authorization.