mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-09 15:05:50 +01:00
Start to implement WikiController.
Changed controllers from servlet to filter by mapping flexibility.
This commit is contained in:
@@ -11,7 +11,7 @@ import jp.sf.amateras.scalatra.forms._
|
||||
/**
|
||||
* Creates new repository.
|
||||
*/
|
||||
class CreateRepositoryServlet extends ServletBase {
|
||||
class CreateRepositoryController extends ControllerBase {
|
||||
|
||||
case class RepositoryCreationForm(name: String, description: String)
|
||||
|
||||
@@ -64,7 +64,7 @@ case class ContentInfo(viewType: String, content: Option[String])
|
||||
/**
|
||||
* The repository viewer.
|
||||
*/
|
||||
class RepositoryViewerServlet extends ServletBase {
|
||||
class RepositoryViewerController extends ControllerBase {
|
||||
|
||||
/**
|
||||
* Displays user information.
|
||||
@@ -9,7 +9,7 @@ import jp.sf.amateras.scalatra.forms._
|
||||
/**
|
||||
* Provides generic features for ScalatraServlet implementations.
|
||||
*/
|
||||
abstract class ServletBase extends ScalatraServlet with ClientSideValidationFormSupport with JacksonJsonSupport {
|
||||
abstract class ControllerBase extends ScalatraFilter with ClientSideValidationFormSupport with JacksonJsonSupport {
|
||||
|
||||
implicit val jsonFormats = DefaultFormats
|
||||
|
||||
|
||||
9
src/main/scala/app/UsersController.scala
Normal file
9
src/main/scala/app/UsersController.scala
Normal file
@@ -0,0 +1,9 @@
|
||||
package app
|
||||
|
||||
class UsersController extends ControllerBase {
|
||||
|
||||
get("/"){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package app
|
||||
|
||||
class UsersServlet extends ServletBase {
|
||||
|
||||
get("/"){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
14
src/main/scala/app/WikiController.scala
Normal file
14
src/main/scala/app/WikiController.scala
Normal file
@@ -0,0 +1,14 @@
|
||||
package app
|
||||
|
||||
import util.{WikiUtil, JGitUtil}
|
||||
|
||||
class WikiController extends ControllerBase {
|
||||
|
||||
get("/:owner/:repository/wiki"){
|
||||
val owner = params("owner")
|
||||
val repository = params("repository")
|
||||
|
||||
html.wiki(WikiUtil.getPage(owner, repository, "Home"), JGitUtil.getRepositoryInfo(owner, repository, servletContext))
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user