mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-01 11:06:06 +01:00
Fix presentation of index page and sign-in page.
This commit is contained in:
@@ -2,12 +2,13 @@ package app
|
||||
|
||||
import service._
|
||||
|
||||
class IndexController extends IndexControllerBase with RepositoryService with AccountService
|
||||
class IndexController extends IndexControllerBase with RepositoryService with AccountService with SystemSettingsService
|
||||
|
||||
trait IndexControllerBase extends ControllerBase { self: RepositoryService =>
|
||||
trait IndexControllerBase extends ControllerBase { self: RepositoryService with SystemSettingsService =>
|
||||
|
||||
get("/"){
|
||||
html.index(getAccessibleRepositories(context.loginAccount, baseUrl))
|
||||
html.index(getAccessibleRepositories(context.loginAccount, baseUrl), loadSystemSettings(),
|
||||
context.loginAccount.map{ account => getRepositoryNamesOfUser(account.userName) }.getOrElse(Nil))
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,7 +31,7 @@ trait SignInControllerBase extends ControllerBase { self: SystemSettingsService
|
||||
|
||||
get("/signout"){
|
||||
session.invalidate
|
||||
redirect("/signin")
|
||||
redirect("/")
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,12 @@
|
||||
@(account: Option[model.Account])(implicit context: app.Context)
|
||||
@import context._
|
||||
@import view.helpers._
|
||||
@html.main((if(account.isDefined) "Your Profile" else "Create account")){
|
||||
@html.main((if(account.isDefined) "Edit your profile" else "Create your account")){
|
||||
@if(account.isDefined){
|
||||
<h3>Edit your profile</h3>
|
||||
} else {
|
||||
<h3>Create your account</h3>
|
||||
}
|
||||
<form action="@if(account.isDefined){@url(account.get.userName)/_edit}else{/register}" method="POST" validate="true">
|
||||
@if(account.isEmpty){
|
||||
<fieldset>
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
@(repositories: List[service.RepositoryService.RepositoryInfo])(implicit context: app.Context)
|
||||
@(repositories: List[service.RepositoryService.RepositoryInfo], systemSettings: service.SystemSettingsService.SystemSettings,
|
||||
userRepositories: List[String])(implicit context: app.Context)
|
||||
@import context._
|
||||
@import view.helpers._
|
||||
@main("GitBucket"){
|
||||
<div class="row-fluid">
|
||||
<div class="span8">
|
||||
<h3>Recent updated repositories</h3>
|
||||
@repositories.map { repository =>
|
||||
<div class="block">
|
||||
<div class="block-header-2">
|
||||
<div class="block-header">
|
||||
<a href="@url(repository.owner)">@repository.owner</a>
|
||||
/
|
||||
<a href="@url(repository)">@repository.name</a>
|
||||
@@ -19,4 +22,23 @@
|
||||
<div><span class="muted small">Last updated: @datetime(repository.repository.lastActivityDate)</span></div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="span4">
|
||||
@if(loginAccount.isEmpty){
|
||||
@signinform(systemSettings)
|
||||
} else {
|
||||
<table class="table table-bordered">
|
||||
<tr>
|
||||
<th>Your repositories (@userRepositories.size)</th>
|
||||
</tr>
|
||||
@userRepositories.map { repositoryName =>
|
||||
<tr>
|
||||
<td><a href="@path/@loginAccount.get.userName/@repositoryName">@repositoryName</a></td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
}
|
||||
@@ -1,18 +1,7 @@
|
||||
@(systemSettings: service.SystemSettingsService.SystemSettings)(implicit context: app.Context)
|
||||
@import context._
|
||||
@main("Sign in"){
|
||||
<form action="@path/signin" method="POST" validate="true">
|
||||
<label for="userName">Username</label>
|
||||
<input type="text" name="userName" id="userName"/>
|
||||
<span id="error-userName" class="error"></span>
|
||||
<label for="password">Password</label>
|
||||
<input type="password" name="password" id="password"/>
|
||||
<span id="error-password" class="error"></span>
|
||||
<div>
|
||||
<input type="submit" class="btn btn-success" value="Sign in"/>
|
||||
@if(systemSettings.allowAccountRegistration){
|
||||
<a href="@path/register" class="btn">Create new account</a>
|
||||
}
|
||||
</div>
|
||||
</form>
|
||||
<div class="signin-form">
|
||||
@signinform(systemSettings)
|
||||
</div>
|
||||
}
|
||||
|
||||
25
src/main/twirl/signinform.scala.html
Normal file
25
src/main/twirl/signinform.scala.html
Normal file
@@ -0,0 +1,25 @@
|
||||
@(systemSettings: service.SystemSettingsService.SystemSettings)(implicit context: app.Context)
|
||||
@import context._
|
||||
<table class="table table-bordered">
|
||||
<tr>
|
||||
<th>Sign in</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<form action="@path/signin" method="POST" validate="true">
|
||||
<label for="userName">Username</label>
|
||||
<input type="text" name="userName" id="userName" style="width: 95%"/>
|
||||
<span id="error-userName" class="error"></span>
|
||||
<label for="password">Password</label>
|
||||
<input type="password" name="password" id="password" style="width: 95%"/>
|
||||
<span id="error-password" class="error"></span>
|
||||
<div>
|
||||
<input type="submit" class="btn btn-success" value="Sign in"/>
|
||||
@if(systemSettings.allowAccountRegistration){
|
||||
<a href="@path/register" class="btn">Create new account</a>
|
||||
}
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -172,6 +172,11 @@ hr {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
div.signin-form {
|
||||
width: 350px;
|
||||
margin: 30px auto;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
/* Repository Viewer */
|
||||
/****************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user