Permalink
Browse files

Add few UI enhancements

  • Loading branch information...
Dinduks committed Sep 13, 2012
1 parent a881122 commit e3c3358dcb00e6d39ecf404f854e3388e188b83c
@@ -31,8 +31,9 @@ object Application extends Controller {
Async {
WS.url(githubGetRepoCommitsPath.format(githubApiUrl, username, repositoryName)).get().map { response =>
val commits = (response.json)
+ val commitsCount = commits.as[List[JsValue]].length
val contributorsList = getSortedCommittersList(commits)
- Ok(views.html.showRepoInfo(username, repositoryName, contributorsList))
+ Ok(views.html.showRepoInfo(username, repositoryName, contributorsList, commitsCount))
}
}
}
@@ -1,11 +1,13 @@
-@(contributor: Contributor)
+@(contributor: Contributor, commitsCount: Int)
@import revontulet.Util
-<a href="@contributor.url.getOrElse("https://github.com")">
+@if(contributor.url) { <a href="@contributor.url.getOrElse("https://github.com")"> }
+
@Util.trim(contributor.username.getOrElse(contributor.name.get), '"')
-
- @contributor.contributionsCounter commit among 30
+ @contributor.contributionsCounter commit among @commitsCount
+
+ (@((contributor.contributionsCounter.toFloat / commitsCount * 100).ceil)%)
- (@((contributor.contributionsCounter.toFloat / 30 * 100).ceil)%)
-</a>
+@if(contributor.url) { </a> }
@@ -1,6 +1,7 @@
@(username : String,
repositoryName : String,
- contributorsList: Map[String, Contributor])
+ contributorsList: Map[String, Contributor],
+ commitsCount: Int)
@import views.html.helper._
@@ -10,7 +11,7 @@ <h2>Contributors</h2>
<ul>
@for((username, contributor) <- contributorsList) {
<li>
- @contributorInfo(contributor)
+ @contributorInfo(contributor, commitsCount)
</li>
}
</ul>

0 comments on commit e3c3358

Please sign in to comment.