update install page ui

This commit is contained in:
FuXiaoHei 2014-03-27 20:39:18 +08:00
parent ce679cce52
commit c796ed3849
2 changed files with 171 additions and 31 deletions

View File

@ -352,6 +352,24 @@ function initRepository() {
}()); }());
} }
function initInstall(){
$('#install-database').on("change", function () {
var val = $(this).val();
if (val != "sqlite") {
$('.server-sql').show();
$('.sqlite-setting').addClass("hide");
if (val == "pgsql") {
$('.pgsql-setting').removeClass("hide");
} else {
$('.pgsql-setting').addClass("hide");
}
} else {
$('.server-sql').hide();
$('.sqlite-setting').removeClass("hide");
}
});
}
(function ($) { (function ($) {
$(function () { $(function () {
initCore(); initCore();
@ -365,5 +383,8 @@ function initRepository() {
if ($('.repo-nav').length) { if ($('.repo-nav').length) {
initRepository(); initRepository();
} }
if($('#install-card').length){
initInstall();
}
}); });
})(jQuery); })(jQuery);

View File

@ -2,44 +2,81 @@
<div id="body" class="container"> <div id="body" class="container">
<form action="/install" method="post" class="form-horizontal card" id="install-card"> <form action="/install" method="post" class="form-horizontal card" id="install-card">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<h3>Install Steps</h3> <h3>Install Steps For First Running</h3>
<div class="alert alert-danger form-error{{if .HasError}}{{else}} hidden{{end}}">{{.ErrorMsg}}</div> <div class="alert alert-danger form-error{{if .HasError}}{{else}} hidden{{end}}">{{.ErrorMsg}}</div>
<p class="help-block text-center">GoGits need MySQL or PostgreSQL server</p> <p class="help-block text-center">GoGits need MySQL or PostgreSQL server</p>
<div class="form-group {{if .Err_User}}has-error has-feedback{{end}}"> <div class="form-group">
<label class="col-md-3 control-label"><strong>MySQL </strong>Host: </label> <label class="col-md-3 control-label">Database Type: </label>
<div class="col-md-8"> <div class="col-md-8">
<input name="host" class="form-control" placeholder="Type mysql server ip or domain" value="localhost" required="required"> <select name="database" id="install-database" class="form-control">
<option value="mysql">MySQL</option>
<option value="pgsql">PostgreSQL</option>
<option value="sqlite">SQLite</option>
</select>
</div> </div>
</div> </div>
<div class="form-group {{if .Err_User}}has-error has-feedback{{end}}"> <div class="server-sql">
<label class="col-md-3 control-label">Port: </label> <div class="form-group">
<div class="col-md-8"> <label class="col-md-3 control-label">Host: </label>
<input name="port" class="form-control" placeholder="Type mysql server port" value="3306" required="required">
<div class="col-md-8">
<input name="host" class="form-control" placeholder="Type mysql server ip or domain" value="localhost" required="required">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Port: </label>
<div class="col-md-8">
<input name="port" class="form-control" placeholder="Type mysql server port" value="3306" required="required">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">User: </label>
<div class="col-md-8">
<input name="user" class="form-control" placeholder="Type mysql username" required="required">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Password: </label>
<div class="col-md-8">
<input name="passwd" type="password" class="form-control" placeholder="Type mysql password" required="required">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Database: </label>
<div class="col-md-8">
<input name="database" type="text" class="form-control" placeholder="Type mysql database name" value="gogs" required="required">
<p class="help-block">Recommend use INNODB engine with utf8_general_ci charset.</p>
</div>
</div>
<div class="form-group pgsql-setting hide">
<label class="col-md-3 text-right">SSL MODE: </label>
<div class="col-md-8">
<input name="ssl-mode" type="checkbox" class="form-control">
<p class="help-block">Use SSL protocol to connect PostgreSQL.</p>
</div>
</div> </div>
</div> </div>
<div class="form-group {{if .Err_User}}has-error has-feedback{{end}}"> <div class="sqlite-setting hide">
<label class="col-md-3 control-label">User: </label> <div class="form-group">
<div class="col-md-8"> <label class="col-md-3 control-label">Path: </label>
<input name="user" class="form-control" placeholder="Type mysql username" required="required">
</div> <div class="col-md-8">
</div> <input name="path" class="form-control" placeholder="Type sqlite file path" value="xxx/file.db">
<div class="form-group {{if .Err_Password}}has-error has-feedback{{end}}"> <p class="help-block">The file path of SQLite database.</p>
<label class="col-md-3 control-label">Password: </label> </div>
<div class="col-md-8">
<input name="passwd" type="password" class="form-control" placeholder="Type mysql password" required="required">
</div>
</div>
<div class="form-group {{if .Err_Password}}has-error has-feedback{{end}}">
<label class="col-md-3 control-label">Database: </label>
<div class="col-md-8">
<input name="database" type="text" class="form-control" placeholder="Type mysql database name" value="gogs" required="required">
<p class="help-block">Recommend use INNODB engine with utf8_general_ci charset.</p>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-md-8 col-md-offset-3"> <div class="col-md-8 col-md-offset-3">
<button class="btn btn-sm btn-info">Test Connection</button> <button class="btn btn-sm btn-info">Test Connection</button>
</div> </div>
</div> </div>
@ -47,24 +84,106 @@
<p class="help-block text-center">General settings for GoGits</p> <p class="help-block text-center">General settings for GoGits</p>
<div class="form-group {{if .Err_Password}}has-error has-feedback{{end}}"> <div class="form-group">
<label class="col-md-3 control-label">Repository Path: </label> <label class="col-md-3 control-label">Repository Path: </label>
<div class="col-md-8"> <div class="col-md-8">
<input name="repo-path" type="text" class="form-control" placeholder="Type your repository directory" value="/var/gogs/repostiory" required="required"> <input name="repo-path" type="text" class="form-control" placeholder="Type your repository directory" value="/var/gogs/repostiory" required="required">
<p class="help-block">The git copy of each repository is saved in this directory.</p> <p class="help-block">The git copy of each repository is saved in this directory.</p>
</div> </div>
</div> </div>
<div class="form-group {{if .Err_Password}}has-error has-feedback{{end}}"> <div class="form-group">
<label class="col-md-3 control-label">System User: </label> <label class="col-md-3 control-label">Run User: </label>
<div class="col-md-8"> <div class="col-md-8">
<input name="system-user" type="text" class="form-control" placeholder="Type mysql password" value="root" required="required"> <input name="system-user" type="text" class="form-control" placeholder="Type mysql password" value="root" required="required">
<p class="help-block">The user has access to visit and run GoGits.</p> <p class="help-block">The user has access to visit and run GoGits.</p>
</div> </div>
</div> </div>
<hr/> <hr/>
<div class="form-group text-center">
<a class="btn btn-danger btn-lg">Install GoGits</a> <p class="help-block text-center">Admin Account Settings</p>
<div class="form-group">
<label class="col-md-3 control-label">Username: </label>
<div class="col-md-8">
<input name="repo-path" type="text" class="form-control" placeholder="Type admin user name" value="admin" required="required">
</div>
</div> </div>
<div class="form-group">
<label class="col-md-3 control-label">Password: </label>
<div class="col-md-8">
<input name="system-user" type="password" class="form-control" placeholder="Type admin user password" required="required">
</div>
</div>
<hr/>
<div class="form-group text-center">
<button class="btn btn-danger btn-lg">Install GoGits</button>
<button class="btn btn-default btn-sm" type="button" data-toggle="modal" data-target="#advance-options-modal">
Advanced Options
</button>
</div>
<div class="modal fade" id="advance-options-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header"><h4 class="modal-title">Advanced Options</h4></div>
<div class="modal-body">
<p class="help-block text-center">Email Service Settings</p>
<div class="form-group">
<label class="col-md-3 control-label">SMTP Host: </label>
<div class="col-md-8">
<input name="repo-path" type="text" class="form-control" placeholder="Type admin user name">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Email: </label>
<div class="col-md-8">
<input name="repo-path" type="text" class="form-control" placeholder="Type admin user name">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Password: </label>
<div class="col-md-8">
<input name="system-user" type="password" class="form-control" placeholder="Type admin user password">
</div>
</div>
<hr/>
<p class="text-center help-block">Notification Settings</p>
<div class="form-group">
<label class="col-md-6 text-right">Enable Register Confirmation: </label>
<div class="col-md-4">
<input name="system-user" type="checkbox" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-md-6 text-right">Enable Mail Notification: </label>
<div class="col-md-4">
<input name="system-user" type="checkbox" class="form-control">
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success" data-dismiss="modal">Confirm</button>
</div>
</div>
</div>
</div>
</form> </form>
</div> </div>
{{template "base/footer" .}} {{template "base/footer" .}}