This commit is contained in:
takezoe
2013-06-20 22:18:04 +09:00
5 changed files with 29 additions and 13 deletions

View File

@@ -23,7 +23,13 @@ trait IssuesControllerBase extends ControllerBase {
}
get("/:owner/:repository/issues/:id"){
issues.html.issue(getRepository(params("owner"), params("repository"), baseUrl).get)
val owner = params("owner")
val repository = params("repository")
val issueId = params("id")
getIssue(owner, repository, issueId) map { issue =>
issues.html.issue(issue, getRepository(owner, repository, baseUrl).get)
} getOrElse NotFound
}
get("/:owner/:repository/issues/new")( usersOnly {

View File

@@ -8,6 +8,15 @@ import Q.interpolation
import model._
trait IssuesService {
def getIssue(owner: String, repository: String, issueId: String) =
if (issueId forall (_.isDigit))
Query(Issues) filter { t =>
(t.userName is owner.bind) &&
(t.repositoryName is repository.bind) &&
(t.issueId is issueId.toInt.bind)
} firstOption
else None
def saveIssue(owner: String, repository: String, loginUser: String,
title: String, content: Option[String]) =
// next id number

View File

@@ -9,14 +9,14 @@ import twirl.api.Html
object helpers {
/**
* Format java.util.Date to "yyyy/MM/dd HH:mm:ss".
* Format java.util.Date to "yyyy-MM-dd HH:mm:ss".
*/
def datetime(date: Date): String = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(date)
def datetime(date: Date): String = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date)
/**
* Format java.util.Date to "yyyy/MM/dd".
* Format java.util.Date to "yyyy-MM-dd".
*/
def date(date: Date): String = new SimpleDateFormat("yyyy/MM/dd").format(date)
def date(date: Date): String = new SimpleDateFormat("yyyy-MM-dd").format(date)
/**
* Converts Markdown of Wiki pages to HTML.

View File

@@ -1,24 +1,25 @@
@(repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context)
@(issue: model.Issue, repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context)
@import context._
@html.main("2.1 migration issue - ebean - Issue #1181 - " + repository.owner + "/" + repository.name){
@import view.helpers._
@html.main("%s - Issue #%d - %s/%s".format(issue.title, issue.issueId, repository.owner, repository.name)){
@html.header("issues", repository)
@issuestab("issues", repository)
<ul class="nav nav-tabs">
<li class="pull-left"><a href="@path/@repository.owner/@repository.name/issues">&#8592; Back to issue list</a></li>
<li class="pull-right">Issue #1181</li>
<li class="pull-right">Issue #@issue.issueId</li>
</ul>
<div class="box">
<div class="box-content">
<div class="small"><a href="#">takezoe</a> opened this issue <time datetime="2013-06-03T15:56:05-07:00" title="2013-06-03 15:56:05">June 03, 2013</time></div>
<h4>2.1 migration issue - ebean</h4>
<div class="small"><a href="#">@issue.openedUserName</a> opened this issue <time title="2013-06-03 15:56:05">TODO June 03, 2013</time></div>
<h4>@issue.title</h4>
</div>
<div class="box-content" style="background-color: #f5f5f5;">
TODO Detail
@markdown(issue.content getOrElse "No description given.", repository, false, true, true)
</div>
</div>
<div class="box">
<div class="box-content">
@html.preview(repository, "Leave a comment", true, true, true)
@html.preview(repository, "Leave a comment", false, true, true)
</div>
</div>
<input type="submit" class="btn btn-success" value="Comment"/>

View File

@@ -38,7 +38,7 @@
</li>
</ul>
*@
@html.preview(repository, "Leave a comment", true, true, true, "width: 650px; height: 200px;")
@html.preview(repository, "Leave a comment", false, true, true, "width: 650px; height: 200px;")
</div>
</div>
<input type="submit" class="btn btn-success" value="Submit new issue"/>