Fix the index page.

This commit is contained in:
takezoe
2013-06-03 01:36:35 +09:00
parent 1ab58d0363
commit b2af70d611
6 changed files with 45 additions and 13 deletions

View File

@@ -84,7 +84,7 @@ trait CreateRepositoryControllerBase extends ControllerBase { self: ProjectServi
def validate(name: String, value: String): Option[String] = {
if(!value.matches("^[a-zA-Z0-9\\-_]+$")){
Some("Repository name contains invalid character.")
} else if(getRepositories(context.loginAccount.get.userName, servletContext).contains(value)){
} else if(getRepositoriesOfUser(context.loginAccount.get.userName, servletContext).contains(value)){
Some("Repository already exists.")
} else {
None

View File

@@ -1,9 +1,13 @@
package app
class IndexController extends ControllerBase {
import service._
class IndexController extends IndexControllerBase with ProjectService with AccountService
trait IndexControllerBase extends ControllerBase { self: ProjectService =>
get("/"){
html.index()
html.index(getAccessibleRepositories(context.loginAccount, servletContext))
}
}

View File

@@ -25,7 +25,7 @@ trait RepositoryViewerControllerBase extends ControllerBase { self: ProjectServi
get("/:owner") {
val owner = params("owner")
html.user(getAccountByUserName(owner).get, getRepositories(owner, servletContext))
html.user(getAccountByUserName(owner).get, getRepositoriesOfUser(owner, servletContext))
}
/**