install: able to enable console mode (#3119)

This commit is contained in:
Unknwon
2017-03-17 00:16:46 -04:00
parent 171f97868d
commit 2d4dc544be
8 changed files with 98 additions and 93 deletions

View File

@@ -204,76 +204,6 @@ function initCommentForm() {
selectItem('.select-assignee', '#assignee_id');
}
function initInstall() {
if ($('.install').length == 0) {
return;
}
// Database type change detection.
$("#db_type").change(function () {
var sqliteDefault = 'data/gogs.db';
var dbType = $(this).val();
if (dbType === "SQLite3") {
$('#sql_settings').hide();
$('#pgsql_settings').hide();
$('#sqlite_settings').show();
if (dbType === "SQLite3") {
$('#db_path').val(sqliteDefault);
}
return;
}
var dbDefaults = {
"MySQL": "127.0.0.1:3306",
"PostgreSQL": "127.0.0.1:5432",
"MSSQL": "127.0.0.1, 1433"
};
$('#sqlite_settings').hide();
$('#sql_settings').show();
$('#pgsql_settings').toggle(dbType === "PostgreSQL");
$.each(dbDefaults, function(type, defaultHost) {
if ($('#db_host').val() == defaultHost) {
$('#db_host').val(dbDefaults[dbType]);
return false;
}
});
});
// TODO: better handling of exclusive relations.
$('#offline-mode input').change(function () {
if ($(this).is(':checked')) {
$('#disable-gravatar').checkbox('check');
$('#federated-avatar-lookup').checkbox('uncheck');
}
});
$('#disable-gravatar input').change(function () {
if ($(this).is(':checked')) {
$('#federated-avatar-lookup').checkbox('uncheck');
} else {
$('#offline-mode').checkbox('uncheck');
}
});
$('#federated-avatar-lookup input').change(function () {
if ($(this).is(':checked')) {
$('#disable-gravatar').checkbox('uncheck');
$('#offline-mode').checkbox('uncheck');
}
});
$('#disable-registration input').change(function () {
if ($(this).is(':checked')) {
$('#enable-captcha').checkbox('uncheck');
}
});
$('#enable-captcha input').change(function () {
if ($(this).is(':checked')) {
$('#disable-registration').checkbox('uncheck');
}
});
}
function initRepository() {
if ($('.repository').length == 0) {
return;
@@ -1424,7 +1354,6 @@ $(document).ready(function () {
searchRepositories();
initCommentForm();
initInstall();
initRepository();
initWikiForm();
initEditForm();