Replace String#format() with string interpolation.

This commit is contained in:
shimamoto
2013-07-18 19:54:07 +09:00
parent 323e25951f
commit 188237db24
2 changed files with 8 additions and 8 deletions

View File

@@ -112,7 +112,7 @@ trait IssuesControllerBase extends ControllerBase {
// record activity // record activity
recordCreateIssueActivity(owner, name, userName, issueId, form.title) recordCreateIssueActivity(owner, name, userName, issueId, form.title)
redirect("/%s/%s/issues/%d".format(owner, name, issueId)) redirect(s"/${owner}/${name}/issues/${issueId}")
}) })
ajaxPost("/:owner/:repository/issues/edit/:id", issueEditForm)(readableUsersOnly { (form, repository) => ajaxPost("/:owner/:repository/issues/edit/:id", issueEditForm)(readableUsersOnly { (form, repository) =>
@@ -122,20 +122,20 @@ trait IssuesControllerBase extends ControllerBase {
getIssue(owner, name, params("id")).map { issue => getIssue(owner, name, params("id")).map { issue =>
if(isEditable(owner, name, issue.openedUserName)){ if(isEditable(owner, name, issue.openedUserName)){
updateIssue(owner, name, issue.issueId, form.title, form.content) updateIssue(owner, name, issue.issueId, form.title, form.content)
redirect("/%s/%s/issues/_data/%d".format(owner, name, issue.issueId)) redirect(s"/${owner}/${name}/issues/_data/${issue.issueId}")
} else Unauthorized } else Unauthorized
} getOrElse NotFound } getOrElse NotFound
}) })
post("/:owner/:repository/issue_comments/new", commentForm)(readableUsersOnly { (form, repository) => post("/:owner/:repository/issue_comments/new", commentForm)(readableUsersOnly { (form, repository) =>
handleComment(form.issueId, Some(form.content), repository)() map { id => handleComment(form.issueId, Some(form.content), repository)() map { id =>
redirect("/%s/%s/issues/%d#comment-%d".format(repository.owner, repository.name, form.issueId, id)) redirect(s"/${repository.owner}/${repository.name}/issues/${form.issueId}#comment-${id}")
} getOrElse NotFound } getOrElse NotFound
}) })
post("/:owner/:repository/issue_comments/state", issueStateForm)(readableUsersOnly { (form, repository) => post("/:owner/:repository/issue_comments/state", issueStateForm)(readableUsersOnly { (form, repository) =>
handleComment(form.issueId, form.content, repository)() map { id => handleComment(form.issueId, form.content, repository)() map { id =>
redirect("/%s/%s/issues/%d#comment-%d".format(repository.owner, repository.name, form.issueId, id)) redirect(s"/${repository.owner}/${repository.name}/issues/${form.issueId}#comment-${id}")
} getOrElse NotFound } getOrElse NotFound
}) })
@@ -146,7 +146,7 @@ trait IssuesControllerBase extends ControllerBase {
getComment(owner, name, params("id")).map { comment => getComment(owner, name, params("id")).map { comment =>
if(isEditable(owner, name, comment.commentedUserName)){ if(isEditable(owner, name, comment.commentedUserName)){
updateComment(comment.commentId, form.content) updateComment(comment.commentId, form.content)
redirect("/%s/%s/issue_comments/_data/%d".format(owner, name, comment.commentId)) redirect(s"/${owner}/${name}/issue_comments/_data/${comment.commentId}")
} else Unauthorized } else Unauthorized
} getOrElse NotFound } getOrElse NotFound
}) })
@@ -252,7 +252,7 @@ trait IssuesControllerBase extends ControllerBase {
private def executeBatch(repository: RepositoryService.RepositoryInfo)(execute: Int => Unit) = { private def executeBatch(repository: RepositoryService.RepositoryInfo)(execute: Int => Unit) = {
params("checked").split(',') map(_.toInt) foreach execute params("checked").split(',') map(_.toInt) foreach execute
redirect("/%s/%s/issues".format(repository.owner, repository.name)) redirect(s"/${repository.owner}/${repository.name}/issues")
} }
/** /**
@@ -297,7 +297,7 @@ trait IssuesControllerBase extends ControllerBase {
val owner = repository.owner val owner = repository.owner
val repoName = repository.name val repoName = repository.name
val userName = if(filter != "all") Some(params("userName")) else None val userName = if(filter != "all") Some(params("userName")) else None
val sessionKey = "%s/%s/issues".format(owner, repoName) val sessionKey = s"${owner}/${repoName}/issues"
val page = try { val page = try {
val i = params.getOrElse("page", "1").toInt val i = params.getOrElse("page", "1").toInt

View File

@@ -8,7 +8,7 @@
repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context) repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context)
@import context._ @import context._
@import view.helpers._ @import view.helpers._
@html.main("%s - Issue #%d - %s/%s".format(issue.title, issue.issueId, repository.owner, repository.name)){ @html.main(s"${issue.title} - Issue #${issue.issueId} - ${repository.owner}/${repository.name}"){
@html.header("issues", repository) @html.header("issues", repository)
@tab("issues", repository) @tab("issues", repository)
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">