| |
---|
| | issueId: Option[Int], |
---|
| | diff: Option[String] |
---|
| | ) |
---|
| | |
---|
| | case class TagForm( |
---|
| | commitId: String, |
---|
| | tagName: String, |
---|
| | message: Option[String] |
---|
| | ) |
---|
| | |
---|
| | val uploadForm = mapping( |
---|
| | "branch" -> trim(label("Branch", text(required))), |
---|
| | "path" -> trim(label("Path", text())), |
---|
| | "uploadFiles" -> trim(label("Upload files", text(required))), |
---|
| |
---|
| | "content" -> trim(label("Content", text(required))), |
---|
| | "issueId" -> trim(label("Issue Id", optional(number()))), |
---|
| | "diff" -> optional(text()) |
---|
| | )(CommentForm.apply) |
---|
| | |
---|
| | val tagForm = mapping( |
---|
| | "commitId" -> trim(label("Commit id", text(required))), |
---|
| | "tagName" -> trim(label("Tag name", text(required))), |
---|
| | "message" -> trim(label("Message", optional(text()))) |
---|
| | )(TagForm.apply) |
---|
| | |
---|
| | /** |
---|
| | * Returns converted HTML from Markdown for preview. |
---|
| | */ |
---|
| |
---|
| | html.branches(branches, hasDeveloperRole(repository.owner, repository.name, context.loginAccount), repository) |
---|
| | }) |
---|
| | |
---|
| | /** |
---|
| | * Creates a tag |
---|
| | */ |
---|
| | post("/:owner/:repository/tags")(writableUsersOnly { repository => |
---|
| | val tagName = params.getOrElse("name", halt(400)) |
---|
| | val message = params.getOrElse("message", halt(400)) |
---|
| | val commitId = params.getOrElse("commit", halt(400)) |
---|
| | * Displays the create tag dialog. |
---|
| | */ |
---|
| | get("/:owner/:repository/tag/:id")(writableUsersOnly { repository => |
---|
| | html.tag(params("id"), repository) |
---|
| | }) |
---|
| | |
---|
| | /** |
---|
| | * Creates a tag. |
---|
| | */ |
---|
| | post("/:owner/:repository/tag", tagForm)(writableUsersOnly { (form, repository) => |
---|
| | using(Git.open(getRepositoryDir(repository.owner, repository.name))) { git => |
---|
| | JGitUtil.createTag(git, tagName, message, commitId) |
---|
| | JGitUtil.createTag(git, form.tagName, form.message, form.commitId) |
---|
| | } match { |
---|
| | case Right(message) => |
---|
| | flash += "info" -> message |
---|
| | redirect(s"/${repository.owner}/${repository.name}/commit/${commitId}") |
---|
| | redirect(s"/${repository.owner}/${repository.name}/commit/${form.commitId}") |
---|
| | case Left(message) => |
---|
| | flash += "error" -> message |
---|
| | redirect(s"/${repository.owner}/${repository.name}/commit/${commitId}") |
---|
| | redirect(s"/${repository.owner}/${repository.name}/commit/${form.commitId}") |
---|
| | } |
---|
| | }) |
---|
| | |
---|
| | /** |
---|
| |
---|
| | |