aboutsummaryrefslogtreecommitdiff
path: root/public/js/app.js
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2014-04-30 10:24:00 +0800
committerLunny Xiao <xiaolunwen@gmail.com>2014-04-30 10:24:00 +0800
commita85f242030f8fa0d74c9d82485d0649926bc6db4 (patch)
tree43c7850b7c01c635d36f368c108f6305b10e13f2 /public/js/app.js
parentcdc843f06b90acf71211a684ba32cd92c765230d (diff)
parent0d6856dbe73c8041451743946fb324663350a687 (diff)
Merge branch 'dev' of github.com:gogits/gogs into dev
Diffstat (limited to 'public/js/app.js')
-rw-r--r--public/js/app.js19
1 files changed, 17 insertions, 2 deletions
diff --git a/public/js/app.js b/public/js/app.js
index a5c79a39..30e9d5d0 100644
--- a/public/js/app.js
+++ b/public/js/app.js
@@ -468,13 +468,28 @@ function initRepository() {
function initInstall() {
// database type change
(function () {
+ var mysql_default = '127.0.0.1:3306'
+ var postgres_default = '127.0.0.1:5432'
+
$('#install-database').on("change", function () {
var val = $(this).val();
- if (val != "sqlite") {
+ if (val != "SQLite3") {
$('.server-sql').show();
$('.sqlite-setting').addClass("hide");
- if (val == "pgsql") {
+ if (val == "PostgreSQL") {
$('.pgsql-setting').removeClass("hide");
+
+ // Change the host value to the Postgres default, but only
+ // if the user hasn't already changed it from the MySQL
+ // default.
+ if ($('#database-host').val() == mysql_default) {
+ $('#database-host').val(postgres_default);
+ }
+ } else if (val == 'MySQL') {
+ $('.pgsql-setting').addClass("hide");
+ if ($('#database-host').val() == postgres_default) {
+ $('#database-host').val(mysql_default);
+ }
} else {
$('.pgsql-setting').addClass("hide");
}