Index: Tools/GardeningServer/model/ct-commit.html |
diff --git a/Tools/GardeningServer/model/ct-commit.html b/Tools/GardeningServer/model/ct-commit.html |
index f23e821404997b68e2e2c47c9c108b8c362d88c9..836f15e636cb52af0731d4f81dc2bd2d2ca76e6a 100644 |
--- a/Tools/GardeningServer/model/ct-commit.html |
+++ b/Tools/GardeningServer/model/ct-commit.html |
@@ -5,11 +5,29 @@ found in the LICENSE file. |
--> |
<script> |
-function CTCommit(author, message) { |
+function CTCommit(author, message, baseUrl) { |
ojan
2014/07/21 00:44:56
I can split these changes out to a different patch
|
this.author = author; |
this.message = message.trim(); |
this.revision = this._findRevision(); |
this.summary = this.message.split('\n')[0]; |
+ this._baseUrl = baseUrl; |
+} |
+ |
+CTCommit.prototype.url = function() { |
abarth-chromium
2014/07/21 06:44:17
Getter?
ojan
2014/07/21 22:46:13
I really dislike getters. They make for surprising
|
+ var queryParameters = { |
+ view: 'rev', |
+ revision: this.revision, |
+ }; |
+ return this._baseUrl + '?' + CTCommit._queryParam(queryParameters); |
+} |
+ |
+// FIXME: This should live somewhere better so it can be reused. |
+CTCommit._queryParam = function(params) { |
abarth-chromium
2014/07/21 06:44:17
Object.toQueryString from sugar
ojan
2014/07/21 22:46:13
Not sure how I missed that.
|
+ var result = [] |
+ Object.keys(params, function(key, value) { |
+ result.push(encodeURIComponent(key) + '=' + encodeURIComponent(value)); |
+ }); |
+ return result.join('&'); |
} |
CTCommit.prototype._findRevision = function(message) { |
@@ -19,4 +37,4 @@ CTCommit.prototype._findRevision = function(message) { |
return parseInt(match[1], 10); |
return null; |
} |
-</script> |
+</script> |